Skip to content

fix: show queued chat input during reply initialization - #196153

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-queued-followup-visibility-reply-init-20260919
Nov 9, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-queued-followup-visibility-reply-init-20260919

Conversation

@steipete

@steipete steipete commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Related: #195754

What Problem This Solves

Fixes an accepted chat message waiting silently behind an active turn when admission blocks during reply initialization, including command-bearing follow-ups such as /verbose on Explain the queued request.

User Impact

The existing Queued indicator appears while the message waits and is restored after reconnect. The follow-up starts after the active turn completes, fails, or is cancelled. Slow-send diagnostics classify the admission wait as queued.

Why This Change Was Made

Command-bearing input skips ingress staging and can wait in the mailbox before reply preparation. The pending-input projection previously recognized only prepared follow-ups. Stage custody before that wait, publish the existing queued lifecycle event from the mailbox owner, and project its existing waiting phase. This uses the existing queue UI and reconnect contract without another notice implementation, cache, config option, or schema change.

Production delta is +21 lines: missing custody staging, owner publication, and timing attribution. Regression coverage adds 123 lines with an exact test-line allocation; benchmark tooling adds 45 net lines. The author simplification pass retained one queue owner and replaced the narrower projection predicate.

Evidence

  • Baseline regression fails because the pending-input page is empty; the real built Gateway independently reproduces no queued row before or after WebSocket reconnect, with stage=startup and a ~3.2-second mailbox wait.
  • Full-scale synthetic Gateway: baseline has no queued state in 18/18 sends; candidate shows it in 12/12 and preserves identity through reconnect. All 30 successors complete. Diagnostics change from 18/18 startup to 12/12 queued. Warm queued visibility medians: 50.8–55.7 ms.
  • Gateway regression file: 7/7 pass, 48.77 seconds wall time. Three cases exercise real dispatch, pending-input persistence, history/reconnect reads, and visible start after active completion/failure/cancellation. This requires the Gateway/SQLite boundary; helper-only tests missed the defect.
  • Existing Control UI queue browser tests: 8/8 pass. UI E2E custody/outbox tests: 4/4 pass, including reconnect and consumption/cancellation.
  • Codex autoreview: scoped clean, no actionable P0–P2 findings.
  • Focused sibling suites: 125/125 pass across mailbox ordering, pending-input reads, diagnostics, prestart steering, and dispatch lifecycle. pnpm check:changed --base 25bb300ac765 --timed completed. Patch-caused test type/style findings were repaired and their focused checks pass. Remaining failures reproduce on exact parent 25bb300ac765: historical changelog attribution and unused exports in daemon/provider/dashboard owners. Causal introductions: changelog fix(release): align attribution gate with human credit policy #194364, provider exports refactor(plugins): forward auth and catalog to their owners #190205, daemon scanner fix(cli): surface stale-updater launchd scan failures in deep status #195977, dashboard export Dashboards gallery: Display menu with list view, ordering and grouping #194455. Exact-base replay plus controlled import restoration establishes these as recorded main regressions.

Full fixture: 35.20 GiB SQLite data/indexes, 5,000 sessions, 62,000 files/1.14 GB, synthetic only. APFS on macOS; this does not establish btrfs latency parity. Serial timing arms A1/A2/B1/A3/B2 use six fresh-session pairs each, a fixed 3-second model hold and identical 1-second history polling windows. Settled A3/B2 warm reply initialization is 3,059→3,059 ms and mailbox wait 3,043→3,031 ms. Whole-process CPU is 15.080→15.326 s (+1.6%); main-thread CPU 4.329→4.394 s; follow-up median 3,218.0→3,229.3 ms. Early unchanged A/A CPU varies 43.806→27.054 s, so there is no CPU speedup claim.

Separate main-isolate allocation ABAB samples are 1,645,207,232 / 1,635,663,968 / 1,521,763,568 / 1,628,766,792 bytes: candidate mean +3.1%, baseline A/A variation −7.5%. These are whole-flow samples, not exact owner allocation costs. One instrumented cold sample misses the first 1-second polling window but has queued custody after reconnect while still held. One uninstrumented cold candidate takes 4,881 ms versus baseline 3,936 ms; owner spans locate the extra time in existing memory preparation, while reply initialization stays 3,222 versus 3,218 ms. Matching fixture background embeddings/temp-root warnings and shared-host variability limit CPU/allocation interpretation.

CI run 42664885443 attempt 1 has one root failure: the restart-resume E2E expects admission invalidation although #195902 deliberately allows accepted finalizers to read shared state until owner drain. The same assertion reproduces on exact CI main parent 6edcaa28edb7817efda38eccc4f0c7fd13ad148c; introducing commit cd48b392e86fd58975cf84e6348c81c272148ed8 changed the contract without updating this consumer. This is a recorded main test regression. Landing uses the authorized inherited-failure exception at pinned head 4a2b37a9c0c513ec8ce5302ba8a28f4fdcb9feef, not a claim of green CI. No CI rerun was requested. Separate local replay observations remain unresolved: candidate managed process-exit timeout; baseline SIGTERM/final-shutdown budget overruns (11,867/18,544 ms), with managed shutdown completing in 7,325 ms. These timing findings are retained separately from the single CI assertion failure.

The concrete command-bearing reproduction is proven. It does not establish the exact message branch used by the original production incident.

Before/after images below use controlled mock-Gateway states and one unchanged UI build. They demonstrate presentation of the missing/restored queue contract; the real-Gateway proof above independently demonstrates server admission and reconnect.

Before: controlled fixture accepts the follow-up with no queued state

After: existing UI renders the restored queued custody state

Stage command-bearing input before mailbox admission, publish its existing queued lifecycle event, and project mailbox waiting state through the existing pending-input UI contract. Attribute admission waits to queued diagnostics and cover reconnect plus successor start after active completion, failure, and cancellation.
@clawsweeper

clawsweeper Bot commented Nov 9, 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.

@steipete
steipete marked this pull request as ready for review November 9, 2026 17:27
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T17:30:42.518592Z 4a2b37a Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR shows accepted command-bearing chat messages in the existing queue while they wait during reply initialization.

Example: Send /verbose on Explain the queued request. while another turn is running.

  • Before: The accepted message waits without a queued row, including after reconnect.
  • After: The existing Queued row appears during the wait and returns after reconnect.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful repair with no definite introduced defect; inspectable evidence is strongest at the integration-test and controlled-presentation boundaries.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the contributor proof gate; inspected screenshots show controlled presentation, while the claimed built-Gateway admission and reconnect run has no attached inspectable trace.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An accepted message can wait behind an active turn without showing that it is queued.
Reason: This restores the documented queue and reconnect contract for a concrete missing path, with direction already established by maintainer authorship.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs a current queue-visibility gap, and the reviewed diff introduces no definite correctness or security defect.

Priority: P2
Reviewed head: 4a2b37a9c0c513ec8ce5302ba8a28f4fdcb9feef

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The public artifacts do not include the reported built-Gateway trace showing command-bearing queue visibility before and after reconnect.
Agent review details

How this fits together

Gateway chat admission hands accepted input to the session mailbox; pending-input history and lifecycle events expose waiting messages to the Control UI.

flowchart LR
  A[Chat send] --> B[Approved input custody]
  B --> C[Session mailbox]
  C --> D[Turn execution]
  C --> E[Queue lifecycle event]
  B --> F[Pending input history]
  E --> G[Control UI queue]
  F --> G
Loading

Technical review

Best possible solution:

Retain the existing custody, mailbox, and queue projection owners with this focused admission-visibility repair.

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

The source establishes a concrete reproduction: command-bearing input skips ingress staging and can block before the prepared-followup predicate recognizes it; the PR reports baseline failure for this exact case.

Is this the best way to solve the issue?

The patch repairs missing custody and publication at existing owners, reuses the existing UI contract, and adds no competing queue implementation.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Session mailbox admission and pending-input projection keeps the original intent (36e277d: Consolidate turn selection, queues, cancellation, and custody under one controller per physical session.)
  • Native-task injection ordering keeps the original intent (2b0a8fe: Release a committed native task's injection opportunity without selecting or settling its queued turn.)
  • Queued followup presentation and benchmark keeps the original intent (859b770: Explain waiting followups and attribute actual admission waits while preserving existing execution ownership.)
  • Queue persistence across reconnect keeps the original intent (f9da9a5: Display server-owned waiting input across reconnect without resending it.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • RoboClaw: Raw commit 2b0a8fe adds src/sessions/session-controller.mailbox-task.ts:54 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 2b0a8fe8afc4; files: src/sessions/session-controller.mailbox-task.ts)

PR surface

Source +21, Tests +123, Docs +2, Other +47. Total +193 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 22 1 +21
Tests 1 123 0 +123
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 2 89 42 +47
Total 8 236 43 +193

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.

Review metrics

Metric Value Why it matters
Benchmark options 2 added flags --reply-initialization selects the reproduced admission scenario and --cpu-profile captures benchmark diagnostics; neither adds runtime user configuration.

Labels

Label changes:

  • add P2: Accepted messages lack an accurate waiting indication on a specific command-bearing admission path; this is a bounded usability defect.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • 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: Accepted messages lack an accurate waiting indication on a specific command-bearing admission path; this is a bounded usability defect.
  • 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.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach a redacted trace from the reported built-Gateway command-bearing admission and reconnect run to strengthen shipped-path 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.

Reviewed November 9, 2026, 12:44 PM ET / 17:44 UTC.

@steipete
steipete merged commit 5370a9d into main Nov 9, 2026
190 of 193 checks passed
@steipete
steipete deleted the steipete/perf-micro-queued-followup-visibility-reply-init-20260919 branch November 9, 2026 18:06
@steipete

steipete commented Nov 9, 2026

Copy link
Copy Markdown
Contributor 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 10, 2026
)

Stage command-bearing input before mailbox admission, publish its existing queued lifecycle event, and project mailbox waiting state through the existing pending-input UI contract. Attribute admission waits to queued diagnostics and cover reconnect plus successor start after active completion, failure, and cancellation.
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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant