MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _seed_bash_state

Function _seed_bash_state

tests/tool_system/test_task_stop.py:106–124  ·  view source on GitHub ↗

Seed a minimal ``LocalShellTaskState`` on ``runtime_tasks``. Used by the shell_id back-compat tests; mirrors what ``spawn_background_bash`` populates, minus the live Popen handle (so ``stop_background_bash`` returns False — which is exactly the routing-only behavior the test wants to

(ctx: ToolContext, task_id: str)

Source from the content-addressed store, hash-verified

104
105
106def _seed_bash_state(ctx: ToolContext, task_id: str) -> None:
107 """Seed a minimal ``LocalShellTaskState`` on ``runtime_tasks``. Used
108 by the shell_id back-compat tests; mirrors what ``spawn_background_bash``
109 populates, minus the live Popen handle (so ``stop_background_bash``
110 returns False — which is exactly the routing-only behavior the
111 test wants to verify)."""
112 from src.tasks.local_shell import LocalShellTaskState
113
114 state = LocalShellTaskState(
115 id=task_id,
116 type="local_bash",
117 status="running",
118 description="seeded test entry",
119 start_time=0.0,
120 output_file="/tmp/x",
121 command="sleep 30",
122 cwd="/tmp",
123 )
124 ctx.runtime_tasks.upsert(state)
125
126
127def test_shell_id_resolves_to_known_bash_task(ctx: ToolContext) -> None:

Calls 2

LocalShellTaskStateClass · 0.90
upsertMethod · 0.80

Tested by

no test coverage detected