Skip to content

fix(sessions): release invitation callbacks after completed writes - #201685

Merged
vincentkoc merged 1 commit into
mainfrom
fix/session-turn-outcome-lifetime-20261119
Nov 19, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/session-turn-outcome-lifetime-20261119

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

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 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-1 environment 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.

@vincentkoc vincentkoc self-assigned this Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 19, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 19, 2026 07:06
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Moves 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.

  • Before: The candidate Bun runtime’s existing regression retained the callback’s captured sentinel after successful commit.
  • After: The same regression passes with the shared fulfillment handler and unchanged assertions.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and appears correct; validation exercises the real persistence owner through an existing harness rather than a shipped application entry point.
Proof confidence 🦐 gold shrimp (3/6) This internal handler refactor adds no user-visible flow requiring shipped-entry-point proof; its hosted production-owner regression supports callback release without establishing whole-Gateway memory savings.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Completed writes can retain invitation callbacks and captured input under the candidate Bun runtime.
Reason: The maintainer-authored direction is supported by an existing lifetime regression, and the narrow extraction adds no configuration, public API, or persistence change.

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
Reviewed head: a42a5839ae48524c819b81b99f0f0e7ad31501dc

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Session-turn outcome mapping and cleanup keeps the original intent (ca77256: Worker execution needed to capture success or failure while preserving postcommit settlement and cleanup before returning.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit baca36e adds src/config/sessions/session-mention-invitation.test.ts:201 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: baca36ea403c; files: src/config/sessions/session-mention-invitation.test.ts)

PR surface

Source +2. Total +2 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 6 4 +2
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 6 4 +2

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: The repair addresses demonstrated callback retention during supported-runtime qualification, with no established user outage or measured Gateway memory impact.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The repair addresses demonstrated callback retention during supported-runtime qualification, with no established user outage or measured Gateway memory impact.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 19, 2026, 2:21 AM ET / 07:21 UTC.

@vincentkoc
vincentkoc merged commit 8db39f3 into main Nov 19, 2026
299 of 307 checks passed
@vincentkoc
vincentkoc deleted the fix/session-turn-outcome-lifetime-20261119 branch November 19, 2026 07:32
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant