Repository navigation
fix(exec): acknowledge polled completions - #138188
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 7:51 AM ET / 11:51 UTC. ClawSweeper reviewWhat this changesThis PR defers acknowledgement of completed background exec notices until Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review The prior P1 is addressed: both polling paths now retain the exact completion notice until their real delivery owner succeeds. This active maintainer PR remains necessary because current main still acknowledges before construction/delivery, while exact-head checks are in progress. Priority: P1 Review scores
Verification
How this fits togetherBackground exec jobs place completion notices in a session queue. Chat polling and agent process polling consume the matching notice only after their final reply is delivered or durably recorded, so failed delivery leaves it recoverable. flowchart LR
A[Background exec job] --> B[Completion notice queue]
B --> C[Chat poll or process poll]
C --> D[Final reply delivery or transcript persistence]
D -->|success| E[Acknowledge exact notice]
D -->|failure or suppression| F[Retain notice]
E --> G[Unrelated notices remain queued]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -32, Tests +346, Docs 0, Other 0. Total +314 across 24 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the exact receipt owned by the process record and acknowledge it only from confirmed chat delivery or durable tool-result persistence, as this revision does. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main calls acknowledgement before constructing the finished poll result, while the revised owner paths defer it until delivery or persistence succeeds. Is this the best way to solve the issue? Yes: acknowledgement belongs at the final delivery or persistence boundary, which preserves retryability without widening configuration or adding a parallel delivery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 79930b846762. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
3b0285a to
6a2f15d
Compare
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Acknowledging only after final delivery or transcript persistence is the correct boundary. Keeping the exact removal handle also preserves unrelated completion receipts. Looks sound.
Terminal !poll now consumes the exact process-owned completion receipt, matching process.poll while preserving other pending occurrences. Consolidate captured event routing and heartbeat settlement without changing cadence, readiness retries, suppressed-send retention, or persisted state. Keep the shipped coding-tool SDK declarations accepted and document the acknowledgment behavior. Production code shrinks by 49 lines. Related: #135933
6a2f15d to
c56d468
Compare
|
Merged via squash.
|
* fix(exec): acknowledge polled completions Terminal !poll now consumes the exact process-owned completion receipt, matching process.poll while preserving other pending occurrences. Consolidate captured event routing and heartbeat settlement without changing cadence, readiness retries, suppressed-send retention, or persisted state. Keep the shipped coding-tool SDK declarations accepted and document the acknowledgment behavior. Production code shrinks by 49 lines. Related: openclaw#135933 * fix(exec): settle poll acknowledgements after delivery * test(exec): acknowledge persisted poll results in fixtures
Terminal
!pollandprocess.pollmust acknowledge a completion only after their result has reached its owner. The chat command originally left the occurrence queued; its first repair removed it too early, before final delivery. The process tool had the same early-acknowledgement defect before transcript persistence. A cancelled send, transport error or failed append could therefore discard the pending notification.This revision acknowledges the exact captured process receipt after successful final delivery or tool-result persistence. Cancellation, deferred finalization failure, untracked custom dispatchers and failed transcript appends retain it. Late notifications use the same acknowledgement owner, repeated polling remains harmless, and unrelated completions survive. It also removes redundant process routing fields and duplicate heartbeat settlement branches, retaining the shipped SDK option declarations.
Related: #135933. This is a prerequisite cleanup; full exec admission and heartbeat retirement remain separate.
Scope and risk
No database schema, migration, stored representation, configuration/default, or Gateway protocol change. Existing completion routing, cadence, retry, suppression and recovery policies are preserved. Private payload metadata carries the delivery acknowledgement; no callback is serialized on the wire.
Production +116/−148 = −32 lines. Tests +383/−23 = +360. Documentation is net zero.
Validation
The fresh ClawSweeper P1 is accepted and addressed by the delivery/persistence ownership repair above. Its requested failure-path proof now passes on the corrected production sources. The earlier direct-handler evidence is not substituted for this delivery proof.
Previous-head CI completed with 132 passed and 43 skipped. Its only failures were four npm advisory-service timeouts and the dependent aggregate. The existing maintainer waiver covers that availability failure only; it does not waive source findings or final-head validation.
Follow-up: QA reference resolution can find generated files in ancestor checkouts and hide a missing current-checkout reference. The earlier 58-case catalog red/green proof used an isolated checkout; repository-bound reference resolution remains separate work.
Final CI follow-through: four direct-poll fixtures now invoke the existing persisted-result acknowledgement and first assert that pending receipts survive until that point (38 tests passed, owning types/lint and independent review clean). Two inherited Code Mode/process-lifecycle fixture failures were independently reproduced and repaired during this work. Concurrent PR #138238 landed fixes at those same boundaries; their source and sibling coverage were inspected, and our duplicate test changes were dropped during rebase. The final PR retains main's fixes. All 14 live-pinned production files remain byte-identical. Final-head CI passed.
Final-head CI first attempt: 130 checks passed and 43 skipped. The only failure was an unchanged Doctor process case timing out at its 60-second child deadline, plus the dependent aggregate. The same case passed in the other PR's Linux run in 41.968 seconds, and all three subprocesses converged on the unchanged exact CI-parent baseline locally. The single failed-job rerun passed, and CI33871590210 completed successfully on attempt 2. No source, timeout, or assertion was changed.