Skip to content

fix: restore Inbox delivery for committed human mentions - #178297

Merged
shakkernerd merged 2 commits into
mainfrom
mention-postcommit
Oct 20, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
mention-postcommit

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes human mentions that are successfully posted to a conversation but never reach the eligible recipient's Inbox. This affects ordinary administrator-to-administrator messages as well as paths used by restricted senders: transcript persistence succeeds, while the separate mention effect fails during its session read.

Fixes #178264.

User Impact

Eligible recipients receive one Inbox entry for a committed mention. Retrying the same input does not create another notification. The original message remains governed by its existing commit guard, and the Inbox continues to apply current recipient access, session identity, duplicate suppression, and shutdown rules.

This restores the existing mention contract without changing permissions, membership, schema, configuration, or retention. Existing missing notifications are not backfilled from transcript history.

Why This Change Was Made

The transcript recorder publishes its committed state before invoking the original-input callback. That correctly ends the original writer's input custody. The Inbox queue previously inherited that writer's async context, so its later sharing read could borrow the completed writer and reject the stale input authority.

The existing Inbox queue now enters the maintained detached async context before tracking accepted work in its own scope. It retains FIFO ordering, drains accepted work on disposal, and acquires current authority through the existing mention owners. The transcript guard itself is unchanged.

Evidence

A regression uses an isolated Gateway, two authenticated administrator clients, and the existing local Responses-provider fixture. On unchanged main, selected mentions commit and the agent replies normally, but the recipient Inbox stays empty. The diagnostic traces the failure to the obsolete input custody guard during the separate sharing read. The regression checks the correct recipient and excerpt, a committed message sequence, and idempotent replay without another entry.

Changed-file formatting/lint and affected production/test type checks pass. Existing caller and Inbox tests pass for queued delivery, recipient revocation, duplicate suppression, scheduler cancellation, and accepted-work settlement. The separate source-custody suite passes all 13 controls; the original commit guard was not changed.

The Inbox owner suite also pauses a new entry immediately before the real worker commit, revokes the recipient through the profile writer, then resumes that commit. It confirms no durable entry or push is produced and the current Inbox read is forbidden. Its existing foreign-profile controls verify that another profile cannot list or dismiss the intended recipient's entry, including rejection of an explicit foreign profileId. All 31 cases pass; the new revocation case takes 1.170 seconds, and the full owner file reports 83.29 seconds in Vitest / 114.54 seconds in the native runner including preparation.

pnpm test src/gateway/server.mentions-committed.test.ts --maxWorkers=1 passes on the repair and fails with an empty Inbox on baseline 5bd24d8a8eb354fad8c3fecb29affff0628c7aae. The passing test takes 16.743 seconds; Vitest reports 44.66 seconds including cold transformation, and the native test runner reports 47.22 seconds. This real Gateway boundary is necessary to exercise authenticated input-writer custody; a bare recorder does not reproduce that lifecycle. The current CI run used 7,617 aggregate job seconds, with 33 jobs passing and 28 outside the selected scope; its production-type failure reproduces with the identical 809 DOM/JSX diagnostics on main revision 37e60afc6d2ffb3dab5dee16a52f2aae2554d4ab without this patch. The separate graph repair landed in #178306. Production core types pass on the prospective merge result ff9534db8b0adc483d31d819fdbd87ca2a08ff5d.

Independent engineering review is clean on 7e8347a. Actual browser proof on a composed native runtime confirms automatic delivery in both guest-to-administrator and administrator-to-eligible-guest directions. Each uses one new send, observes arrival before any diagnostic Inbox read, retains the item after Open and a real reconnect, and removes it through its own Dismiss control. The production Inbox file is byte-identical to this PR; the isolated two-administrator regression remains separate source proof. ClawSweeper reviewed 7e8347a at Platinum with no findings. Final target 7ad64520b5a2e13f1512d353b49c38bc616f3054 still fails the real Gateway regression with an empty Inbox. The exact prospective merge result passes that regression and all 31 Inbox and 13 original-custody controls. This refresh covers upstream input-staging and session-reader changes; existing unaffected proof remains applicable.

Visual evidence

Open preview

Before After
Accepted mention leaves the recipient Inbox empty One mention arrives automatically in the recipient Inbox; personal sender label masked

Recipient camera: automatic arrival, open, reconnect and dismissal

recipient.mp4

Visual verification

  • Baseline: d1f7a596145000e56b1d9834526368d39d0310de (preserved failed accepted send)
  • Exact head: 617f152e8112ae21211e84f3461d74efdff218b4
  • Scenario: Select the administrator, send one new synthetic mention from an eligible guest, and observe automatic Inbox arrival; open, reconnect and dismiss the same item.
  • Runtime/build: Combined native LAB tree61d29b1f65c1f03bc510a1248e20e699feef75cf; Inbox production bytes match PR head7e8347a. This is composed-runtime proof, separate from the isolated PR-head two-administrator regression.
  • New UI sends per direction: 1
  • Diagnostic Inbox reads before visible arrival: 0
  • Correlated entries after reconnect: 1
  • Entry after its own dismissal: 0
  • Guest-to-administrator and administrator-to-eligible-guest flows passed on the composed runtime.
  • Before is the genuine failed accepted send; after uses a deliberately new message. Original send was not replayed.
  • Sender and recipient clips have separate local timelines, with no synchronization claim.
  • Opaque intervals hide private pages while the Inbox is closed; elapsed frames remain. Reconnect is independently verified by the new Gateway handshake.
  • Source and composed runtime identity, original build stamps, message correlation and current authority controls are recorded separately.

Sender camera: selected mention and one send

guest-to-admin-sender-single-send.mp4

The two camera clips have separate local timelines. Personal labels and private pages are masked; no frames within either selected interval were removed.

@clawsweeper

clawsweeper Bot commented Oct 20, 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M labels Oct 20, 2026
@shakkernerd shakkernerd self-assigned this Oct 20, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR runs queued Inbox operations outside the completed transcript writer’s async context.

Example: Alice sends “@bob Please review.” with Bob selected as a mention recipient.

  • Before: The message commits, but Bob’s Inbox remains empty because sharing preparation inherits expired input custody.
  • After: Bob receives one eligible Inbox entry, and replaying the same request creates no duplicate.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A minimal, useful repair with no actionable findings, supported by inspected UI evidence and reported production-boundary authority controls.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): The updated evidence resolves the prior authority request: the inspected production-path control revokes the recipient before the real worker commit and checks durable rejection and no notification, while existing controls cover foreign-profile reads and dismissal. Downloaded screenshots show the changed Inbox outcome, and the body separately reports authenticated Gateway baseline failure, repaired delivery, and idempotent replay alongside composed-runtime browser delivery. Video playback could not be assessed in this environment.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A successfully posted human mention can leave an eligible recipient unaware because their Inbox receives no entry.
Reason: The maintainer-authored repair restores the existing mention contract without adding permissions, configuration, persistence formats, or a competing owner.

Merge readiness

✅ Ready for maintainer review

This PR provides a focused repair for missing committed-mention notifications, and the updated authority controls resolve the previous review’s concerns; no introduced defect was found.

Priority: P2
Reviewed head: 7e8347a3373ba3652a04b63c4d04f13e858e2eba

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway’s transcript commit callback submits selected human mentions to the Inbox queue, which checks current session and recipient authority before persistence and notification.

flowchart LR
A[Authenticated chat send] --> B[Transcript commit]
B --> C[Detached Inbox queue]
C --> D[Current recipient and session policy]
D --> E[Worker commit admission]
E --> F[Durable Inbox entry]
F --> G[Authorized views and notifications]
Loading

Technical review

Best possible solution:

Keep the existing Inbox owner and detach its accepted queue work while preserving current commit and disclosure checks.

Do we have a high-confidence way to reproduce the issue?

Current source preserves the completed-writer context into the Inbox sharing read, and the supplied authenticated Gateway regression reportedly fails on baseline with an empty Inbox; this review executed no target code.

Is this the best way to solve the issue?

This is the smallest complete repair: reuse the maintained detached-context helper at the existing queue owner rather than weaken transcript custody or duplicate recipient policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7ad64520b5a2.

Provenance checked

  • Inbox FIFO, accepted-work settlement, and current authorization keeps the original intent (b534aa9: Move persistence to workers while retaining physical-store identity, current authorization, FIFO ordering, and settlement of accepted work during shutdown.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Minimal production repair: The introduced production diff wraps the existing accepted-work scope and FIFO continuation in runInDetachedAsyncContext; it retains database admission, ordering, error settlement, and disposal ownership. (src/gateway/mention-inbox.ts:114, 7e8347a3373b)
  • Revocation reaches the real commit boundary: The added control pauses before calling the real commit function, revokes Bob through the profile writer, then verifies no durable source, no notification callback, and forbidden Inbox access; the body reports this control passing. (src/gateway/mention-inbox.test.ts:207, 7e8347a3373b)
  • Final authority remains enforced: The worker admission invokes assertCurrent before granting the mutation; the Inbox guard checks current profile, access, session, and configuration revisions before persistence. (src/gateway/mention-inbox-worker.ts:49, 7e8347a3373b)
  • Foreign-profile exclusion: Existing owner controls exercise empty results for Alice and Carol, reject Alice’s attempt to dismiss Bob’s entry, and reject an explicit foreign profileId selector; the updated body reports the owner suite passing. (src/gateway/mention-inbox.test.ts:521, 7e8347a3373b)
  • Behavioral evidence and inspection limits: Inspected downloaded before/after screenshots show an empty Inbox followed by one mention entry. The body distinguishes composed-runtime browser delivery from the isolated authenticated Gateway regression and reports baseline failure plus repaired delivery and replay. Video inspection was unavailable: the manifest reports “ffprobe failed: spawnSync ffprobe ENOENT”, and browser fetching returned “Cache miss”; no video coverage is claimed. (src/gateway/server.mentions-committed.test.ts:26, 7e8347a3373b)
  • Current main still needs the repair: Fetched main retains the inherited-context enqueue implementation, matching the failure described in Human mentions can commit without reaching the recipient Inbox #178264. (src/gateway/mention-inbox.ts:108, 7ad64520b5a2)

Likely related people:

  • Peter Steinberger: Raw commit b534aa9 adds src/gateway/mention-inbox.ts:93 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b534aa9c2a2f; files: src/gateway/mention-inbox.ts)

PR surface

Source +4, Tests +226. Total +230 across 3 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 9 5 +4
Tests 2 226 0 +226
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 235 5 +230

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +9/-5; tests +226/-0 The small queue repair is supported by distinct authenticated commit-custody and pending-recipient-revocation regressions, without new production test seams.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster. Replaced prior rating: 🧂 unranked krab.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Selected human mentions can silently miss their eligible recipient’s Inbox while the original message remains stored.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster. Replaced prior rating: 🧂 unranked krab.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-20T09:16:08.826Z sha 34d5a17 :: needs real behavior proof before merge. :: none

Reviewed October 20, 2026, 6:08 AM ET / 10:08 UTC (Revision 2).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The current head adds the pending-commit recipient-revocation control. The PR body now includes the passing authority checks and inspected live delivery media, with the composed runtime distinguished from isolated source proof.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 20, 2026
@shakkernerd
shakkernerd merged commit 3e517e9 into main Oct 20, 2026
139 of 142 checks passed
@shakkernerd
shakkernerd deleted the mention-postcommit branch October 20, 2026 10:20
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: committed human mentions now reach the eligible recipient’s Inbox exactly once.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
…8297)

Restore Inbox delivery for committed human mentions while preserving current recipient authorization, idempotency, and accepted-work settlement.

Fixes openclaw#178264.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Human mentions can commit without reaching the recipient Inbox

1 participant