Repository navigation
refactor(auto-reply): simplify runtime bookkeeping - #173452
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a56590b03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| void registeredBarrier.settled.then(() => | ||
| flushReplyOperationAfterClear(operation, registeredBarrier.source.sessionId), | ||
| flushReplyOperationAfterClear(operation, registeredBarrier.operation.sessionId), | ||
| ); |
There was a problem hiding this comment.
Preserve the successor session in after-clear callbacks
When a same-store successor starts from the predecessor session and rotates it during compaction while the predecessor's delivery barrier is pending, this flushes the predecessor's stale ID because registeredBarrier.operation remains the original operation. scheduleFollowupDrainAfterReplyOperationClear then cannot retarget queued runs to the successor session, so follow-ups can continue against obsolete conversation context; the unchanged cases in reply-run-registry.test.ts lines 408-430 explicitly expect rotated-session for same-store and storeless successors and will fail with this implementation. Preserve the authoritative same-lineage successor session rather than the original operation snapshot.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. What this changesThis PR simplifies reply admission, session-entry bookkeeping, background-event targeting, and aggregate cancellation. Example: An older source in a collected message batch is cancelled after adoption.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this maintainer-authored PR open: the simplification has an approved direction, but two session-admission regressions need repair. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe auto-reply runtime admits foreground and queued turns, binds them to session and database owners, and coordinates execution, cancellation, and delivery settlement. flowchart TD
A[Incoming messages and background events] --> B[Reply admission]
B --> C[Session and database owners]
C --> D[Reply operation registry]
D --> E[Agent execution]
E --> F[Delivery and settlement]
F --> G[Follow-up queue]
Technical reviewBest possible solution: Keep the simpler owners while preserving successor-session callbacks, unpinned storeless admission, and final-effect authority enforcement. Do we have a high-confidence way to reproduce the issue? The introduced source paths and exact-head hosted CI establish both listed regressions; this read-only review ran no target code. Is this the best way to solve the issue? The ownership simplification follows repository direction and records its tradeoffs, but ordinary session handoff behavior must survive the removal of secondary tracking. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4387e08f3acc. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Live effect assertions remain connected, but the changed retained-event authority boundary needs final-effect verification. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -635, Tests -437. Total -1072 across 18 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 15, 2026, 4:48 PM ET / 20:48 UTC. |
|
Merged via squash.
|
|
Verified the follow-up on main: bd18e16 restores the post-admission client-cancellation handoff while keeping original operator grant revocation independent. The complete The failure was premature client cancellation, not revived operator authority. I stood down the overlapping fixture repair after confirming the landed owner fix. The expectation updates carried by #166464 and #157806 should preserve the restored main contract when rebased: an older client cancellation stays ineffective after admission, while original grant revocation still cancels the turn and blocks effects. |
…estructure Merge main into the PR branch. openclaw#173452 moved the stale-config check from admission to assertEffectCurrent, which still rejects a deferred event at execution start, so the event is still dropped on main. Port the re-admission onto the new boundary, give each re-admission its own MessageSid so retained inbound dedupe of the adopted attempt does not drop it, and replace the old mocked-adoption cases with a real queue/dispatcher regression (session-event-config-readmission.test.ts).
* refactor(auto-reply): simplify runtime bookkeeping * fix(auto-reply): preserve captured compaction continuation
What Problem This Solves
Reply admission had accumulated a second ownership system around the actual session, database and delivery owners: transitive rotation histories, per-database barrier source maps, physical-file capture handoffs, and an in-memory generation-fenced compatibility proxy. These mechanisms mainly reconstructed transient interleavings; they were not the owners of security policy or durable writes.
Changes
Use an ordered walk over captured predecessor operations plus the authoritative session row for compaction continuation, including consecutive observed compactions. Keep ordinary settlement promises, but remove the lineage snapshots, source merging and alias-source updates around them. Let the existing session facts owner select the event destination rather than maintaining an additional physical-source capture protocol. Use one backing session-entry store instead of generation/timestamp arbitration and a Proxy. Combine aggregate source cancellation with AbortSignal.any rather than transferring controller/listener ownership at adoption.
Keep current tool/send policy at security effects, physical database admission, durable input and output, FIFO, ordinary shutdown settlement and the standalone session-memory backend unchanged. The finalization watchdog stays: human report #106112 documents repeated Slack production wedges. Human-backed stale drain recovery (#130810) and durable ingress dedupe recovery (#139341) also stay.
Production delta against base 164e243: 109 added, 732 deleted, 623 net lines removed. Test/support reductions are separate and remove only pins for the retired interleavings; normal compaction, wrong-store rejection, policy downgrade, cancellation, durable alias settlement and restart tests remain.
Best-effort tradeoffs accepted
Evidence
src/infra/sqlite-worker-store.test-support.ts|typescript/unbound-method|1entry introduced by fix: preserve session caches when database workers exit #173239. Both that file and the expected allowlist are unchanged from the base; no suppression or allowlist entry was added here.Exact-head hosted CI run 38806369139 is GREEN for repaired head 310724c, including openclaw/ci-gate. No inherited-red exception is used. Local load-only delays are not product failures. No timeouts, retries, skips, suppressions, schemas, dependencies, config keys or public protocol shapes were added or weakened.
First-head CI attribution
Run 38801516200 on 7a56590 completed with six failing test jobs.
checks-node-changed-compact-small-7exposed storeless successor selection;checks-node-changed-compact-large-20exposed the observed consecutive-compaction chain. Both are repaired in production, with their tests unchanged.small-20,large-4,small-22, andlarge-12exposed the retired store-rebind observation, cross-operation callback lineage, reader-error rewrapping and held recovery-claim observation pins described above; only those pins were retired or updated, preserving refusal/no-write, physical authority and settlement coverage.openclaw/ci-gatereported these failures; none is classified inherited. The separate PR-context failure required authored section headings, now corrected. No CI job was rerun.