Skip to content

fix(core): classify agent_poll as Risk::Write (consumes the mailbox) - #301

Merged
ajianaz merged 1 commit into
developfrom
fix/agent-poll-risk-tier
Oct 7, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/agent-poll-risk-tier

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

What

Reclassify agent_poll from Risk::ReadOnly to Risk::Write (option A) and allowlist it by exact name in --trust internal.

Why

A settled agent_poll calls clean_mailbox (uteke forget) and write_meta (persists mailbox_consumed) via consume_mailbox. A ReadOnly tier let that mutation skip the Approver and run under plan mode, violating AGENTS.md section 6 and the invariant job_poll documents (a ReadOnly poll must never mutate).

Why A over B (pure ReadOnly poll, consumption elsewhere): consume-once semantics (#243/#260/#287) are load-bearing, and there is no other legitimate Write path that observes a child settling (the child is detached; agent_start has returned long before). Option B would need a new host-side mechanism or leave mailboxes uncleaned, i.e. more code and weaker behavior. Option A keeps consume_mailbox untouched (consume-once, mark consumed only after successful recall, retry on recall error).

Plan mode: Write tools are dropped, but agent_start (already Write) is dropped too, so no child can exist for a plan-mode parent to poll. Nothing regresses.

Unattended friction: --trust internal previously covered job_* but not agent_*. I added the exact name agent_poll (not agent_*), so the poll loop stays prompt-free while agent_start still prompts. The read_only preset is unchanged: it holds no agent_start, and adding a mutating tool to it would contradict its name. Destructive layers are untouched.

Changes

  • AgentPollTool::risk() -> Risk::Write with a doc comment explaining why.
  • internal trust preset gains agent_poll; preset test asserts it and that agent_*/agent_start are not allowlisted.
  • New test agent_tools_are_write_tier_because_poll_mutates pins the tier (verified failing against the old ReadOnly code: left ReadOnly, right Write).
  • README tool table and docs/threat-model.md (child agents section) state the tier.
  • Closes agents: agent_poll is declared Risk::ReadOnly but mutates meta.json and deletes mailbox memories #300

Testing

  • cargo fmt --all; cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace: all pass (incl. tole-cli agents integration test)
  • cargo check -p tole-cli --no-default-features --features shell-tools --tests: ok
  • cora review --staged: no issues found

🤖 Generated with Claude Code

A settled agent_poll forgets the uteke mailbox and persists
mailbox_consumed, so a ReadOnly tier bypassed the approval gate and plan
mode. Reclassify as Write, allowlist agent_poll by exact name in the
internal trust preset, pin the tier with a test, and update docs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit e0c424f into develop Oct 7, 2026
17 checks passed
@ajianaz
ajianaz deleted the fix/agent-poll-risk-tier branch October 9, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agents: agent_poll is declared Risk::ReadOnly but mutates meta.json and deletes mailbox memories

1 participant