Repository navigation
M4 Main agent (v0.3.0 milestone 4): a configured model plans, assigns and verifies through the ordinary gate — and can never execute anything itself - #7
Conversation
… named in the bar, and no client call ever waits on a human
The hub had ONE bearer token and no identity, so the approval bar could only
say "external agent"; and run_command blocked the client's HTTP call until the
human pressed Enter — Codex and Cursor time out at ~60 s, so two of the three
target agents could not use the hub at all.
REGISTRY. AgentToken { name, token, scopes, worktree } with no Debug derive (a
derived one would put the token into panic messages). Scopes read | journal |
propose | message; journal is deliberately not a default. TOOL_SCOPES is the
authorization table: a tool absent from it is unreachable by anyone. The legacy
single token migrates to an agent named "default" — pure, idempotent, no read
path ever writes; downgrade fails closed (an old binary sees token:"" and
autostart refuses). resolve_bearer folds over every agent with no early exit
and refuses anything that is not 64 lowercase hex. A revoke is visible on the
next request.
IDENTITY. From the bearer only; no tool takes from/as/agent_id. A caller may act
only on its own proposals, and a foreign id answers exactly like an unknown id.
Names are [a-z0-9][a-z0-9_-]{0,31}; reserved words and an adversarial table
(bidi override, ·, whitespace, 33 chars, "run?") are refused by test, because
the name is rendered in the approval bar and must not be able to forge it. The
bar reads "codex · run? ⌘⏎ approve · esc deny"; an external proposal with an
empty agent is not approvable by any key.
ASYNC PROPOSALS. run_command { command, wait_ms } returns within a clamped 25 s
with today's result or a proposal_id; await_decision polls, idempotent, pending
on expiry. There is NO approval timeout: a shown proposal waits as long as the
human takes. The proposal record owns the AgentRunGuard for exactly its
lifetime, released at every terminal state including a panic path; an invariant
test pins PROPOSALS non-terminal <=> AgentState.running. Store bounded at 64.
Abuse limits: 30 s global deny cooldown, 1 pending per agent, 4 total, and a
refusal never emits agent-propose.
Also: a read-only multi-line command block above the bar so a long proposal is
readable in full (closes a documented danger-gate limitation); hub_state, a
read-only IPC command tested to contain no 64-hex substring; protocol hygiene
(2025-11-25, MCP-Protocol-Version, no Mcp-Session-Id); client handshake replays.
Found by the adversarial pass and fixed: initialize disclosed run_command to
every caller regardless of scope; the "chord rule byte-identical" test matched
its own source line and could not fail; a denial cooldown could be outrun by a
caller that read the budget before the Esc landed; the four-surface drift test
ignored descriptions.
agent.rs: zero changed lines. enter_approves, agent_propose, agent_decide,
decision_stands, MIN_REVIEW byte-identical. pty_write_internal: 3 callers, the
write still lexically after the approval check.
183 -> 211 backend tests, 49 -> 55 frontend.
…nd what they read has known secret shapes redacted while the human's view stays byte-identical Agents that share the shell had no way to talk to each other or divide work, and everything an agent read from the terminal came back raw — including any key the human ever echoed. COORD. src-tauri/src/coord.rs holds the boards as a plain data structure: no AppHandle, no tauri::, no async, no statics — a source-grep test pins all four, and the file joins GREPPED with zero pty_write_internal calls. Message ring 500 with a monotonic seq and an exact `missed` for a cursor older than the ring. Tasks 64 active / 256 total, oldest terminal evicted, ids never reused; open → claimed → done | failed | cancelled; the 4th claim refused; update by the holder, cancel by holder or creator; every other caller gets the literal unknown-id answer. One validator for every text field (control, bidi, empty, length caps). TASKS.JSON v1, frozen: read_config/write_config semantics (0600, atomic, corrupt = Err with bytes untouched). A file that will not load leaves the board broken — verbs refuse, nothing overwrites it. A crashed holder's task reopens on load without burning a claim. A failed save rolls the change back and never acks. TOOLS under the message scope: post_message, read_messages, list_agents, create_task, claim_task, update_task, list_tasks. Attribution from the bearer only — a smuggled `from` is ignored (tested); update_task's schema has no assignee field; two racing claims → exactly one winner; every board change is on disk before the reply and announced once on the message board; every successful tool result carries `unread`. run_command takes an optional task_id with a 20-proposal budget per task, refused before the bar. parse_text_arg is lifted from parse_run_args so every string-taking tool shares its refusals. LIMITS. Per-agent token buckets: 60 messages/min, 30 task changes/min, reads a burst of 4 refilled at 2/s — isError with retry_after_ms. serve() caps handler threads at max(16, 4 × agents) with a per-agent share so one agent cannot starve another; the 17th connection gets 503 without a thread. REDACT. lib.rs redact(): shape scans, no regex crate — sk-/sk-ant-/gsk_/ghp_/ gho_/ghs_/ghu_/ghr_/github_pat_/xox[bpa]-/xapp-/AKIA/ASIA/AIza/JWT/PEM blocks/ Bearer/Authorization/URL userinfo/password=/token=/secret=/api_key= and their _-suffixed names. Applied on the agent-facing path only: read_journal, get_context, read_messages, list_tasks, run_command's own result, hub_state titles. The human's journal, term_write, ⌘B and the approval bar are byte-identical (tested); a call-site test pins exactly where redact( may appear. evals/redaction-corpus.json is read by both the Rust test and the JS mirror (npm run eval:redact, now a CI step), so the two cannot drift. Found by the adversarial pass and fixed: task text bypassed redaction and reached agents and the webview raw; run_command's result and await_decision's replay were unredacted; keys glued to escape sequences (\n, %3D, (B, SGR) slipped the word-boundary check; one agent could hold the whole handler cap. Predating M2: a local process that promised more than 1024 body bytes and never sent them stalled the accept thread forever, with no token — refuse() now answers such a request on its own thread. One M1 function changed: PropGuard::settle frees the approval slot before the verdict is visible to waiters, which was the source of a rare spurious BUSY and a flaky test. The gate — agent_propose, MIN_REVIEW, decision_stands, agent_decide(bool), enter_approves — is unchanged; agent.rs has zero changed lines; pty_write_internal has exactly 3 callers. Known limits, documented: a key folded across lines, cut by the 8 KiB output cap, or split by shell quoting gets through; no entropy scan. 211 -> 244 backend tests, 55 frontend, 0 warnings.
…trands most of them
CI's Ubuntu leg failed one_agent_holding_its_share_does_not_starve_another
("codex was never held to its share") and a rerun then hung in the backend
tests for the job's whole life. macOS passed every time. Reproduced in an
Ubuntu container: 2 of 7 runs failed.
Root cause is in tiny_http 0.12's TaskPool, not in Tachyon. `spawn` queues a
task onto "waiting" workers whenever waiting_tasks > 0, but a worker that has
been notified and not yet woken still counts as waiting, so a burst of
connections is queued onto the same handful of idle workers over and over.
Each worker wakes, pops ONE connection and runs it for the life of that
connection; every task past the first per worker sits in the queue until some
unrelated connection closes. A 40-line program against bare tiny_http on Linux
showed it: 17 connections opened at once, and in 14 of 20 rounds fewer reached
incoming_requests, as few as 4 (MIN_THREADS). Three MCP clients handshaking
together is exactly that burst; the maintained fork (tiny_http_dh) has the same
line.
The fix is one condition: spawn a thread when the queue already has a task per
waiting worker (`waiting_tasks <= queue.len()`), so a queued task always has a
distinct worker to wake. The crate is vendored at src-tauri/vendor/tiny_http —
the crates.io release plus that line, features/benches/examples/dev-deps
dropped, upstream's own lints allowed — and applied through [patch.crates-io].
a_burst_of_connections_all_reach_the_accept_loop pins it: 17 held connections,
all must reach the accept loop within 3 s, five rounds. On unpatched tiny_http
it fails on Linux in most runs; macOS wakes threads fast enough to hide it, so
the Ubuntu leg is the one that guards it. The formerly flaky test passed 9/9 on
Linux with the fix.
CI jobs get timeout-minutes: 20 so a hung test fails the job instead of sitting
on the 6 h default.
…s queue with leases, a worker's commands run visibly in its worktree, and a live foreground command is never handed on Today a second agent's run_command got BUSY and retried blind; the AgentRunGuard was owned by each Proposal record. TURNLOCK. coord.rs gains a pure TurnLock over an injected clock (no Instant::now, no lock(), no tauri — the module grep test now forbids all of them): FIFO queue of 8, a 9th refused; tickets monotonic and never reused; holder states Idle | AwaitingHuman | Running | Unknown. The lease measures agent silence only — LEASE_IDLE 60 s and MAX_TURN 10 min count Idle time, both clocks frozen in every other state, so there is no approval timeout and a holder in Unknown is never handed on by the lock. Silent waiters pruned at 90 s. set_state is keyed by ticket so a late Block from a released turn cannot idle the agent's next one. Every op returns events; the lock never sees a guard. GUARD PAIR (sign-off #1, second instance). mcp_server.rs holds static TURN and static TURN_GUARD; one function, apply(), is the only place a guard is taken (Granted → agent_claim) or dropped (Revoked/Pruned), grep-asserted. The Proposal record now carries the ticket it ran under. R11 is a test on every transition including a panic in run_gated and a cancel while AwaitingHuman, which drops the parked sender so agent_propose answers false with no PTY write. agent.rs changes by exactly one line: agent_start calls preempt_if_idle() first, so ⌘J takes the shell back from an idle remote holder and fails fast in every other state. TOOLS. request_turn { wait_ms } and release_turn (propose scope; a non-holder's release answers like "no turn"). BUSY is gone: run_command auto-requests a turn, returns { position, holder, holder_state, retry_after_ms } as isError when not granted inside its wait, and auto-releases on the Block — never from Unknown. hub_state.turn = { holder, state, since_ms, queue, expires_in_ms }. sweep runs on every lock op and every hub_state read; no timer thread. WORKTREES. A registry worktree wraps the command as `( cd <wt> && <cmd> )` in call_tool, before parse_run_args, so is_dangerous, the bar, the PTY write and the exit-mark matcher see one string. /mcp agent add --worktree and /mcp agent worktree <name> <path|off>; a path with a quote, space, $, backtick, ;, backslash, control or invisible char, or a relative path, is refused (table test). No tool has a worktree argument. SURFACE. agent-done is per proposal {agent, proposal_id}; the bar tracks the owner it shows so a done for X cannot clear a bar showing Y; run_gated no longer emits "thinking… (0/12)". /mcp turn and /mcp turn release across all four surfaces (SLASH_ROWS 25 → 28); release is refused while Running and allowed from Unknown with a warning. initialize states the turn contract. Found by the adversarial pass and fixed: a forged OSC 133;D in an approved command's output could end the turn while the process still held the foreground, and the next waiter's approved command would have gone into its stdin — wait_end now requires the Block AND the shell back in the foreground (tcgetpgrp on the master vs shell_pid; unknown answers "not ended"), for the first wait and the late one. Under ⌘J a granted waiter whose claim failed was dropped, breaking FIFO — requeued at the head. "keep the turn" was inferred from the reply — now recorded at request time. A preempted agent got no signal — its next request answers `preempted` once, before any proposal. C12a stress: 8 threads for 5 s over the real statics, ≤1 holder per observation, every grant matched by one release or revoke, holder ⇔ running at every observation, a crashed holder freed after the lease, the N-client harness rerun with queueing. pty_write_internal: 3 callers. enter_approves, agent_propose, MIN_REVIEW, decision_stands, agent_decide byte-identical. 244 → 280 backend tests, 55 → 56 frontend, 0 warnings.
…il it eight_agents_for_five_seconds_break_no_bound wrote tasks.json on every task change while eight threads hammered the board. On CI's Ubuntu runner, under the rest of the suite, that paced the run to 305 messages in 5 s, and the assertion that the run reached every ceiling (ring 500, 64 active, 256 total — there so the bounds tests cannot pass vacuously) failed. macOS's disk was fast enough to hide it. The bounds are the board's, not the disk's. The threads now run against an in-memory board; the file is written once afterwards and reloaded, which is the kill-and-reload half of the test and the only part that needs a path.
…-read
r11_one_holder_one_guard_at_every_transition failed once on CI's Ubuntu leg
("a grant with no guard was left holding the shell") and passed 10/10 in
isolation there. The turn lock is process-global: a handler thread that an
earlier test left behind can `touch` it in the gap between take_turn returning
and the test's re-read, and that grants the queued r11c with THAT test's claim
— a legitimate grant, with a guard, that the old assertion mistook for a
holder without one.
The busy payload is built inside the critical section, so it is the one
reading no other thread can disturb: it now must say no holder AND r11c at
position 1. Outside the lock the test asserts R11 itself — a holder iff a
guard — and that ⌘J's own claim was untouched.
…ing and grants nobody In the full suite on Linux r11_one_holder_one_guard_at_every_transition failed at "preempt refused while AwaitingHuman": the lock had a holder, the test's own approval slot was free. Since M3 every tools/call runs touch(caller), and touch — like every lock op — swept first, and a sweep grants the head of the queue. So an M2 board test running in parallel (post_message from a stub that never asked for the shell) was the thread that granted r11c, with ITS stub's claim; the test then found a holder whose guard belonged to nobody it knew. In the app there is one claim, so the grant itself would have been right; the flaw is in who makes it. An agent reading the board is not waiting for the shell, and its message is not the moment to re-read leases and hand the shell on. A stale ticket's settle — a command's late Block for a released turn — is the same kind of non-event. Both now return no events and touch nothing. Waiters re-ask every retry_after_ms and every hub_state read sweeps, so a lapsed lease is still noticed by someone who wants the shell. set_state_is_keyed_by_ticket pins both: with the shell free and a waiter at the head, a stale settle and a stranger's touch each grant nobody. agree() now names the holder it found, so the next such failure says who.
…ed ones the_17th_held_connection_gets_503_and_no_thread failed in 2 of 6 full-suite runs on Linux and 0 of 17 alone. Under load a poll was in flight when the last of the 16 holds reached the accept loop, so for that instant the cap was full and the HELD request was the one refused — 15 parked, and every later poll answered 200 until the deadline. A refused hold is not silent: it hears a 503 on its socket, while a parked one hears nothing. The poll loop now peeks each held socket with a 1 ms read timeout and re-opens any that was answered, so the 503 it waits for is always the one that means sixteen are parked.
…signs them, and verifies results through the ordinary gate — and can never execute anything itself Agents could share the shell, talk and divide work, but a human had to write every task. Now `/route manager <provider> [model]` picks a model and `/manager <goal>` makes it the main agent. THE MANAGER CANNOT EXECUTE (R10). src-tauri/src/manager.rs contains none of pty_write_internal, agent_claim, run_command or McpPool::call, and exactly one call to mcp_server::verify_gate — a grep test counts all of it, and manager.rs joins GREPPED with zero PTY writes. agent.rs has zero changed lines. PLAN, THEN ONE HUMAN DECISION. MANAGER_PLAN asks for lines of `TASK: <agent> | <title> | <verify command>`; parse_plan refuses wrong arity, unregistered or reserved agents, empty or trivial checks (true, :, exit 0, echo ok), control/bidi text through run_command's own parse_run_args, duplicates and too many tasks — one retry with the error, then stop. The plan is printed through the display path, never the PTY, and awaited on a second INSTANCE of the fail-closed oneshot: rx.await.unwrap_or(false), with agent::decision_stands reused so MIN_REVIEW applies. manager_decide is its one writer, behind /manager approve|reject (webview-reachable exactly like agent_decide, documented). Dropped sender, double decide, stop → deny. Reject leaves the board untouched; approve creates the tasks as "manager". VERIFY THROUGH THE GATE. A check string is frozen at plan approval (a newtype built only in parse_plan, no mutator) and never shown to a worker. When a worker reports done, verify_gate takes a turn as the reserved agent "verify" — no token can be that caller — wraps the check in the assignee's worktree and goes through the same open_gate/run_gated/wait_end as any external proposal: the bar reads "verify · run? ⌘⏎ approve · esc deny", MIN_REVIEW, cooldown and the turn lock all apply. Exit 0 → Verified; anything else, denial or no answer → FailedVerify. Reported is never Verified. SUPERVISE. A pure Supervisor driven by board events (a message cursor and task-state diffs), never by a timer: zero model calls when nothing changes. Closed verbs ASSIGN, DROP, NOTE, REPLAN, DONE, WAIT — no RUN, no TASK after approval; REPLAN needs a new approval and is capped. render_board is bounded per field and at 6000 bytes, fenced as untrusted DATA; a forged TASK:/ASSIGN in a note moves nothing. Identical replies twice force WAIT. Budgets from manager.json (max_tasks 8, model calls 40, reassignments 2, wall clock 1800 s, plans 3, claim timeout 300 s; corrupt = refuse to start), each tripping with a named reason. The final report is computed from board state, never from model prose. Found by the adversarial pass and fixed: - A worker could read the check string from read_journal after the verify run → journal_json drops every check Block; a worker sees none of them. - Any registered agent could claim a manager task and fail it to burn the reassignment budget → a manager task can be claimed only by its assignee. - Board chatter could spend the model-call budget → message-only rounds are held back for 120 s; task events still call the model at once. - A worker's code could print a forged OSC 133;D and have the check read as exit 0 → the check runs as `( <check> ); echo tachyon-check-<nonce>=$?` with a fresh 16-hex nonce, and only that echo, as the very last output, counts; a Block closed early carries no mark and fails. - A check queued behind an endless command could hold the run forever → stop and the wall-clock budget are asked before every retry. Known limits, documented: shell history (zsh INC_APPEND_HISTORY) can hand the nonce to code under test; aliases and functions reach into the check's subshell; fish has no $? so its checks fail closed. 281 -> 335 backend tests, 56 frontend, 0 warnings. eval:manager:selftest runs 8 scripted runs from evals/manager-runs.json, read by the Rust test too, in CI.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoAdd gated main-agent planning, assignment, and verification
AI Description
Diagram
High-Level Assessment
Files changed (40)
|
Code Review by Qodo
1. Failed checks become verified
|
| let last = cmd.rsplit([';', '|']).find(|s| !s.trim().is_empty()).unwrap_or(""); | ||
| last.split("&&").all(noop) |
There was a problem hiding this comment.
1. Failed checks become verified 🐞 Bug ≡ Correctness
is_trivial_verify examines only the final pipe or semicolon segment and therefore accepts checks such as false | tee /tmp/log whose final command returns zero independently. When that approved check runs after a worker reports completion, verdict converts its zero status into Verified despite the failed test.
Agent Prompt
## Issue description
Verification validation accepts pipelines and conditionals whose final command succeeds even when the actual test fails, causing failed work to be recorded as verified.
## Fix Focus Areas
- src-tauri/src/manager.rs[1152-1164]
- src-tauri/src/manager.rs[1189-1196]
- src-tauri/src/manager.rs[337-344]
## Recommended Fix
Replace the partial final-segment denylist with validation that rejects shell lists, pipelines, and conditionals capable of masking a failed check, including `||` and success-producing pipeline tails. Add tests proving examples such as `false | tee /tmp/log` and `false || echo passed` cannot enter a plan.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| return false; | ||
| } | ||
| show(); | ||
| let ok = rx.await.unwrap_or(false); |
There was a problem hiding this comment.
2. Runs outlive wall-clock budgets 🐞 Bug ☼ Reliability
manager_run records started before planning, but model requests and plan_approved do not check the resulting deadline before waiting for approval or placing tasks. An undecided initial or replacement plan can keep the manager active indefinitely, while approval after wall_clock_secs has elapsed still reaches place_plan and creates tasks before supervise detects the expired budget and cancels them.
Agent Prompt
## Issue description
The configured wall-clock budget does not bound initial or replacement planning and plan-approval waits. Approval after the deadline can still place assigned tasks on the board before supervision detects the expired budget and cancels them.
## Fix Focus Areas
- src-tauri/src/manager.rs[140-164]
- src-tauri/src/manager.rs[216-261]
- src-tauri/src/manager.rs[219-236]
- src-tauri/src/manager.rs[851-873]
- src-tauri/src/manager.rs[914-920]
## Recommended Fix
Pass the run deadline into initial planning, replacement planning, and `plan_approved`. Race each model request and approval wait against the remaining deadline, fail closed if it expires while waiting or immediately before `place_plan`, and do not create board tasks after the deadline. Ensure expiration follows the run’s normal cleanup and emits the normal final budget report.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| fn drop_task(&mut self, id: &str) { | ||
| // best effort: a dropped task is the manager's to forget whether or not the board | ||
| // took the cancel | ||
| let _ = Self::cancel(&mut self.board.lock().unwrap_or_else(|e| e.into_inner()), id, "dropped by the manager"); |
There was a problem hiding this comment.
3. Dropped tasks keep running 🐞 Bug ☼ Reliability
OnBoard::drop_task discards the result of the persistent board cancellation, while Supervisor::apply marks the corresponding slot dropped unconditionally. If task persistence is broken or unwritable, the board rolls back the cancellation but the manager forgets the still-open or claimed task and no longer supervises it.
Agent Prompt
## Issue description
Manager task cleanup ignores persistent cancellation failures and updates supervisor state as though the task was removed.
## Fix Focus Areas
- src-tauri/src/manager.rs[381-389]
- src-tauri/src/manager.rs[425-432]
- src-tauri/src/manager.rs[466-470]
- src-tauri/src/manager.rs[765-800]
## Recommended Fix
Change `BoardView::drop_task` to return `Result`. Only mark a slot dropped after cancellation succeeds, propagate failures through replacement and final cleanup, and report any task IDs that could not be cancelled instead of claiming they came off the board.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| for msg in messages.iter().rev().filter(|m| m.from != mcp_server::SYSTEM_AUTHOR) { | ||
| let to = msg.to.as_deref().map(|to| format!(" to {}", clip(to, coord::MAX_NAME_CHARS))).unwrap_or_default(); | ||
| body.push_str(&format!("message {} from {}{to}\n text: {}\n", msg.id(), msg.from, clip(&msg.text, SHOWN_TEXT))); |
There was a problem hiding this comment.
4. Board secrets reach model providers 🐞 Bug ⛨ Security
render_board redacts task fields through task_out but inserts msg.text directly after clipping it, explicitly omitting the redaction boundary. Whenever a message containing a credential is included in the next supervision context, Supervisor::ask sends that plaintext to the configured manager model provider.
Agent Prompt
## Issue description
Agent-authored board messages are copied into manager model prompts without the redaction applied to other agent-facing data.
## Fix Focus Areas
- src-tauri/src/manager.rs[981-1009]
- src-tauri/src/manager.rs[711-734]
- src-tauri/src/lib.rs[1622-1655]
## Recommended Fix
Run each message body through `redact` before clipping and inserting it into `render_board`. Add a test with recognized API keys and authorization values proving the rendered manager context contains only redaction markers.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| [.., b':'] => { | ||
| let user_start = i - 1 - pre[..i - 1].iter().rev().take_while(|&&c| !b"/@: \t\r\n".contains(&c)).count(); | ||
| let end = run_end(b, i, |c| !b"@/ \t\r\n".contains(&c)); | ||
| return (pre[..user_start].ends_with(b"://") && b.get(end) == Some(&b'@')).then_some((i, end, "url-password")); |
There was a problem hiding this comment.
5. Yaml secrets reach other agents 🐞 Bug ⛨ Security
secret_at handles a colon only as the separator in a URL password and returns before applying SECRET_NAMES to ordinary colon assignments. Values in password: hunter2, token: value, or similar board and terminal text therefore remain plaintext on the newly redacted agent-facing read paths.
Agent Prompt
## Issue description
The new agent-facing redactor does not redact common YAML and configuration secret assignments that use a colon instead of an equals sign.
## Fix Focus Areas
- src-tauri/src/lib.rs[1778-1824]
- evals/redact.mjs[86-108]
- evals/redaction-corpus.json[1-63]
## Recommended Fix
After excluding valid URL-password syntax, parse colon-separated names using the same normalized `SECRET_NAMES` matching as equals assignments and redact their values, including quoted JSON/YAML values. Mirror the behavior in the JavaScript evaluator and add positive corpus cases for password, token, API-key, and secret-key colon forms.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| let started = Instant::now(); | ||
| let say = |text: String| term_write(app.clone(), app.state::<PtyState>(), text); | ||
| let mut model = Metered { inner: LiveModel, calls: 0, max: budgets.max_model_calls }; | ||
| let plan = match make_plan(&goal, "", budgets.max_tasks, &mut model).await { |
There was a problem hiding this comment.
7. Zero plan budget still plans 🐞 Bug ≡ Correctness
manager_run calls make_plan unconditionally, although max_plans is documented to include the first plan. A valid manager.json with max_plans: 0 therefore still invokes the model and can place an initial plan; only later REPLAN requests consult replan_room.
Agent Prompt
Issue description
The initial planning path bypasses `max_plans`, despite that budget explicitly including the first plan. A zero-plan configuration must prevent the initial model call and task placement.
Fix Focus Areas
- src-tauri/src/manager.rs[80-90]
- src-tauri/src/manager.rs[140-150]
Recommended Fix
Before invoking `make_plan` for the initial plan, reject the run when `max_plans` is zero using the same budget reason used by replanning. Keep the initial and replan budget semantics consistent.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| } | ||
| // Checks first: a report the worker made before the model's reply is not thrown away | ||
| // by a DROP or REPLAN written without knowing it passed. | ||
| let deadline = started + Duration::from_secs(budgets.wall_clock_secs); |
There was a problem hiding this comment.
6. Large clock limit crashes manager 🐞 Bug ☼ Reliability
wall_clock_secs accepts every u64 from manager.json, then supervise adds its duration to Instant with unchecked +. A sufficiently large valid value overflows the platform Instant, panics the spawned manager task, and bypasses finish, which is responsible for cancelling unfinished tasks and publishing the final report.
Agent Prompt
Issue description
A syntactically valid but very large `wall_clock_secs` value can overflow `Instant` arithmetic during verification. The panic exits before manager cleanup and reporting run.
Fix Focus Areas
- src-tauri/src/manager.rs[41-60]
- src-tauri/src/manager.rs[910-956]
- src-tauri/src/manager.rs[876-885]
Recommended Fix
Validate `wall_clock_secs` to a representable operational maximum when loading budgets, or construct the deadline with `checked_add` and stop the run cleanly on overflow. Ensure the error path still calls `finish`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| self.last_task += 1; | ||
| let task = Task { | ||
| id: format!("t_{}", self.last_task), |
There was a problem hiding this comment.
8. Task creation can overflow ids 🐞 Bug ☼ Reliability
Board::load_from accepts a persisted t_18446744073709551615 identifier and assigns its numeric suffix to last_task, while create increments that value with += 1. On the next task creation this panics in checked builds or wraps in release builds, allowing a valid-looking tasks.json to crash creation or reuse an identifier.
Agent Prompt
Issue description
The persisted task-ID counter can be loaded at `u64::MAX`, but creating the next task increments it without overflow handling. This can panic or reuse a task ID.
Fix Focus Areas
- src-tauri/src/coord.rs[276-313]
- src-tauri/src/coord.rs[402-422]
Recommended Fix
Use `checked_add` when allocating the next task ID and return a board error when the counter is exhausted. Optionally reject `u64::MAX` during load, but preserve the no-ID-reuse invariant in either path.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| let ran = mcp_server::verify_gate(app, id, &cmd, &stopped); | ||
| m.verify.lock().unwrap_or_else(|e| e.into_inner()).insert(id.to_string(), cmd); |
There was a problem hiding this comment.
9. Completed runs retain check commands 🐞 Bug ☼ Reliability
verify_task always puts each command back into ManagerState.verify, including after a successful final verification, and neither finish nor ManagerRunGuard clears that map. Each completed manager run therefore retains its approved command strings indefinitely, so repeated runs grow the application’s memory use even though old task checks can no longer be used.
Agent Prompt
Issue description
Approved verification commands remain in `ManagerState.verify` after their task and manager run have completed. Repeated runs retain otherwise unreachable command strings indefinitely.
Fix Focus Areas
- src-tauri/src/manager.rs[347-364]
- src-tauri/src/manager.rs[876-885]
- src-tauri/src/manager.rs[123-134]
Recommended Fix
Retain a command only while its task can still be reassigned, then remove it after a terminal verified or dropped outcome. Also clear any remaining run-owned verification entries during manager shutdown/finish.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Milestone 4 of the v0.3.0 plan, on top of #6 (M3) — the diff collapses once #4, #5 and #6 merge.
335 backend tests (was 281) · 56 frontend · zero warnings · Linux 3/3 full-suite runs green.
agent.rshas zero changed lines vs M3;pty_write_internalstill 3 callers (manager.rs is inGREPPEDwith 0); exactly oneverify_gate(in manager.rs.How it works
/route manager <provider> [model], then/manager <goal>:TASK: <agent> | <title> | <verify command>lines.parse_planrefuses unknown/reserved agents, trivial checks (true,:,exit 0,echo ok), control/bidi text (viarun_command's ownparse_run_args), duplicates and too many tasks.rx.await.unwrap_or(false)withagent::decision_standsreused, soMIN_REVIEWapplies./manager approve|reject→manager_decide(bool), its only writer. Reject leaves the board untouched.manager; only the named assignee can claim one.verify— the bar readsverify · run? ⌘⏎ approve · esc deny. Exit 0 → Verified; anything else → FailedVerify. The check string is never shown to a worker.ASSIGN DROP NOTE REPLAN DONE WAIT— noRUN, noTASKafter approval;REPLANneeds a new approval. Board text is bounded and fenced as untrusted DATA.manager.json; corrupt = refuse to start). The final report is computed from board state, never from model prose.Found by the adversaries and fixed
read_journal→ check Blocks are dropped from every agent-facing journal read.OSC 133;Dand make a failing check read as exit 0 → the check runs as( <check> ); echo tachyon-check-<nonce>=$?with a fresh random nonce, and only that echo, as the very last output, counts.Known limits (documented)
Shell history (zsh
INC_APPEND_HISTORY) can hand the nonce to code under test; aliases/functions reach into the check's subshell; fish has no$?, so its checks fail closed. Not run against a real model or real workers yet.