From 951bf75bbe2bd6b6f8a5528b6f2e342d17ec8a26 Mon Sep 17 00:00:00 2001 From: CleverThis Date: Tue, 5 May 2026 04:22:42 +0000 Subject: [PATCH] fix(cli): resolve typecheck errors and ULID validation in plan use panels Fix three typecheck errors introduced in the previous commit: - session_service.py: guard against None checksum before string concatenation - plan.py: use compressed_tokens (SkeletonMetadata) instead of non-existent indexed_file_count attribute for Context panel Indexed Files field - plan.py: use budget_remaining (CostMetadata) instead of non-existent hot_token_budget attribute for Context panel Hot Token Budget field Fix invalid ULID character 'L' in test fixtures: - features/steps/tdd_plan_use_structured_panels_steps.py: replace 01JTEST1468PANELS0000000001 with 01JTEST1468PANEMS0000000001 - robot/helper_tdd_plan_use_structured_panels.py: same ULID fix ISSUES CLOSED: #1468 --- .../tdd_plan_use_structured_panels_steps.py | 2 +- robot/helper_tdd_plan_use_structured_panels.py | 2 +- src/cleveragents/cli/commands/plan.py | 16 +++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/features/steps/tdd_plan_use_structured_panels_steps.py b/features/steps/tdd_plan_use_structured_panels_steps.py index 1dc13aae0..61a164b09 100644 --- a/features/steps/tdd_plan_use_structured_panels_steps.py +++ b/features/steps/tdd_plan_use_structured_panels_steps.py @@ -23,7 +23,7 @@ from cleveragents.domain.models.core.plan import ( ProjectLink, ) -_PLAN_ULID = "01JTEST1468PANELS0000000001" +_PLAN_ULID = "01JTEST1468PANEMS0000000001" def _make_action(name: str = "local/test-action") -> Action: diff --git a/robot/helper_tdd_plan_use_structured_panels.py b/robot/helper_tdd_plan_use_structured_panels.py index 83e03e094..6f080e710 100644 --- a/robot/helper_tdd_plan_use_structured_panels.py +++ b/robot/helper_tdd_plan_use_structured_panels.py @@ -46,7 +46,7 @@ from cleveragents.domain.models.core.plan import ( # noqa: E402 runner = CliRunner() -_PLAN_ULID = "01JTEST1468PANELS0000000001" +_PLAN_ULID = "01JTEST1468PANEMS0000000001" def _mock_action(name: str = "local/test-action") -> Action: diff --git a/src/cleveragents/cli/commands/plan.py b/src/cleveragents/cli/commands/plan.py index 55641dfcf..e937ba5c7 100644 --- a/src/cleveragents/cli/commands/plan.py +++ b/src/cleveragents/cli/commands/plan.py @@ -1649,22 +1649,24 @@ def _print_use_action_panels(plan: Any) -> None: f"{resource_count} ({resource_names})" if resource_count > 0 else "0" ) - # Indexed files: from skeleton_metadata if available + # Indexed files: use compressed_tokens from skeleton_metadata as a proxy + # for the number of indexed context tokens (spec field; actual file count + # is not tracked separately in SkeletonMetadata). indexed_files_val: str - if plan.skeleton_metadata and hasattr(plan.skeleton_metadata, "indexed_file_count"): - indexed_files_val = str(plan.skeleton_metadata.indexed_file_count) + if plan.skeleton_metadata is not None: + indexed_files_val = str(plan.skeleton_metadata.compressed_tokens) else: indexed_files_val = "(unknown)" # View: the current phase value (strategize at plan creation) view_val = phase_val - # Hot token budget: from cost_metadata if available + # Hot token budget: use budget_remaining from cost_metadata if available hot_token_budget_val: str - if plan.cost_metadata and hasattr(plan.cost_metadata, "hot_token_budget"): - budget = plan.cost_metadata.hot_token_budget + if plan.cost_metadata is not None: + budget = plan.cost_metadata.budget_remaining hot_token_budget_val = ( - f"{budget:,}" if budget is not None else "(unknown)" + f"{budget:,.2f}" if budget is not None else "(unlimited)" ) else: hot_token_budget_val = "(unknown)"