Inspect and explicitly reconcile a blocked browser delivery; surface the exact pairing attempt
Part of #213 — follow-up C: inspect and attend to a blocked browser delivery without replaying work that may already have been submitted.
Reported behavior
A browser actor can remain with its last delivery submitted and can_resume_delivery=false. Re-pairing is blocked; removing the pairing and connecting again returns waiting without a bound conversation. The composer can appear empty while recovery remains blocked. Related reports describe cancellation needing a hard-to-find pairing_id and manual Connect racing automatic first pairing and returning busy.
The reports do not establish that submitted is the cause and lack a combined status/runtime/receipt bundle. An empty composer does not prove no earlier submission, in-flight command or completed pairing. Capture those layers before assigning the block to one variable.
Source: v0.4.54, 66e26c85ce0871ee5241e4ce01793f0b4a0f0f8c.
Current behavior
A normal attempt records a submitting fence before the browser call. A verified submission records a submitted fact and asks the daemon to complete the exact structured turn. After successful completion the saved target normally remains submitted; that is historical handoff evidence, not proof of a reply or a live worker delivery:540–568, 657–713, 737–774.
can_resume_delivery is set only for an existing-chat target whose internal status is submission_ambiguous browser:698–706. Thus submitted plus false is also settled; enabling Resume for every submitted row would conflate success with an unresolved attempt.
An attended resume endpoint checks exact delivery id, saved conversation, browser readiness, empty text/attachments/generation and fresh target before releasing the fence. It does not resend delivery:900–964, browser:264–273. The missing request is joined inspection and attended resolution for other unresolved states.
What can block re-pairing
- Live work: process-local
IN_FLIGHTmakes Connect/remove return busy; per-actor file lock. Ownership guards, not the flag delivery:189–240. - Active turn:
wait_next_turnkeeps a turn until completion; heartbeat cannot release it runtime_state:389–416. - Durable checks: daemon checks active turn, working runtime and defined unresolved statuses; plain
submittedis excluded, with a same-conversation recovery exception connectors:216–260. - Missing binding: the projection preserves historical evidence but presents
kind=none,pairing_requiredandnext_delivery=blockeddelivery_state:11–35. - Async pairing: Connect returns
waitingwithpairing_idafter starting a bounded handshake; binding is committed only after the exchange and browser receipt.waitingis not success; timeout is ten minutes pairing:148–188, 220–255.
Removal retires binding/pairing records but does not complete the turn or delete history connectors:276–278, core:632–668; not a reset.
What clears these states
Normal completion clears the active-turn projection but leaves receipt/history runtime_state:809–846. The busy guard releases on SessionGuard drop delivery:243–262, though a hung owner may keep it; reconciliation retries only the recorded turn completion:9–78, 97–174.
A Web restart resolves an interrupted submitting fence as uncertain delivery:280–299; daemon startup marks stranded claims ambiguous and may leave the active turn for review runtime_delivery:195–222, runtime_state:1196–1225. No browser-specific attended abandon joins these facts; preserve existing resume, reconciliation and same-conversation repair.
Pairing id
The browser-session response already contains pairing_id, expiry, state and interrupted/timeout reason browser:768–819. The gap is discoverability beside the blocking operation. Cancel requires the exact id pairing:75–84; the core rejects a different current id and invalidates the named unbound candidate core:490–514.
Surface id/state/expiry next to Connect/Cancel and a safe current-attempt reference in busy. Keep cancellation conditional on inspected id and generation; an id-less "cancel current" can cancel a replacement created after inspection. If automatic pairing is active for the same intent, manual Connect should observe it or return already-in-progress, not submit a second prompt. Do not silently attach a different intent.
Smallest shape
Extend browser-session inspection and add one administrator-only review/resolve action for the selected browser actor. Reuse current stores, journal, serialization and browser-work exclusion; no new loop, service or database.
Inspection joins, with time and explicit unknowns: raw delivery/binding/target; last delivery/turn/source-event ids; active-turn match and durable completion; observable busy/owner; pairing id/state/expiry; blocker and eligible actions. GET is read-only and issues a non-authorizing snapshot token for the exact state.
Resolution requires an authenticated administrator, bounded reason, inspected snapshot and explicit choice to reconcile or abandon; actor stopped, admission closed, caller unable to choose identity. Acquire browser-work exclusion, then revalidate generation, binding revision or absence, delivery/turn/event ids and durable outcome in the serialized mutation boundary; a changed snapshot conflicts without mutation.
Preserve durable matching completion and repair stale projections; otherwise reconcile a proven handoff through exact-turn rules, never fabricate. On abandonment, record decision/reason/identity, release only the matching wait/projection, preserve receipts and keep possibly dispatched events out of the queue. Crash after durable review finishes the same decision on retry; lost ack cannot hit a newer turn. Return receipt and blockers; no implicit pair/start/send.
Live work is separate. Return busy/ownership-unconfirmed and leave all intact; never remove a set entry to pretend the owner stopped. Targeted cancellation needs exact owned task/attempt, closed admission, bounded termination observation, and confirmed release of local writer and browser invocation. Cancelling a Rust future does not prove a dispatched command had no effect; timeout/uncertainty holds. No broad restart.
Why automatic retry is unsafe
The browser writes the submitting fence before the external call, so the request can reach the page and lose its acknowledgment or completion write. Accepted/ambiguous facts are excluded from the pending queue runtime_delivery:499–505; normal completion requires the exact active turn/event set and terminal evidence runtime_state:771–806.
An empty composer, timeout, missing reply, removed pairing or restart cannot turn "may have been submitted" into "safe to send again." A later authorized message may be new work; recovery must not requeue or replay old events. Attended reconciliation is distinct from retry.
Acceptance tests and data
Use real retained, redacted records or authorized disposable capture; label race mutations as controlled variations. Do not invent a production-shaped journal or claim reproduction.
- Successful
submittedwith no active turn is settled;can_resume_deliverymay stay false; no erasure, fabricated reply or resend. - Unresolved active-turn/target mismatch: inspection names blocker; quiescent resolution records reason, closes only matching wait, preserves replay exclusion.
- Committed completion with stale projections reconciles to original outcome; abandonment cannot overwrite; conflict held.
- Existing
submission_ambiguousresume passes only after draft/attachment/generation/readiness checks; no-resend preserved. - Changed generation, binding, pairing id, delivery or active turn refuses without altering successor; crash after durable review finishes same review.
- Live owner prevents clearing; unknown/expired wait held. Cancellation must not let delayed ack/late writes authorize a binding or overwrite newer attempt.
- GET returns pairing id/state/expiry; cancel affects only that id; later candidate/binding survives cancellation; auto/manual overlap has one prompt and result.
- Pairing removal preserves delivery/runtime evidence; next Connect
waitingis not a bind; progress/timeout/interruption observable; empty composer alone never passes.
Size and scope
Medium, from ownership/crash boundaries, not a measured diff. Read-only inspection can be a small first slice; attended daemon/Web resolution and exact-state tests follow; a thin UI consumes results. Targeted live-work cancellation is separate and may be larger.
Out of scope: automatic resend/watchdog retries, clearing drafts, deleting history, bypassing at-most-once fences, broad daemon/browser restart, automatic re-pair, connector secret rotation, Dots subscription repair, profile sharding, model/actor provisioning.
Related upstream #112 already addressed an unsent-draft overwrite and added attended resume without automatic resend. This request preserves that behavior and asks for joined inspection and reasoned recovery around the other reported states. It is the delivery-recovery follow-up to #213, not another credential fix.
Superseded by #215, which carries the complete version of this report.