Skip to content

fix(chat): let Send now recover a queue after a failed send - #5065

Merged
reachjalil merged 1 commit into
devfrom
fix/queued-promotion-recovery
Sep 16, 2026
Merged

reachjalil merged 1 commit into
devfrom
fix/queued-promotion-recovery

Conversation

@reachjalil

Copy link
Copy Markdown
Member

Problem

While the agent is working, you can push a queued message with Send now to steer the conversation. Once an earlier send in that conversation had definitely failed, pressing Send now on any other queued message silently did nothing: the arrow looked enabled, but nothing was sent.

The queue's shared send slot stayed halted on the failed message's id, and explicit promotion could only reclaim that exact id. Removing the failed row did not release the slot, and a failed composer send left a halt that no queued row could ever match. The result felt like steering was randomly blocked.

Change

Explicit promotion (Send now) can now claim the send slot after a definite failure regardless of which message failed. The claim is atomic: the state machine moves straight from the halted state to sending, without exposing a ready slot that the background idle drainer could take first (which would have sent the wrong item).

What stays the same:

  • Automatic draining still requires a ready slot.
  • Needs-input halts (pre-send gate blocked) still require the gate to clear or an explicit retry.
  • Uncertain admissions (admission_unknown) and in-flight sends still refuse every other send, so a message can never be sent twice.
  • No visual or interaction changes; the queue panel and controls are unchanged.

Testing

Ran on the exact rebased head from apps/app with the pinned workspace tooling:

  • bun test --isolate tests/queued-drain-admission-wedge.test.ts tests/queued-draft-persistence.test.ts — 20 passed, 0 failed.
  • pnpm --filter @openwork/app typecheck — passed.
  • git diff --check — passed.

New assertions cover: failed queued message removed, then another queued message promoted; failed composer send, then a queued message promoted; promotion claims atomically with no intermediate ready state visible to subscribers; a different promotion still cannot bypass a needs-input halt; uncertain and in-flight holds remain refused.

Not covered: no end-to-end run of the desktop app was performed for this change. The behavior lives entirely in the drain state machine reducer, which the unit tests exercise directly; runtime validation of the surrounding Send now flow is left to the existing queued-message journeys in CI.

Explicitly promoting a queued message could silently do nothing once an
earlier send in the same conversation had definitely failed. The drain slot
stayed halted on the failed message id, and Send now could only reclaim it for
that exact id, so pushing any other queued message, or promoting after the
failed row was removed or after a failed composer send, was rejected without
feedback.

Explicit promotion now claims the slot atomically after a definite failure,
without exposing a ready state that the idle drainer could take first.
Automatic draining, needs-input halts, uncertain admissions, and in-flight
sends keep their duplicate-send protection.
@vercel

vercel Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 16, 2026 8:28pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
openwork-den Skipped Skipped Sep 16, 2026 8:28pm UTC
openwork-diagnostics Skipped Skipped Sep 16, 2026 8:28pm UTC
openwork-landing Skipped Skipped v0 Sep 16, 2026 8:28pm UTC

@github-actions

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (25273 ms), confidentiality-review (12776 ms), desktop-den-sync-review (28634 ms), design-spec-review (18019 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 1
  • Distinct heads in retained window: 1
  • Current unresolved Warden threads: 0 of 0 observed
  • Observed resolved/unresolved transitions in retained snapshots: 0 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 0
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 1/20 run attempts retained; truncated: false
  • Transition snapshot: 0/0 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (ed7bcd727ecec9ff33612f6c8a831ed0b1d73774). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@github-actions

Copy link
Copy Markdown
Contributor

Passed · 12/12 tests · 18/18 assertions · 8 images

Commit ed7bcd727ecec9ff33612f6c8a831ed0b1d73774 · selected evidence

Open review report

@reachjalil
reachjalil merged commit c4356f0 into dev Sep 16, 2026
29 checks passed
D3viantS4ge added a commit to D3viantS4ge/openwork that referenced this pull request Sep 18, 2026
…ilure

The admission-aware drain machine halted the whole send slot once any item
had a definite failure (terminal_failure / blocked), so pressing the up-arrow
"Send now" on any OTHER queued item silently no-oped. This mirrors the
upstream different-ai#5065 fix: an explicit steer may claim the slot after a
terminal_failure halt (any item), while a needs_input halt and unknown
admissions still guard against duplicate sends. Update the wedge test to the
new contract.

This branch was successfully deployed

1 active and 3 inactive deployments
Preview – openwork-app — ed7bcd72 Deployed Sep 16, 2026 by vercel[bot]
Preview – openwork-den — ed7bcd72 Deployed Sep 16, 2026 by vercel[bot]
Preview – openwork-diagnostics — ed7bcd72 Deployed Sep 16, 2026 by vercel[bot]
Preview – openwork-landing — ed7bcd72 Deployed Sep 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant