Repository navigation
[Refactor] Unify agent safety pass lifecycle ownership - #3659
Open
roomote-roomote[bot] wants to merge 1 commit into
Open
roomote-roomote[bot] wants to merge 1 commit into
roomote-roomote[bot] wants to merge 1 commit into
Conversation
Contributor
|
No code issues found. See session Reviewed 9e11006 |
roomote-roomote
Bot
requested review from
brunobergher,
daniel-lxs and
mrubens
as code owners
November 4, 2026 02:30
5 of 8 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
Maintenance follow-up to #3658, which added finite agent execution safety limits. No separate issue.
Why this PR exists
The worker harness and control-plane prompt runner independently owned pass maps, deadline sweeps, event counting, stop latches and settlement cleanup. Consolidating that lifecycle makes policy differences explicit and avoids maintaining the same safety orchestration twice.
What changed
AgentSafetyLifecyclealongside the existing per-pass counter. It owns pass creation, normalized tool/message counting, deadlines (including pending child spawns), settlement tombstones, one-shot stop claims and disposal.There is no intended user-facing behavior change. This reduces independent lifecycle ownership without changing durable request admission, safety notice text or error classification.
How it was tested
293 focused tests passed:
@roomote/types: safety counter and new lifecycle suites — 14 tests covering deduplication, sibling and pending-spawn deadlines, root policies, late events, explicit/native resumption, one-shot stops and disposal.@roomote/worker: subagent watchdog suite — 59 tests, including new cancellation/disposal deadline cleanup and fresh safety accounting for a resumed child.@roomote/worker: harness and stall-watchdog suites — 96 tests.@roomote/cloud-agents: non-task provider usage suite — 124 tests, including replayed completions, resumed child sessions and failed persistence/abort adapters.Affected package typechecks and the normal pre-push gates (oxlint, worker/web ESLint, repository-wide fast typechecks and knip) passed. Changed files were formatted by the commit hook. The formatting-inclusive
pnpm lint/pnpm check-typescommands were not run separately. Browser proof is not applicable to this in-memory lifecycle refactor.Checklist
[Fix],[Feat],[Improve],[Refactor],[Docs], or[Chore]followed by a user-facing descriptionpnpm lintandpnpm check-typespass locallypnpm changesetNo changeset: internal behavior-preserving refactor.