Skip to content

[Fix] Long tasks stop at 200 tool calls and cannot be resumed - #3684

Merged
mrubens merged 1 commit into
developfrom
fix/agent-safety-pass-caps
Nov 6, 2026
Merged

mrubens merged 1 commit into
developfrom
fix/agent-safety-pass-caps

Conversation

@mrubens

@mrubens mrubens commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Problem

The agent safety limits added in #3658 stop legitimate long tasks:

  • Every pass is capped at 200 completed tools and 100 model steps. A broad remediation task (read many files, patch, test) can reach 200 tool calls in about 20 minutes while using under 10% of its 1,000-request lifetime allowance, because models batch several tool calls per request.
  • A safety stop latches the task permanently. Replying "yes, resume" creates a resume run whose first provider request is refused. The harness then reports the refusal as task_request_limit, which is misleading.

Change

  • Remove the per-pass tool and step caps. Repetition detection, the 20-minute child-pass deadline, and the 1,000-request lifetime ceiling stay. pass_tool_limit and pass_step_limit remain accepted reasons, so older workers can still report them (N-1).
  • When a snapshot-resume run is created, release a pass-level stop inside the same transaction. The request counter is never reset. A task_request_limit stop, or a counter already at the ceiling, stays latched. Runaway spend therefore stays bounded per task, whatever resumes the task.
  • Key the parent-session stop notice per run (agent-safety:<task>:<run>). Otherwise a second stop after a resume would be silently dropped by the conflict guard.
  • Update the public docs (tasks.mdx) and the package notes (packages/db/agent-safety.md).

Validation

  • @roomote/types agent-safety tests
  • @roomote/db lib tests (899), including new release and ceiling tests against the real test DB
  • @roomote/cloud-agents enqueue-task tests (a resume releases the latch and keeps the count) and non-task-provider-usage tests
  • Worker subagent watchdog tests
  • pnpm check-types:fast, pnpm lint:fast

Remove the per-pass 200-tool and 100-step caps, which stopped legitimate
long tasks well under the lifetime request ceiling. Creating a resume run now
releases a pass-level safety stop in the run-creation transaction; the
request counter is never reset and a request-ceiling stop stays latched.
Parent-session stop notices are keyed per run so a later stop is not
dropped.
@roomote-community

roomote-community Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

No code issues found. See session

Reviewed the removal of pass-count caps, transactional release of resumable stops, preservation of the lifetime request ceiling, and per-run stop notices, including the surrounding resume and cancellation paths. CI lint, type checks, Knip, docs validation, upgrade compatibility, and worker build have passed; tests and the app build are still running.

Reviewed e23d534

@mrubens
mrubens merged commit 6598d38 into develop Nov 6, 2026
23 checks passed
@mrubens
mrubens deleted the fix/agent-safety-pass-caps branch November 6, 2026 19:02
@roomote-roomote roomote-roomote Bot mentioned this pull request Nov 6, 2026
6 of 9 tasks
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.

1 participant