Skip to content

feat(ui): reorder queued chat messages from the composer - #121682

Merged
vyctorbrzezowski merged 1 commit into
mainfrom
feat/queue-order
Aug 11, 2026
Merged

vyctorbrzezowski merged 1 commit into
mainfrom
feat/queue-order

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Related: #121667
The pencil on these rows arrives in #121692, which is stacked on this branch; the final row anatomy is handle · status · text · pencil · discard.

What Problem This Solves

Queued chat messages in the Control UI composer arrive in one fixed order and stay there. An operator who lines up three follow-ups behind a long run, then realizes the third one should go first, has to discard two rows and retype them.

Underneath that, queue position had two independent representations that agreed only by accident:

  • The composer showed rows sorted by createdAt (chat-outbox-owner.ts).
  • The drain delivered the first eligible entry of the stored array (chat-outbox-drain.ts).

Nothing kept the two in step. Alias consolidation already re-sorted a merged queue by createdAt while writing an array in a different order, so what the operator saw and what the Gateway received could diverge.

Why This Change Was Made

Queue position becomes an explicit, operator-owned fact — orderKey on ChatQueueItem, defaulting to createdAt so an untouched queue is still FIFO. One comparator now serves the visible projection, the drain head selection, the steer rebuild, and the alias merge, so the list the operator reads is the order the Gateway receives. listStoredChatOutboxes sorts on the way out, which is what removes the second representation rather than adding a third.

Moving a row permutes the existing position values among the movable rows instead of minting new ones, so a message queued later still lands at the back. Each changed row is persisted individually, so a storage failure leaves a readable queue and a visible error rather than a silent reshuffle.

Rows already handed to a run — sending, steering, running a local command, awaiting settings, or delivery-uncertain — hold their place and split the queue. A message is reordered only inside the contiguous run of movable rows it belongs to, so it can never be permuted ahead of work whose delivery is still open. Reordering itself stays available while the gateway is offline, which is exactly when a queue grows long enough to need it.

Non-goals: editing a queued message back into the composer, and any change to what Steer or Retry do. Those are the rest of #121667.

Locked rows are barriers, not just immovable rows

Revised after review: the first version filtered the locked rows out of the permutation instead of letting them divide it. With waiting A · unconfirmed B · waiting C, moving C to the front handed it A's position and left B in the middle — and because this PR makes the sorted order the delivery order, the drain would then send C ahead of the row it is supposed to stop on. The docs promised rows "cannot be moved past"; the code only stopped them being moved.

chatQueueMovableSegments now splits the queue at every locked row, and both the move action and the row renderer consume it: a handle offers no move out of its own segment, a drop from another segment is refused rather than reinterpreted, and a row alone between two locked rows has nothing to move against.

User Impact

Revised after review: the Move up / Move down overflow menu is gone; the handle now carries the keyboard contract directly.

Operators can reorder queued messages. Drag a row by its handle, or focus that same handle and press the up and down arrow keys, so this is not a pointer-only feature. The new order decides delivery, not just the look of the list, and it is stored with the message, so it survives a reload.

Row height, the existing state badges, the discard ×, Steer, and Retry are all unchanged.

Evidence

Queued rows — the handle is the whole reorder surface

Light Dark

With #121692 stacked on top, the same rows carry the pencil in the slot before the discard × — this PR reserves and holds that column, so nothing here shifts when the edit action lands:

Light Dark

Keyboard reorder — handle focused, then one ArrowUp

Light Dark
Focused
After ArrowUp

Focus stays on the handle as its row moves, so repeated presses keep moving the same message. Screenshots come from the mocked Control UI E2E harness (headless Chromium, mock Gateway, no live credentials) and are not committed.

Tests (Blacksmith Testbox, Linux, Node 24)

  • Full Control UI lane: node scripts/run-vitest.mjs ui/src — 564 files, 8326 passed, 0 failed.
  • Browser proof: ui/src/e2e/chat-flow.queue-reorder.e2e.test.ts queues three messages offline, focuses a handle, presses ArrowUp twice, and asserts the visible order after each. The second press is what proves focus followed the row.
  • Storage-boundary proof: ui/src/pages/chat/chat-queue-reorder.test.ts asserts the move lands in the stored outbox that the drain reads, survives a fresh host, leaves an in-flight row pinned, refuses to cross a locked row in the middle, and moves a row whose whole queue shares one arrival millisecond.
  • Unit proof: ui/src/lib/chat/chat-queue-order.test.ts covers the comparator, permutation, index clamping, same-millisecond arrivals, and the movability rule. ui/src/pages/chat/chat-composer-queue.test.ts covers the handle's ARIA contract, both arrow keys, non-arrow keys passing through, and the absence of any overflow menu.
  • node scripts/run-tsgo.mjs -p tsconfig.ui.json, node scripts/run-oxlint.mjs ui/src/lib/chat ui/src/pages/chat ui/src/components/icons.ts, and oxfmt --check on every touched file — all clean.
  • Codex autoreview (gpt-5.6-sol, high) on the branch diff: no accepted or actionable findings.

Size

Production +299 / -8 (net +291), tests +469, docs +1, counted separately against origin/main. The growth is the new capability plus its ordering owner; it also removes the second ordering representation rather than adding a third, which is why listStoredChatOutboxes sorts at the read boundary instead of every caller re-sorting. chatQueueOrderKey stays module-private — the comparator and the reorder are the whole public surface.

Main is red independently of this PR

ui/src/pages/chat/components/chat-thread.measure.test.ts > "rebinds guarded transcript images when the gateway rotates its auth token" fails on origin/main. It runs in the core-runtime-media-ui shard, which is why checks-ui, check-lint, check-dependencies, and four checks-node-compact-* jobs all go red together. Two managed-media browser tests fail alongside it: chat-flow.media-files.e2e.test.ts > "evicts and refetches managed image Blob URLs after the cache reaches capacity" and managed-media-base-path.e2e.test.ts > "keeps origin-root managed-media APIs outside the UI base path".

A second, independent breakage sits in checks-node-compact-small-11: src/cron/service.stream-trigger.test.ts, src/cron/service.stream-validation.test.ts, and src/cron/service/timer.timeout-watchdog.test.ts all expect the old failure-alert payload shape and now receive the generic "Automation ... failed N times" text.

A third: pnpm check:test-types fails on src/gateway/managed-image-actions.e2e.test.ts:125 (unknown passed where string | URL is expected) and ui/src/pages/chat/components/chat-message.test.ts:4590,4595 (missing download property, empty tuple index).

Unrelated PR #121686 shows the same failing set, so none of this comes from this branch, and nothing here touches the transcript-image, managed-media, or cron paths. The one failure from #77017 that landed in this PR's own lane — the hardcoded cursor: pointer on .chat-image-action — is fixed here.

Size

+290 / -12 production lines, +327 test lines. The growth buys the reorder capability, the canonical position owner, and the removal of four duplicated queue comparators.

@vyctorbrzezowski vyctorbrzezowski self-assigned this Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: L labels Aug 10, 2026
@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review August 10, 2026 17:51
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 10, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 10, 2026, 8:03 PM ET / August 11, 2026, 00:03 UTC.

ClawSweeper review

What this changes

Adds persistent drag-and-keyboard reordering of queued Control UI chat messages, with the stored queue order intended to control Gateway delivery.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this maintainer-authored PR open. The proposed canonical ordering repairs the display/drain split, but equal createdAt values make the move operation a no-op for same-millisecond queued messages, so delivery order can still fail to follow the operator’s action.

Priority: P2
Reviewed head: 6893f6897b23b4c2cdc9ca9788a1c21408e35dc3
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR has substantial focused evidence, but its total-order implementation has a concrete delivery-order defect.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: This MEMBER-authored PR is outside the external-contributor proof gate; its mocked Control UI screenshots and browser test claims remain useful supplemental evidence.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is outside the external-contributor proof gate; its mocked Control UI screenshots and browser test claims remain useful supplemental evidence.
Evidence reviewed 4 items Current ordering split: Current main projects the queue by createdAt, while the drain selects the first eligible item from the stored outbox; this establishes the shared ordering boundary the PR changes.
Equal-key defect: The reviewed PR diff defines the canonical comparator as the numeric difference of orderKey ?? createdAt and states moves permute existing position values. Equal-millisecond arrivals therefore retain equal values before and after a move, so stable sorting preserves their original order.
Storage merge shares the invariant: Current main reorders merged queues by createdAt, confirming that persisted order—not only the row renderer—must have a deterministic tie-breaker.
Findings 1 actionable finding [P2] Give same-timestamp rows a distinct persisted rank
Security None None.

How this fits together

The Control UI keeps queued follow-ups in browser storage while a Gateway is offline or busy. The visible queue and the outbox drain both consume those rows, so their ordering determines what the operator sees and which message is delivered next.

flowchart LR
  A[Composer follow-ups] --> B[Stored chat outbox]
  B --> C[Canonical queue ordering]
  C --> D[Queued-row controls]
  C --> E[Outbox drain]
  D --> F[Operator reorder]
  E --> G[Gateway delivery]
Loading

Decision needed

Question Recommendation
Should queued-message reordering be accepted as a Control UI delivery-order capability once its total-order invariant is repaired? Sponsor canonical queue reordering: Repair the equal-timestamp total-order gap and land the feature as the first scoped implementation of the linked queue usability request.

Why: This is a new operator-facing behavior that changes which queued follow-up reaches the Gateway next; a code fix can make it correct, but acceptance of the capability remains maintainer product scope.

Before merge

  • Give same-timestamp rows a distinct persisted rank (P2) - compareChatQueueOrder returns zero for rows created in the same millisecond, and reorderChatQueueItems only permutes those existing equal values. Stable storage sorting therefore keeps their old sequence, so moving one of those rows does not change either the projection or the delivery head. Persist a deterministic tie-breaker/rank and cover a same-timestamp storage-to-drain move.
  • Resolve merge risk (P1) - Equal-timestamp rows cannot acquire a distinguishable order through a permutation of equal numeric keys, so an operator’s reorder can remain invisible and the drain can retain the prior delivery order.
  • Complete next step (P2) - A concrete repair is known, but this maintainer-authored delivery-order feature still needs product sponsorship and exact-head validation before an automated repair lane should touch it.

Findings

  • [P2] Give same-timestamp rows a distinct persisted rank — ui/src/lib/chat/chat-queue-order.ts:20
Agent review details

Security

None.

PR surface

Source +291, Tests +454, Docs +1. Total +746 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 17 299 8 +291
Tests 4 454 0 +454
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 754 8 +746

Review metrics

Metric Value Why it matters
Production versus test delta production +299/-8; tests +454/-0 The capability adds a new persistence and delivery-order boundary, so its comparatively large production surface needs complete ordering proof.

Stored data model

Persistent data-model change detected: migration/backfill/repair: ui/src/e2e/chat-flow.queue-reorder.e2e.test.ts, serialized state: ui/src/pages/chat/chat-queue-reorder.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Establish a total persisted order (recommended)
    Give same-timestamp rows unique deterministic position values and add a storage-to-drain regression before merging.
  2. Defer the capability
    Pause the PR if maintainers do not want operators to control queued delivery order.

Technical review

Best possible solution:

Make the persisted queue position a total order, including deterministic distinct ranks for legacy or newly queued equal-millisecond rows, then prove a same-timestamp move changes both the visible queue and the drain-read outbox.

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

Yes, from source: queue multiple rows with the same createdAt, move one, and observe that permuting equal orderKey ?? createdAt values leaves the canonical stable sort unchanged.

Is this the best way to solve the issue?

No. A single numeric key derived from millisecond timestamps is not a total order; persist or derive a deterministic unique tie-breaker before using it for both projection and delivery.

Full review comments:

  • [P2] Give same-timestamp rows a distinct persisted rank — ui/src/lib/chat/chat-queue-order.ts:20
    compareChatQueueOrder returns zero for rows created in the same millisecond, and reorderChatQueueItems only permutes those existing equal values. Stable storage sorting therefore keeps their old sequence, so moving one of those rows does not change either the projection or the delivery head. Persist a deterministic tie-breaker/rank and cover a same-timestamp storage-to-drain move.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 94490bd69bc6.

Labels

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. This MEMBER-authored PR is outside the external-contributor proof gate; its mocked Control UI screenshots and browser test claims remain useful supplemental evidence.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This is a normal-priority Control UI workflow enhancement with a concrete delivery-order correctness gap.
  • merge-risk: 🚨 message-delivery: The changed ordering directly selects the next queued message delivered to the Gateway.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This MEMBER-authored PR is outside the external-contributor proof gate; its mocked Control UI screenshots and browser test claims remain useful supplemental evidence.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. This MEMBER-authored PR is outside the external-contributor proof gate; its mocked Control UI screenshots and browser test claims remain useful supplemental evidence.

Evidence

What I checked:

  • Current ordering split: Current main projects the queue by createdAt, while the drain selects the first eligible item from the stored outbox; this establishes the shared ordering boundary the PR changes. (ui/src/pages/chat/chat-outbox-owner.ts:105, 94490bd69bc6)
  • Equal-key defect: The reviewed PR diff defines the canonical comparator as the numeric difference of orderKey ?? createdAt and states moves permute existing position values. Equal-millisecond arrivals therefore retain equal values before and after a move, so stable sorting preserves their original order. (ui/src/lib/chat/chat-queue-order.ts:20, 6893f6897b23)
  • Storage merge shares the invariant: Current main reorders merged queues by createdAt, confirming that persisted order—not only the row renderer—must have a deterministic tie-breaker. (ui/src/lib/chat/outbox-store.ts:279, 59d545d81f68)
  • History routing: Current queue projection, stored merge, and drain lines are attributed to recent work by Peter Steinberger; the available local history is shallow, so older provenance is incomplete. (ui/src/pages/chat/chat-outbox-drain.ts:273, 59d545d81f68)

Likely related people:

  • Peter Steinberger: Current projection, drain, and storage-merge lines are attributed to this recent main commit; history also shows earlier queue restoration work. (role: recent queue/outbox owner; confidence: high; commits: 59d545d81f68, 9a499d3c1be0; files: ui/src/pages/chat/chat-outbox-drain.ts, ui/src/pages/chat/chat-outbox-owner.ts, ui/src/lib/chat/outbox-store.ts)

Rank-up moves

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

  • Persist a deterministic tie-breaker for equal timestamps.
  • Add a regression that moves equal-timestamp rows through stored outbox ordering and drain selection.

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 (3 earlier review cycles)
  • reviewed 2026-08-10T19:50:22.120Z sha 8fded94 :: found issues before merge. :: [P1] Keep locked queue rows as ordering barriers
  • reviewed 2026-08-10T22:13:36.186Z sha 8fded94 :: found issues before merge. :: [P1] Keep locked queue rows as ordering barriers | [P2] Restrict dragging to the reorder handle
  • reviewed 2026-08-10T23:53:53.205Z sha c5ce0f844533fc895804d1a8d26f52d54c57f9ad :: found issues before merge. :: [P2] Restrict dragging to the reorder handle | [P2] Keep hidden sending rows as reorder barriers | [P2] Preserve the order key when creating a steer chip

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 10, 2026
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Finding accepted and fixed — thanks, this was a real hole and the review traced it exactly right.

[P1] Keep locked queue rows as ordering barriers — fixed in c5ce0f84453.

The old moveQueuedChatMessage filtered the locked rows out before permuting positions, so their keys never took part. With waiting A · unconfirmed B · waiting C, moving C to movable index 0 handed it A's key while B kept its middle key; because this PR makes the sorted stored order the delivery order, the drain would then have selected C ahead of the row whose delivery is still open. The docs already promised rows "cannot be moved past" — the implementation only stopped them being moved.

The repair puts the rule in the ordering owner rather than guarding the call site. chatQueueMovableSegments in ui/src/lib/chat/chat-queue-order.ts splits the queue into contiguous runs of movable rows, so every locked row ends the run either side of it. Both consumers read it:

  • moveQueuedChatMessage permutes positions only inside the segment containing the moved row.
  • renderChatQueue gives each row its own segment, so the handle offers no move out of it, a drop originating in another segment is refused instead of reinterpreted in the wrong index space, and a row alone between two locked rows has nothing to move against.

It takes a predicate so a caller holding a row for its own reason splits the queue on the same terms — the stacked edit PR (#121692) uses that for the row it is editing, which is likewise a drain barrier.

Coverage for the reported case:

  • chat-queue-order.test.ts — segmentation around several locked rows; the predicate override; and the exact A · unconfirmed · B · C scenario, asserting C lands behind the barrier.
  • chat-queue-reorder.test.ts — the same move through the real storage boundary, asserting the stored outbox the drain reads, not the projection.
  • chat-composer-queue.test.ts — a row alone between locked rows gets no handle, and a cross-segment drop calls nothing.

Docs updated to describe the barrier honestly rather than the weaker claim.

On the two merge-risk notes: the keyed-Lit contract that was not inspectable in your checkout is covered by chat-flow.queue-reorder.e2e.test.ts, which focuses a handle in a real browser, presses ArrowUp twice, and asserts the order after each press — the second press is what proves focus followed the moved row. The remaining item is the maintainer review, which is in progress.

Full Control UI lane green on the rebased head (Blacksmith Testbox, Linux, Node 24): 8331 passed, plus tsgo:ui, oxlint ui/src, check:import-cycles, and oxfmt --check.

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 11, 2026
Queue position becomes an explicit, operator-owned fact on ChatQueueItem
instead of an accident of arrival time and storage array order. One
comparator now serves the visible projection, the drain head selection,
the steer rebuild, and the alias merge, so what the composer shows is
what the Gateway receives.

Reordering lives entirely on one handle at the left of a queued row:
drag it, or focus it and press the arrow keys. Keyed rows keep focus on
the handle as it moves. Rows already handed to a run keep their place.

Also routes .chat-image-action through var(--cursor-action); its
hardcoded pointer was failing the cursor-policy test on main.
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

[P2] Give same-timestamp rows a distinct persisted rank — respectfully rejecting the premise; the coverage ask is accepted and now added.

The finding reads reorderChatQueueItems as permuting the raw position values. It normalises them to a strictly increasing rank first, and only then permutes — ui/src/lib/chat/chat-queue-order.ts:

const keys = ordered.map(chatQueueOrderKey);
for (let index = 1; index < keys.length; index += 1) {
  // Same-millisecond arrivals would otherwise share a key and swallow the move.
  keys[index] = Math.max(keys[index]!, keys[index - 1]! + 1);
}

Three rows created in the same millisecond hold [1000, 1000, 1000], which becomes [1000, 1001, 1002] before the move is applied, so the moved row receives a genuinely distinct persisted rank. That rank is written to each changed row through updateQueuedMessageForSession, so it is the stored value the drain reads — not a render-time nicety. The comment quoted above has been on that loop since the first push, and it is the reason the loop exists.

compareChatQueueOrder does return zero for equal ranks, deliberately: after normalisation only untouched rows can still be equal, and there sort stability is the correct behaviour — it is what keeps same-millisecond arrivals FIFO. An unconditional createdAt/id tie-break was tried and reverted, because it changed the delivery order of queues nobody had reordered and broke two existing chat-send.test.ts cases ("does not send a volatile item ahead of a durable backlog", "consumes a reply target after queueing its turn offline").

Existing unit coverage: chat-queue-order.test.ts > "separates rows that arrived in the same millisecond so the move sticks" — three rows at createdAt: 10, move the last to the head, assert the resulting order is c, a, b.

Coverage ask accepted. The suggested storage-to-drain case is now in chat-queue-reorder.test.ts (c6f0f16aff9):

"moves a row that shares its arrival millisecond with the whole queue" — three rows admitted with identical createdAt, one moved to the head, asserting the stored outbox that flushStoredChatOutbox reads, via a fresh listStoredChatOutboxes, not the projection.

That is a fair gap to have named: the existing proof was at the pure-function boundary, and the invariant deserves a check where the drain actually reads. Both pass on the exact head.

Status of the other listed items: the merge-risk entry restates the same premise, so it resolves with it. The exact-head validation is green — full CI on 6893f6897b2 passed after a rerun of one unrelated src/agents/bash-tools.test.ts flake in the agentic-agents-core-tools shard, and the Control UI lane is green on Blacksmith Testbox (Linux, Node 24). Product sponsorship sits with the maintainer, who has authorised landing.

The previous review's P1 (locked rows as ordering barriers) remains fixed as described in the earlier reply; that repair is unchanged by this push.

@vyctorbrzezowski
vyctorbrzezowski merged commit 1d98902 into main Aug 11, 2026
105 checks passed
@vyctorbrzezowski

Copy link
Copy Markdown
Member Author

Merged via squash.

@vyctorbrzezowski
vyctorbrzezowski deleted the feat/queue-order branch August 11, 2026 00:44
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 11, 2026
Queue position becomes an explicit, operator-owned fact on ChatQueueItem
instead of an accident of arrival time and storage array order. One
comparator now serves the visible projection, the drain head selection,
the steer rebuild, and the alias merge, so what the composer shows is
what the Gateway receives.

Reordering lives entirely on one handle at the left of a queued row:
drag it, or focus it and press the arrow keys. Keyed rows keep focus on
the handle as it moves. Rows already handed to a run keep their place.

Also routes .chat-image-action through var(--cursor-action); its
hardcoded pointer was failing the cursor-policy test on main.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. 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. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant