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 and reproduction boundary
Reported. An operator described browser actors whose last delivery remained submitted with can_resume_delivery=false. Re-pairing was blocked; removing the pairing and connecting again returned waiting but did not produce a bound conversation. The operator reported empty browser composers and asked for an attended way to inspect and abandon or reconcile the delivery with a reason. The update was posted on 2026-11-11 at about 03:25 UTC.
Related reports described cancellation requiring a pairing_id that was hard to find, and a manual Connect racing automatic first pairing and receiving a busy error. These reports motivate a single inspectable recovery path, but they do not establish that submitted is itself the cause of the block.
Reported reproduction sequence, not independently reproduced here:
- Inspect an affected browser actor and observe submitted plus can_resume_delivery=false.
- Try the supported connection repair; observe that it cannot finish.
- Remove the pairing and request Connect; the response reports waiting, but a bound result is not observed.
- Check the composer; the operator reports it empty, yet recovery remains blocked.
The original raw status, runtime-state and delivery-receipt bundle for that sequence was not supplied to this source review. An empty composer does not prove that no earlier submission reached the conversation, that no browser command remains in flight, or that the pairing handshake completed. We should capture those layers together before assigning the historical block to a particular state variable.
Source-confirmed at 66e26c85. All references below use v0.4.54, full commit 66e26c85ce0871ee5241e4ce01793f0b4a0f0f8c. No code, build, restart or runtime reproduction was performed for this issue.
What submitted and can_resume_delivery mean at this version
A normal browser attempt first records a submitting fence before calling the browser. A verified browser submission then records a submitted delivery fact and asks the daemon to complete the exact structured turn. After successful completion, the saved target normally remains submitted. That status is historical handoff evidence; it does not assert that a reply arrived or that an in-flight worker is still running. See web_model_delivery.rs:540–568, 657–713, and 737–774.
The status projection sets can_resume_delivery only for an existing-chat target whose internal status is submission_ambiguous: web_model_browser.rs:698–706. Therefore submitted plus false is also a normal settled state. Enabling Resume for every submitted row would conflate a successful handoff with an unresolved attempt.
There is already an attended resume endpoint. It checks the exact delivery id, saved conversation, browser readiness, absence of text/attachments/generation, and a fresh target comparison before releasing the composer fence. It does not resend the old turn. Its intentionally narrow eligibility is described in web_model_delivery.rs:900–964; the route is web_model_browser.rs:264–273.
The missing request is a joined inspection and an attended resolution for other genuinely unresolved states, not a replacement for that existing safe resume behavior.
What can actually block re-pairing
Source-confirmed at 66e26c85:
| Layer | Existing behavior | Why the distinction matters |
|---|---|---|
| Live browser work | A process-local IN_FLIGHT entry makes Connect/remove return Actor browser delivery is busy. Browser delivery also owns a per-actor file lock. | These are ownership guards, not the saved submitted flag. web_model_delivery.rs:189–240. |
| Canonical active turn | wait_next_turn keeps an active turn until its completion and returns its identity rather than claiming new work. | A status heartbeat cannot release that turn. runtime_state.rs:389–416. |
| Pairing's durable checks | The daemon checks an active turn, working runtime status and a defined set of unresolved browser statuses. Plain submitted is not in that set. It has a same-saved-conversation recovery exception. | The actual blocker and the eligible repair must be reported separately. daemon web_model_connectors.rs:216–260. |
| Missing binding | The target projection preserves historical delivery evidence but presents kind=none, pairing_required and next_delivery=blocked when no current binding exists. | Historical submitted can coexist with a missing pairing; clearing that history would not restore authority. web_model_delivery_state.rs:11–35. |
| Asynchronous pairing | Connect returns waiting with pairing_id after starting a bounded background handshake. Binding is committed only after the expected pairing exchange and browser receipt are confirmed. | waiting is an acknowledgment, not a successful bind. The handshake has a ten-minute timeout and releases its control guard afterward. web_model_pairing.rs:148–188, 220–255. |
Removing a binding retires connector binding/pairing records; that operation does not itself complete the canonical delivery turn or delete its saved browser history. See daemon web_model_connectors.rs:276–278 and core web_model_connectors.rs:632–668. Removal/reconnection is therefore not a general delivery reset.
What clears these states today, and what a restart cannot prove
Source-confirmed at 66e26c85:
- Normal completion clears the matching canonical active-turn projection; it leaves the delivery receipt/history intact: runtime_state.rs:809–846.
- The process-local busy guard is released when its owning SessionGuard is dropped, including normal return. Restart is not the only release path: web_model_delivery.rs:243–262. A genuinely hung owner may keep it until that work terminates; there is no browser-delivery task handle in that HashSet to cancel through the current status API.
- Existing completion reconciliation retries only the recorded turn's completion, with a three-attempt budget; it is not a fresh browser send: web_model_delivery_completion.rs:9–10,47–78, 97–174.
- A Web process restart discards its in-memory guards, but the target, ledger and daemon turn facts are durable. An interrupted submitting fence is deliberately resolved as uncertain without redelivery: web_model_delivery.rs:280–299.
- Daemon startup settles stranded delivery claims as ambiguous. Its source explicitly allows the active browser turn to remain for review, so a daemon restart is not a general reset either: runtime_delivery.rs:195–222, runtime_state.rs:1196–1225.
No browser-specific attended abandon operation joining those facts was found in the reviewed browser routes and runtime/pairing operations. This is narrower than saying that no recovery API exists: the existing ambiguous-delivery resume, completion reconciliation and same-conversation repair paths must be preserved.
Pairing id: expose the existing state clearly, keep cancellation exact
Source-confirmed at 66e26c85. The browser-session response already contains a pairing projection, including pairing_id, expiry, state and an interrupted/timeout reason: web_model_browser.rs:768–819. The earlier report that the id was absent is not true of this pinned version. The issue here is discoverability and joining it to the operation that is blocking repair.
Cancel requires the exact id: web_model_pairing.rs:75–84. The core rejects a different current id, and invalidates the named unbound candidate: core web_model_connectors.rs:490–514.
Proposed. Surface that current id/state/expiry next to Connect/Cancel and include a safe current-attempt reference in a busy response. Keep cancellation conditional on the inspected id and actor generation. An id-less “cancel whichever attempt is current” can cancel a replacement created after inspection. If automatic pairing is already active for the same intent, manual Connect should display/observe that attempt or return a structured already-in-progress result; it must not submit a second prompt. Do not silently attach a different conversation intent.
Smallest proposed change: joined inspection plus reasoned attended resolution
Proposed. Extend the existing browser-session inspection and add one administrator-only review/resolve action for the selected browser actor. Reuse its current stores, journal, actor lifecycle serialization and browser-work exclusion. There is no background recovery loop, new service or new database.
The inspection should join, with observation time and explicit unknown values:
- raw saved delivery status and effective binding/target status;
- the last delivery id, turn id and exact source-event set;
- whether the canonical active turn matches those facts, and whether a matching durable completion already exists;
- live browser-work busy/owner status where actually observable; unknown ownership is not “idle”;
- current pairing id/state/expiry and its running/interrupted status;
- the precise blocker and eligible actions: already settled, reviewable, pairing required, busy, or inconsistent evidence.
GET inspection must remain read-only and must not claim work, send a prompt, start pairing, or clear a guard. It should issue a non-authorizing snapshot token for the exact identities/state on which the administrator is about to act.
For attended resolution:
- Require an authenticated administrator, a bounded nonempty reason, the inspected snapshot, and an explicit choice between reconciling existing evidence and abandoning the unresolved local wait. Keep the actor stopped/automatic delivery admission closed while resolving. Do not impersonate the actor by letting the caller choose another identity.
- Acquire the existing browser-work exclusion, then revalidate actor generation, binding revision or expected absence, delivery/turn/event identities and the durable outcome in the daemon's serialized mutation boundary. A changed snapshot conflicts without mutation. Do not hold a global daemon lock while awaiting browser inspection or worker termination.
- If a matching completion is already durable, preserve its actual outcome and repair only its stale projections. Otherwise reconcile a proven handoff through the existing exact-turn completion rules; do not fabricate a successful browser submission or a task result.
- If the administrator abandons an uncertain attempt, record that decision and the administrator's reason/identity durably, then release only the matching local wait/projection. Preserve submitted/accepted/ambiguous receipts and keep any possibly dispatched source events out of the delivery queue. “Abandoned” means the local wait was closed; it does not mean the external provider undid an action.
- Make the durable review result the recovery anchor. A crash after recording it but before projection repair must finish the same decision on retry; a lost acknowledgment must not apply to a newer turn or append a contradictory outcome. Return the review receipt and remaining blockers. Do not pair, start the actor or send more work implicitly.
Live work is a separate cancellation boundary. The first safe implementation can return busy/ownership-unconfirmed and leave everything intact when it cannot acquire that exclusion. It must never remove a HashSet entry to pretend the owner stopped. If targeted cancellation is included, it needs the exact owned task/attempt, closed admission, bounded cancellation/termination observation, and confirmed release of both the local writer and any outstanding browser invocation. Cancellation of a Rust future alone does not establish that an already-dispatched browser command had no effect. Timeout or uncertain browser completion leaves the attempt held; it is not a successful clear. Broad process restart is not part of this operation.
This makes the initial scope useful for orphaned/quiescent durable blocks while being honest about a genuinely live hung operation. The field report does not yet distinguish those cases. A follow-up can add owned-task cancellation only with that proof boundary; a universal force-reset button would hide it.
Why automatic retry is unsafe
Source-confirmed at 66e26c85. The browser writes a submitting fence before the external call. The request can reach the page and still lose its acknowledgment or completion write. Accepted and ambiguous delivery facts are excluded from the pending queue: runtime_delivery.rs:499–505. The normal completion path requires the exact active turn/event set and terminal handoff evidence: runtime_state.rs:771–806.
Proposed invariant. An empty composer, elapsed timeout, missing reply, removed pairing or restarted process cannot turn “may have been submitted” into “safe to send again.” A later separately authorized message may be new work; the recovery action must not requeue or replay the old source events. Keep attended reconciliation distinct from retry.
Proposed acceptance tests and data
Use real retained, redacted delivery/pairing records or an authorized disposable capture of the actual paths. The current P18 input is a report, not a raw fixture. Do not invent a production-shaped journal or claim this entire historical sequence was reproduced. Label any interruption/race mutation as a controlled variation of a retained real capture. No tests are claimed executed here.
- A normal successful submitted delivery with no active turn is classified already settled; can_resume_delivery may remain false. Inspection and a redundant resolve do not erase history, fabricate a reply or send again.
- Reproduce an actual unresolved active-turn/target mismatch from captured records. Inspection names the specific blocker. A quiescent attended resolution records the reason, closes only the matching wait and preserves the old source events' replay exclusion.
- A committed completion with stale projections is reconciled to its original outcome. An attempted abandonment cannot overwrite that completion. Missing or conflicting evidence remains held.
- Capture the existing submission_ambiguous resume path: matching conversation and delivery succeeds only after the current draft/attachment/generation/readiness checks. Preserve its no-resend behavior.
- Exercise a changed actor generation, binding, pairing id, delivery or active turn between inspection and action. The stale action must refuse without altering the successor. Interrupt after the durable review record and before projection update; restart/retry completes the same review without replay.
- A live browser owner prevents clearing; an unknown owner or expired wait remains held. If cancellation is implemented, inject delayed browser acknowledgment and late worker writes: cancellation alone must not authorize a new binding or overwrite a newer attempt.
- GET returns the already-supported pairing id/state/expiry. Cancel affects only that id; a later candidate and an established binding survive stale cancellation. Observe an automatic/manual Connect overlap through the actual control path: one pairing prompt, one current attempt, and a discoverable structured result.
- Pairing removal preserves delivery/runtime evidence. The next Connect's waiting response is not accepted as a successful bind; progress, timeout or interruption is observable from the same attempt id. Empty composers alone never pass the recovery test.
Size and scope
Proposed size: medium, estimated from the ownership and crash-recovery boundaries, not a measured diff. A read-only inspection/discoverability change can be a small first slice. The attended daemon/Web resolution and exact-state tests are the next slice. A thin UI should consume those results rather than implement a second recovery state machine. Targeted cancellation of live browser work is a separate, potentially larger slice if quiescence cannot already be established.
Out of scope: automatic resend/watchdog retries, clearing user drafts, deleting history, bypassing at-most-once fences, broad daemon/browser restart, automatic re-pair to another conversation, connector secret rotation, Dots subscription repair, browser profile sharding and 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 the joined inspection and reasoned recovery boundary around the other reported states. It is the delivery-recovery follow-up to #213, not another credential fix.
Thanks for separating the delivery evidence from the recovery action. In the current code, submitted with can_resume_delivery=false can describe a completed handoff; it does not by itself identify a stuck worker. The existing browser-session response includes the pairing ID, state and expiry, and the Web Cancel action uses that exact ID. Same-conversation repair and attended resume also preserve the no-replay boundary.
The joined diagnostic snapshot and the durable administrator abandon/reconcile operation proposed here have not been implemented. We have not reproduced the reported failure sequence, so we are not adding a force reset or treating an empty composer as proof that a submission never happened. The useful missing evidence is one failed attempt's delivery, turn, source-event and pairing identities, its canonical runtime state, and the browser readiness/receipt and busy state at that time. Please omit credentials and conversation contents; there is no need to recreate a failure on a live actor or prepare another PR. We are keeping this follow-up open rather than presenting the existing repair paths as a complete resolution.