Repository navigation
refactor(acp): simplify pending operation accounting - #139189
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 11:44 AM ET / 15:44 UTC. ClawSweeper reviewWhat this changesThe ACP session manager replaces per-session pending-operation counts with one total counter and adds assertions that preserve existing diagnostic behavior. Merge readiness✅ Ready for maintainer review Keep open as a useful, distinct cleanup. No introduced correctness or security defects were found, and current main still contains the bookkeeping this PR simplifies. Priority: P3 Review scores
Verification
How this fits togetherThe ACP session manager coordinates operations for external coding agents, serializing work within each session while allowing different sessions to proceed independently. Its pending-operation total feeds flowchart TD
A[Session operations] --> C[Per-session queue]
B[Shutdown cleanup] --> C
C --> D[Running and waiting total]
C --> E[Execute operation]
E --> F[Success or rejection]
F --> D
D --> G[ACP doctor diagnostics]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -10, Tests +4. Total -6 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep aggregate accounting at the ACP queue owner while preserving the shared scheduler, cancellation timing, and diagnostic interface. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR claims a behavior-preserving refactor, not a broken existing workflow; source and assertions support that premise. Is this the best way to solve the issue? Yes. Only the aggregate count is consumed, so a scalar removes unnecessary state; adding accounting to the shared SDK queue would broaden the change without serving another caller. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 952105ddd981. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Final verification of All 53 existing manager/lifecycle/queue tests passed before and after, with four added assertions at the running, queued, aborted-caller and drained boundaries. Full changed checks, P2 review, independent peer and separate committed-head review are clean. The completed ClawSweeper review has no before-merge items or rank-up work. This keeps accounting at the existing enqueue/settlement owner and removes 10 production lines, without changing scheduler, cancellation, shutdown or diagnostic contracts. Native stamped review validation passed; proceeding through prepare/merge. |
|
Merged via squash.
|
* origin/main: (46 commits) fix(gateway): keep chat metadata responsive across auth refresh (openclaw#139192) fix(doctor): keep Workshop relocation lint read-only (openclaw#139193) perf(ui): retain unchanged forwarded avatar publications (openclaw#139181) fix(config): guide exec policy migration repairs (openclaw#139143) test(i18n): refresh representative Watch key (openclaw#139197) fix(agents): preserve recovered scheduled-run outcomes (openclaw#139037) refactor(acp): simplify pending operation accounting (openclaw#139189) fix(plugin-sdk): harden account scope for pairing requests and challenges (openclaw#139142) perf(gateway): avoid redundant PR landing ancestry checks (openclaw#139186) perf(ui): release captured audio cache leases directly (openclaw#139174) fix(skills): validate names in library forms (openclaw#139184) fix(sessions): reduce cold catalog listing delays (openclaw#139146) perf(cron): scan preserved action output once (openclaw#139163) fix(agents): keep fresh tool results readable under context pressure (openclaw#139165) fix(compaction): heartbeat sessions ignore the active transcript byte cap (openclaw#136533) perf(agents): reuse snapshotted web search result rows (openclaw#139162) fix(onboarding): keep Tauri setup recoverable and verify model results (openclaw#139140) fix(memory): rank indexed sessions by source activity (openclaw#139112) perf(terminal): avoid rebuilding sanitized link fallbacks (openclaw#139159) perf(agents): bound retained tool result projection data (openclaw#139157) ...
Additional instructions
Keep Allow edits from maintainers enabled for this PR.
What Problem This Solves
Simplifies maintenance of ACP queue diagnostics by removing obsolete per-session bookkeeping whose only remaining consumer reads the total. This is a maintainer-requested internal cleanup.
Why This Change Was Made
Replace the count map with one counter updated by the existing enqueue and settle hooks, preserving the shared queue and async wrapper. Remove the redundant file-header narration and add four assertions to existing manager tests to verify the observable count.
Production: +4/-14, net -10 lines. Tests: +4 lines, with no new test cases or fixtures.
User Impact
No user-visible behavior change.
/acp doctorcontinues to count all running and waiting actor operations. An aborted queued call remains counted until its internal callback settles, and shutdown handle cleanup uses the same counted queue.Evidence
The same 53 focused tests passed on the original map implementation and the scalar implementation, with the four new assertions present in both runs. They cover manager behavior (27), runtime-handle lifecycle (20), and shared queue behavior (6):
The added assertions observe a held running turn, a queued successor, complete drain, and a queued caller that has rejected on abort while its predecessor still owns the actor. Existing tests retain coverage for independent-session concurrency, timeout/rejection cleanup, and shutdown cancellation before handle close.
Full changed-file validation passed on the frozen candidate before commit, including core and test typechecks, lint, all unused-export scans, and structural guards:
Targeted formatting and whitespace checks passed. Required Codex autoreview through P2, an independent peer review, and a fresh direct review of committed head f18d79a found no actionable issues. The source remained unchanged through verification.
CI 33975370642 passed on the exact head. Its actual tested merge has main
952105ddd981e3339775621a4e5c3dfedde5c9daand headf18d79a4884964b4539edb5a11f66b43e1c8db00as parents. ClawSweeper found no before-merge items.