Repository navigation
fix(sessions): release invitation callbacks after completed writes - #201685
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. What this changesMoves the session-write fulfillment handler to module scope so it cannot capture a completed turn’s local state. Example: A completed session write prepared an invitation for bob.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR provides a focused callback-lifetime repair that current main still lacks; no introduced correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe session-turn owner accepts transcript messages and preparation callbacks, coordinates worker commits and completion cleanup, and returns the committed result or error. flowchart TD
A[Transcript write request] --> B[Session turn owner]
B --> C[Worker preparation and commit]
C --> D[Shared fulfillment handler]
D --> E[Completion and authority cleanup]
E --> F[Result or error]
Technical reviewBest possible solution: Retain the module-level fulfillment handler and unchanged cleanup semantics, then finish the existing merge-context qualification. Do we have a high-confidence way to reproduce the issue? No current-main execution was performed; hosted calibration records old-runtime success and candidate-runtime failure, followed by success with the exact source-only repair and unchanged regression. Is this the best way to solve the issue? This is the smallest complete repair: move the state-independent success mapper outside the turn’s lexical scope while preserving the existing persistence and settlement owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 56330996bd3e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2. Total +2 across 1 file. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 November 19, 2026, 2:21 AM ET / 07:21 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
What Problem This Solves
Completed session writes can keep invitation-preparation callbacks and their captured input alive under the pinned Bun runtime, even after their admissions close. This blocks the callback-release regression in the Bun pin update.
Related: #199959
User Impact
Completed writes can release their captured input without changing persisted messages, admission cleanup, or error handling. No configuration or migration is required.
Why This Change Was Made
The success handler does not use turn-local state, but its function scope retains that state. Move only this handler to module scope; keep the same result object and inline rejection handler. The native line-cap check passes without increasing counted lines.
Evidence
The original eight-case invitation test passes with the source-only change on the new published Bun. The hosted gate also verifies all eight case identities, native completion, unchanged test bytes, restored source/pin, and clean tracked source: https://github.com/openclaw/bun/actions/runs/44473306447. The original 309-file group also passes: 305 files passed, four skipped; 3,274 tests passed, 34 skipped, zero failures. All eight invitation cases pass in that full context. Both commands exited zero, completed their single planned native invocation, and restored source and pin with tracked source clean.
The preceding calibrated diagnostic preserved old-Bun eight-pass/new-Bun seven-pass-and-one-commit-failure behavior. A separate identity capture matched the surviving success handler to the recorded Function: https://github.com/openclaw/bun/actions/runs/44470952342 and https://github.com/openclaw/bun/actions/runs/44472006339. This identifies the callback; it does not prove a GC-scanned root or an engine cause.
The production file and original test are byte-identical on the frozen diagnostic base and this PR base before the change. The proof changes only the production handler, with no observer, debugger, extra GC, or weakened assertions.
Local formatting, native commit hooks and the line-cap ratchet pass. Independent source review found no code blocker. Full local ClawSweeper review of
cf9a9839e03ba76b526d9f61fe453e3ccc8a93a9..a42a5839ae48524c819b81b99f0f0e7ad31501dcfound no correctness or security defect; its offline review did not inspect linked runtime artifacts. Full Gateway memory measurement is not claimed.Exact-head CI completed: all six selected Node test jobs, the build, baseline ratchets, PostgreSQL shards and
security-fastpass in https://github.com/openclaw/openclaw/actions/runs/44474066080. Two UI jobs failed:ui/src/e2e/route-asset-requests.e2e.test.ts:120; the same case and assertion fail on scheduled main in https://github.com/openclaw/openclaw/actions/runs/44473223458/job/135388112109.manual-in-panel: 120-second timeout atui/src/e2e/required-human-action.real-gateway.e2e.test.ts:274; the same case and timeout fail on earlier scheduled main in https://github.com/openclaw/openclaw/actions/runs/44369795594/job/135034001765. This was already documented by test(ui): diagnose required human action timeouts #201386. The current diagnostic stops after the manual page closes, before answer submission; it does not identify which UI interaction stalled.These are baseline attributions, not a green CI claim. The PR changes only the session-write fulfillment mapper.
The focused and full Bun proofs, targeted checks, and exact-head build pass. Normal PR merge-context CI completed in https://github.com/openclaw/openclaw/actions/runs/44477106190: 35 successful jobs, 27 skipped, and two failures plus the aggregate CI gate. All five PostgreSQL checks, including PostgreSQL 16 smoke, passed. The failures are the same plugins asset-request assertion described above and
checks-node-changed-1environment setup: Ubuntu package-mirror connections failed, then the existing 120-second timeout exited 124 before any tests ran. This head already passed that Node shard in the preceding exact-head run. The tested merge contains only this production-file change over its main parent; the UI and setup inputs are unchanged. Native landing will retain these failures and their attribution, not label CI green. This checkout has no qualified local dependency install; runtime proof runs in isolated hosted jobs. No RSS, latency, or complete Bun-pin qualification claim is made.