Repository navigation
refactor(agents): use fixed tool-loop defaults directly - #130681
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 12:12 AM ET / 04:12 UTC. ClawSweeper reviewWhat this changesThe branch removes the obsolete private tool-loop configuration projection and uses the existing fixed thresholds and detector policy constants directly. Merge readinessKeep open for normal maintainer landing: the one-file refactor is behavior-preserving and has no actionable review finding, while exact-head CI is still in progress. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherTool-loop detection examines run-scoped agent tool-call history and returns warnings or blocking outcomes to the agent runner. This cleanup preserves the opt-in configuration boundary while simplifying the fixed internal policy used by admission and recovery. flowchart LR
A[Agent tool calls] --> B[Run-scoped history]
B --> C[Tool-loop detector]
D[Enabled setting] --> C
C --> E[Fixed warning and block thresholds]
E --> F[Admission or recovery outcome]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -64. Total -64 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain the direct-constant implementation and land it after exact-head CI completes successfully. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is a behavior-preserving refactor, and source inspection establishes that current configuration only controls enablement. Is this the best way to solve the issue? Yes. Direct use of the canonical fixed constants is the narrowest maintainable implementation now that the public tuning fields are retired and Doctor owns their cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 751e6c540f9a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…-retirement-v13 * origin/main: (243 commits) fix: preserve Gateway error reasons in text logs (#130645) refactor(video): deduplicate generation contracts (#130635) fix(agents): preserve direct-message sender identity (#124548) fix(agents): preserve silent reply after settled tools (#130675) fix(talk): preserve replacement speech when an old utterance is canceled (#130687) fix(browser): preserve literal names and formatter-owned snapshot refs (#130599) fix(auth): reset only the profile replaced by a successful login (#124014) fix: bind session creation to admitted Gateway (#130686) refactor(qa-lab): reuse model reference splitter (#130317) docs(gateway): clarify independent HTTP endpoint switches (#130690) fix(ui): Control UI smooth scrolling ignores the reduced-motion preference (#130428) refactor(lmstudio): remove unreachable catalog merge (#130689) fix(crabbox): restore cloud machine CPU and RAM (#130684) fix(secrets): compare proxy bearer tokens directly (#127054) fix(matrix): show recovery key availability in text status (#128051) fix(ios): restore approval settings navigation and remove duplicate shell state (#130651) refactor(agents): use fixed tool-loop defaults directly (#130681) refactor(qa-lab): share process tree metric reader (#130419) refactor(models): simplify prepared owner access (#130683) fix(parallels): main install and update smoke cannot complete (#130658) ...
Related: #111382
Additional instructions
Maintainer-owned branch; maintainer edits remain allowed.
What Problem This Solves
The tool-loop detector still rebuilt a private configuration object for thresholds and detector switches that are now fixed built-in defaults. That obsolete indirection duplicates the real policy constants and makes the current behavior harder to audit. This is a maintainer-requested cleanup, not a change to loop-detection policy.
Why This Change Was Made
Use the existing constants directly and remove the duplicate private config object, resolved type, resolver, and always-true detector conditions. Keep the exported argument positions/types, opt-in setting, thresholds, detector precedence, outcome matching, run scoping, warning text, and history trimming unchanged.
The public numeric/detector options retired in #111382 stay retired. Their doctor migration remains intact for upgrades; this PR only removes the runtime's constant projection. No dependency, schema, storage, API, import, or lazy-loading changes.
User Impact
No user-visible behavior change. Loop detection remains opt-in and uses exactly the same warning, critical, circuit-breaker, and history limits.
Evidence
@lit/contextwas unavailable in the local worktree. No E2E, standalone build, or live-provider result is claimed; this internal constant cleanup changes no build, package, import, or external API surface.Focused command:
AI-assisted with Codex; the owner, callers, retained upgrade contract, and proof limitations were manually inspected.
Exact-head hosted completion
Ordinary PR CI completed successfully on
d822f7a2f52c2aa368bbc4963de261730518fa84. Completed logs confirm Linux Node 24.19.0, the frozen lockfile, and Vitest 4.1.11: the owner passed 83 tests, admission passed 6, and runner recovery passed 1. Full production types, test types (all core shards, plugins, root tests and scripts), typed lint, build artifacts, and the required CI gate passed.A distinct independent published-head Codex review of the full patch and 24 complete context files also completed with no P0–P3 findings. The latest ClawSweeper review found no actionable defect; its remaining next step was exact-head CI and normal landing checks. CI is now successful and native preparation passed without changing the commit. Its focused replay also passed all 90 tests; the harness did not find a single
Test Files 3 passedline because the runner reports separate 2-file and 1-file shards, not because tests failed.The pre-existing volatile-delivery-ID documentation wording identified during review was independently corrected by #130261 while this PR was in flight. Post-merge inspection confirms that correction and the complete upstream nonce-hashing fix are preserved; no follow-up remains for that wording, and this cleanup takes no credit for the upstream repair.
Landing
Merged as b5ed58c2bc67504a0009e3b7e46826ff59949ca5 after native hosted-proof preparation and merge both completed successfully. The actual squash removes 64 net production lines and matches the reviewed cleanup after accounting only for shifted hunk coordinates and blob IDs. The temporary native review workspace was removed. Native cleanup reported a remote-branch deletion warning, so the source branch was retained; no force cleanup was attempted.