Skip to content

fix: keep retained inputs in transcript order - #134261

Merged
roboclaw-bot merged 1 commit into
mainfrom
roboclaw/fix-pending-input-order
Aug 31, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
roboclaw/fix-pending-input-order

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes an issue where retained accepted chat inputs appeared at the bottom of the transcript instead of where they were accepted. Interrupted or cancelled inputs could therefore look pinned below much newer replies and disconnected from the conversation that produced them.

Why This Change Was Made

The Gateway now projects each retained input with its authoritative acceptance timestamp. The Control UI feeds those rows through the transcript's existing timestamp-aware insertion path instead of appending them after every canonical message. Stable transcript rows keep their existing relative-order and clock-skew protections.

User Impact

Retained queued, interrupted, and cancelled inputs now flow chronologically with the surrounding chat. Their state notice remains visible, but the input no longer appears glued to the latest-message boundary.

Evidence

  • Real isolated Gateway + Control UI before/after proof: both recordings exercise a production Gateway over WebSocket into real Chromium at 1280×720, with isolated state and providers disabled. The parent and exact PR head use the same retained interrupted-input scenario.

    Broken parent 00d542d3dc1f88dc18526e11eee5641782dae9e7: Timeline 02 renders after Timeline 05; the Gateway trace records acceptance at 1788201340281 while the projected message still carries the stale 1788201279736 timestamp.

    real-gateway-broken.webm

    Fixed exact head c960a56f59747c70fe23d29702a207bfbc58c5da: Timeline 02 renders between Timeline 01 and Timeline 03; the projected message timestamp is the authoritative acceptedAt value (1788202352545), and the interrupted-state notice remains visible.

    real-gateway-fixed.webm
  • Deterministic Chromium fixture proof remains as a second oracle:

  • Before the fix, the new chronology regression failed because the later replies were grouped first and the older retained input was appended last.

  • node scripts/run-vitest.mjs ui/src/pages/chat/chat-pending-inputs.test.ts — 31 passed.

  • node scripts/run-vitest.mjs src/gateway/server-methods/chat-history-handler.test.ts — 9 passed.

  • node scripts/check-changed.mjs -- src/gateway/server-methods/chat-history-handler.test.ts src/gateway/server-methods/chat-pending-inputs.ts ui/src/pages/chat/chat-pending-inputs.test.ts ui/src/pages/chat/chat-thread-build.ts — passed.

  • Exact-head Codex autoreview — scoped-clean, 0.99 confidence, no accepted/actionable findings.

  • Production LOC: +8/-12 (net -4). Tests: +82/-0.

Provenance: the unconditional pending-input append was introduced in 6c9954cbb69880960257eb7811581b0b5dedc774 (#132887). Raw-parent comparison against 64f4a18ddd513b65d85bfc705a0b45d94f5fe467 confirms that commit added the append after all timestamp-aware transcript insertion.

Worked on by

Worked on by:
- @VACInc

Co-authored-by: Vito Cappello <[email protected]>
@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review August 31, 2026 16:11
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 3:33 PM ET / 19:33 UTC.

ClawSweeper review

What this changes

The PR timestamps retained pending inputs at Gateway acceptance and inserts them into the Control UI transcript according to that time.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still lacks the acceptance-time projection and chronological insertion, while this PR supplies a focused repair with no blocking correctness finding.

Priority: P2
Reviewed head: c960a56f59747c70fe23d29702a207bfbc58c5da

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative production correction with targeted boundary tests and detailed exact-head real-flow evidence.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (recording): The changed production path is pending-input storage through Gateway history projection into the Control UI transcript builder; the PR supplies an exact-head isolated Gateway, WebSocket, and Chromium before/after recording with the corrected placement and retained notice. Playback was blocked locally by DNS.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (recording): The changed production path is pending-input storage through Gateway history projection into the Control UI transcript builder; the PR supplies an exact-head isolated Gateway, WebSocket, and Chromium before/after recording with the corrected placement and retained notice. Playback was blocked locally by DNS.
Evidence reviewed 6 items Acceptance-time owner: The pending-input producer writes accepted_at from Date.now() in its synchronous write transaction; the PR projects that authoritative value as the display timestamp.
Gateway and UI repair path: chat.history reads current-session pending inputs, and the changed UI path seeds the existing stable timestamp insertion routine rather than appending pending rows after history.
Focused regression coverage: The Gateway test verifies that a source timestamp of 1000 is projected as acceptedAt 2000; the UI test verifies the pending input and its state notice fall between history at timestamps 50 and 150.
Findings None None.
Security None None.

How this fits together

The Gateway returns retained interrupted or cancelled inputs alongside session history. The Control UI combines those rows with canonical history so the transcript shows an input where it was accepted.

flowchart LR
A[Accepted chat input] --> B[Pending input record]
B --> C[Gateway history response]
C --> D[Transcript insertion]
D --> E[Chronological chat display]
Loading

Before merge

  • Resolve merge risk (P1) - The exact-head recording attachments could not be independently played because the review environment could not resolve github.com; this is a reviewer-network limitation, not missing contributor proof.
  • Complete next step (P2) - No repair job is needed because no actionable defect was found in the proposed patch.
Agent review details

Security

None.

PR surface

Source -4, Tests +82. Total +78 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 8 12 -4
Tests 2 82 0 +82
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 90 12 +78

Review metrics

Metric Value Why it matters
Production versus regression coverage production +8/-12 (net -4); tests +82/-0 The fix removes the trailing append path while adding owner-boundary Gateway and UI ordering coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused repair after normal exact-head merge gates, retaining the Gateway-owned acceptance timestamp and the UI’s existing stable timestamp insertion path.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the focused repair after normal exact-head merge gates, retaining the Gateway-owned acceptance timestamp and the UI’s existing stable timestamp insertion path.

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

Yes—source inspection shows the base branch appended pending rows after timestamp-aware projections, while the changed tests encode the resulting ordering failure; the PR also supplies an exact-head browser scenario.

Is this the best way to solve the issue?

Yes—the Gateway owns the authoritative acceptance fact and the UI reuses its existing stable insertion routine, avoiding a second ordering mechanism or downstream workaround.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0820b89d3b20.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed production path is pending-input storage through Gateway history projection into the Control UI transcript builder; the PR supplies an exact-head isolated Gateway, WebSocket, and Chromium before/after recording with the corrected placement and retained notice. Playback was blocked locally by DNS.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (recording): The changed production path is pending-input storage through Gateway history projection into the Control UI transcript builder; the PR supplies an exact-head isolated Gateway, WebSocket, and Chromium before/after recording with the corrected placement and retained notice. Playback was blocked locally by DNS.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded transcript-ordering defect with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (recording): The changed production path is pending-input storage through Gateway history projection into the Control UI transcript builder; the PR supplies an exact-head isolated Gateway, WebSocket, and Chromium before/after recording with the corrected placement and retained notice. Playback was blocked locally by DNS.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production path is pending-input storage through Gateway history projection into the Control UI transcript builder; the PR supplies an exact-head isolated Gateway, WebSocket, and Chromium before/after recording with the corrected placement and retained notice. Playback was blocked locally by DNS.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The changed production path is pending-input storage through Gateway history projection into the Control UI transcript builder; the PR supplies an exact-head isolated Gateway, WebSocket, and Chromium before/after recording with the corrected placement and retained notice. Playback was blocked locally by DNS.

Evidence

What I checked:

  • Acceptance-time owner: The pending-input producer writes accepted_at from Date.now() in its synchronous write transaction; the PR projects that authoritative value as the display timestamp. (src/config/sessions/session-accessor.pending-inputs.ts:248, c960a56f5974)
  • Gateway and UI repair path: chat.history reads current-session pending inputs, and the changed UI path seeds the existing stable timestamp insertion routine rather than appending pending rows after history. (ui/src/pages/chat/chat-thread-build.ts:241, c960a56f5974)
  • Focused regression coverage: The Gateway test verifies that a source timestamp of 1000 is projected as acceptedAt 2000; the UI test verifies the pending input and its state notice fall between history at timestamps 50 and 150. (src/gateway/server-methods/chat-history-handler.test.ts:18, c960a56f5974)
  • Current-main comparison: Fetched main has neither the projected acceptance timestamp nor the timestamped pending-input insertion; the central behavior remains necessary. (src/gateway/server-methods/chat-pending-inputs.ts:30, 0820b89d3b20)
  • Exact merge identity: The recorded test merge has the pinned PR base as first parent and this PR head as second parent, matching the supplied introduction evidence. (b048e1025cae)
  • Real behavior evidence: The PR body records an exact-head isolated Gateway-to-WebSocket-to-Chromium before/after scenario: the retained input moves between surrounding history while its interrupted notice remains visible. (c960a56f5974)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-31T16:19:40.834Z sha c960a56 :: needs real behavior proof before merge. :: none

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Land-ready evidence refresh for exact head c960a56f59747c70fe23d29702a207bfbc58c5da:

  • Added real isolated Gateway → WebSocket → Control UI Chromium before/after recordings to the PR body.
  • Broken parent 00d542d3dc1f88dc18526e11eee5641782dae9e7: retained Timeline 02 renders after later replies.
  • Fixed exact head: retained Timeline 02 renders between Timeline 01 and Timeline 03, with the interrupted notice preserved.
  • Exact-head CI is green: https://github.com/openclaw/openclaw/actions/runs/33412723168
  • Focused proof passed: node scripts/run-vitest.mjs ui/src/pages/chat/chat-pending-inputs.test.ts (31 tests), node scripts/run-vitest.mjs src/gateway/server-methods/chat-history-handler.test.ts (9 tests), and the changed-scope gate.
  • Exact-head autoreview found no actionable findings. No known proof gaps remain.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 31, 2026
@roboclaw-bot
roboclaw-bot merged commit 6862adf into main Aug 31, 2026
530 of 535 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

@roboclaw-bot
roboclaw-bot deleted the roboclaw/fix-pending-input-order branch August 31, 2026 19:37
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 1, 2026
Worked on by:
- @VACInc

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: Vito Cappello <[email protected]>
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: sufficient ClawSweeper judged the real behavior proof convincing. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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