Skip to content

Commit f13a6d9

Browse files
fix: bind server lifecycle commands to plans
1 parent 618823b commit f13a6d9

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

‎task_engine.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def _scoped_task_id(scope_key: str, raw_task_id: str) -> str:
5858
_ORDERED_ACTION_HINTS = {
5959
"inspect": ("read", "inspect", "list", "directory", "repo", "repository", "structure", "tree"),
6060
"write": ("write", "edit", "add", "update", "create", "modify", "append"),
61-
"execute": ("run", "test", "execute", "command", "suite", "pytest"),
61+
"execute": (
62+
"run", "test", "execute", "command", "suite", "pytest",
63+
"start", "serve", "verify", "check", "stop", "kill",
64+
),
6265
"review": ("diff", "review", "compare"),
6366
"status": ("status", "clean"),
6467
"stage": ("stage", "staging"),

‎tests/test_task_consistency.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,22 @@ def test_plain_string_plan_reconciles_in_order_after_restart_and_leaves_unmatche
410410
self.assertIn("unmatched_reason", evidence)
411411
self.assertEqual([task["status"] for task in unmatched.tasks], ["pending", "pending"])
412412

413+
lifecycle = TaskManager(store, workspace_id="project", session_id="server-lifecycle")
414+
lifecycle.from_llm_block(
415+
"TaskList:\n```json\n"
416+
'["Start HTTP server and capture its PID", '
417+
'"Verify HTTP 200 with curl", "Stop the server and confirm the port is closed"]\n'
418+
"```"
419+
)
420+
for args in ("python3 -m http.server 8765", "curl http://localhost:8765", "kill 123"):
421+
allowed, _reason = lifecycle.mutation_matches_current_task("run_cmd", args)
422+
self.assertTrue(allowed)
423+
evidence = lifecycle.record_evidence(
424+
action="run_cmd", args=args, result="verified", success=True,
425+
)
426+
self.assertIn("task_id", evidence)
427+
self.assertEqual([task["status"] for task in lifecycle.tasks], ["succeeded"] * 3)
428+
413429
mismatch = TaskManager(store, workspace_id="project", session_id="mismatch")
414430
mismatch.from_llm_block(
415431
"TaskList:\n```json\n[\"Write the file\", \"Run the tests\"]\n```"

0 commit comments

Comments
 (0)