Skip to content

Commit 54f9947

Browse files
committed
Make TUI status and resume guards reflect the real test surface
Turn a stubbed status path into a real heartbeat lookup, convert controller-cost wiring from private-state mutation into a wiring assertion, and remove two skips that were only masking ordinary edge cases. Constraint: Resume replay remains partially unimplemented; the remaining skip markers are still attached to real work, not test laziness. Rejected: Leave the status handler returning unknown | that keeps a user-visible command from proving anything useful. Confidence: high Scope-risk: narrow Directive: Keep future tests focused on public commands or explicit wiring, not direct state injection unless the private state itself is the contract. Tested: git diff --check; python3 scripts/validate_docs_consistency.py; python3 -m pytest tests/test_tui.py tests/test_cli_chat.py -q Not-tested: the remaining resume replay skips and broader suite-wide skip inventory were not fully remediated in this pass
1 parent b5225b0 commit 54f9947

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

teaagent/tui/_commands.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ def _handle_tui_command(tui: 'TeaAgentTUI', raw_command: str) -> bool:
174174
tui.output_fn('error: status requires a run id')
175175
return True
176176
run_id = args[0]
177-
from teaagent.run_store import RunStore
178-
179177
store = RunStore(tui.root) # type: ignore[assignment]
180-
# Simplified status check
181-
tui._print_json({'run_id': run_id, 'status': 'unknown'})
178+
try:
179+
tui._print_json(store.heartbeat_for_run(run_id))
180+
except FileNotFoundError:
181+
tui.output_fn(f"error: run '{run_id}' not found")
182182
return True
183183

184184
if action == 'plan':
@@ -246,6 +246,10 @@ def _handle_tui_command(tui: 'TeaAgentTUI', raw_command: str) -> bool:
246246
tui.output_fn('error: resume requires a run id')
247247
return True
248248
run_id = args[0]
249+
store = RunStore(tui.root)
250+
if not store.run_path(run_id).is_file():
251+
tui.output_fn(f"error: run '{run_id}' not found")
252+
return True
249253
_safe_run_agent_task(tui, '', resumed_from=run_id)
250254
return True
251255

tests/test_tui.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -785,9 +785,6 @@ def test_tui_resume_requires_run_id(self) -> None:
785785
self.assertTrue(tui.handle_command('resume'))
786786
self.assertIn('requires a run id', output[0])
787787

788-
@pytest.mark.skip(
789-
reason='Resume unknown run ID handling not working - requires investigation'
790-
)
791788
def test_tui_resume_unknown_run_id(self) -> None:
792789
with tempfile.TemporaryDirectory() as tmp:
793790
output = []
@@ -905,7 +902,6 @@ def test_tui_print_header_output(self) -> None:
905902

906903
self.assertEqual(output[0], 'TeaAgent TUI 0.1.0')
907904

908-
@pytest.mark.skip(reason='TUI status command not working - requires investigation')
909905
def test_tui_status_with_valid_run(self) -> None:
910906
with tempfile.TemporaryDirectory() as tmp:
911907
output = []
@@ -955,15 +951,9 @@ def test_tui_uses_chat_session_controller_for_cost_tracking(self) -> None:
955951
# Verify chat controller is created
956952
controller = tui._get_chat_controller()
957953
self.assertIsNotNone(controller)
954+
self.assertIs(controller.session_state, tui._session_state)
958955
self.assertEqual(controller.session_state.session_cost_cents, 0.0)
959-
960-
# Simulate cost accumulation through controller (as would happen in real execution)
961-
controller.session_state.session_cost_cents += 50.0
962-
tui._session_cost_cents = controller.session_state.session_cost_cents
963-
964-
# Verify cost was tracked through controller
965-
self.assertEqual(tui._session_cost_cents, 50.0)
966-
self.assertEqual(controller.session_state.session_cost_cents, 50.0)
956+
self.assertIs(tui._get_chat_controller(), controller)
967957

968958
def test_tui_cost_command_shows_controller_cost(self) -> None:
969959
"""TUI /cost should reflect controller state and keep currency formatting."""

0 commit comments

Comments
 (0)