mirror of
https://github.com/0xWheatyz/handler.git
synced 2026-08-30 11:06:24 +00:00
feat!: headless is the only runner - delete the tmux run path (phase 4)
Agent runs are now always worker-owned 'claude -p' subprocesses; tmux survives only for the interactive /login flow. - deleted: worker.capture_agent_output/_pane_tail + the capture loop arm (the empty-/log bug's home), spawn's tmux launch/_claude_command, the tmux resume/kill branches (the silent-send-keys bug's home), tmux.session_name/list_sessions, the CLI attach subcommand, the 'runner' setting - spawn: task is now a hard requirement (headless has no idle REPL) - enforced in spawn (SpawnError) and the API (400); onboarding seeding dropped (-p skips the trust dialog) - resume: single headless path; pre-headless agent rows (no session_id) degrade to the context-re-injection fresh run - settings_gen: permissions allowlist is always emitted - credsync: change-triggered uploads key on .claude/.credentials.json only (claude touches ~/.claude.json every run - keying on it would ping-pong uploads between workers); logins still publish explicitly - cli list: liveness from agent_runs in the DB, not tmux - tests: spawn/kill/resume re-pointed at the fake_launch seam (conftest); integration test now drives API -> worker -> real fake claude subprocess -> events endpoint; README documents the headless model + multi-worker deployment invariants Suite 295 green; frontend unchanged since phase 3.
This commit is contained in:
@@ -229,45 +229,6 @@ def test_bad_command_is_recorded_failed_not_raised(env):
|
||||
assert "agent name" in failed["error"]
|
||||
|
||||
|
||||
def test_capture_agent_output_snapshots_working_agents(env, monkeypatch):
|
||||
with get_engine().begin() as conn:
|
||||
repo.create_project(conn, "p", "/tmp/p")
|
||||
agent = repo.create_agent(conn, "p", "api", "/tmp/p/api", status="working")
|
||||
|
||||
monkeypatch.setattr(worker.tmux, "has_session", lambda name: True)
|
||||
monkeypatch.setattr(
|
||||
worker.tmux, "capture_pane", lambda name, escapes=False: "boot\nTheme picker\n\n\n"
|
||||
)
|
||||
|
||||
assert worker.capture_agent_output() == 1
|
||||
with get_engine().begin() as conn:
|
||||
row = repo.get_agent_by_id(conn, agent["id"])
|
||||
# The tail is stored with trailing blank lines trimmed.
|
||||
assert row["last_output"] == "boot\nTheme picker"
|
||||
assert row["output_at"] is not None
|
||||
|
||||
|
||||
def test_capture_agent_output_skips_dead_sessions_and_nonworking(env, monkeypatch):
|
||||
with get_engine().begin() as conn:
|
||||
repo.create_project(conn, "p", "/tmp/p")
|
||||
repo.create_agent(conn, "p", "gone", "/tmp/p/gone", status="working")
|
||||
done = repo.create_agent(conn, "p", "done", "/tmp/p/done", status="done")
|
||||
|
||||
captured = []
|
||||
monkeypatch.setattr(worker.tmux, "has_session", lambda name: False)
|
||||
monkeypatch.setattr(
|
||||
worker.tmux,
|
||||
"capture_pane",
|
||||
lambda name, escapes=False: captured.append(name) or "x",
|
||||
)
|
||||
|
||||
# The working agent's session is dead (skipped); the done agent isn't queried at all.
|
||||
assert worker.capture_agent_output() == 0
|
||||
assert captured == []
|
||||
with get_engine().begin() as conn:
|
||||
assert repo.get_agent_by_id(conn, done["id"])["last_output"] is None
|
||||
|
||||
|
||||
def test_drain_processes_multiple_then_stops(env, monkeypatch):
|
||||
_seed_project()
|
||||
monkeypatch.setattr(poller, "sweep", lambda project_id=None: {"checked": 0})
|
||||
|
||||
Reference in New Issue
Block a user