Skip to content

fix(client): reconcile pending delivery after execution - #59877

Open
kernel-oops wants to merge 1 commit into
anomalyco:devfrom
kernel-oops:fix/pending-delivery-reconciliation
Open

kernel-oops wants to merge 1 commit into
anomalyco:devfrom
kernel-oops:fix/pending-delivery-reconciliation

Conversation

@kernel-oops

@kernel-oops kernel-oops commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #59615

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Revalidate a known or in-flight inbox snapshot at an execution boundary and after a successful prompt admission when its enqueue echo was missed. This clears stale pending state while retaining genuinely pending items, unacknowledged submissions and existing snapshot/event race handling.

How did you verify your code works?

  • On public base 59542dae3c882e4cf9b029c83de508fffd797487, three focused regression tests failed before the change; afterwards, 81 affected client tests passed and client typecheck passed.
  • Root lint reported 0 errors. The root check did not pass: plugin-browser typecheck reported Process.getBuiltinModule missing. The same diagnostic was reproduced on the unchanged public base in a local fixture; this is not a claim about upstream CI.
  • No live provider or model request was made. Related tui: queued card for a delivered image message lingers above the prompt input #56748 has a different trigger; a shared cause is unconfirmed. The three focused tests also fail on open PR fix(tui): reconcile queued cards after missed delivery echoes #58072 (see the issue thread).

Visual

No new visual design or UI layout change.

Screenshots / recordings

No live screenshot or recording is available. The client-state regression is covered by the deterministic tests above.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #56748

@opencodejr opencodejr 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.

This fixes the stale pending state described in #59615 at the client-state level. I copied the PR's tests onto the base branch: the 4 new ones fail there and pass here, and the full packages/client suite passes (242 tests). tsc --noEmit passes too. I didn't check this in the live TUI, because it needs missed SSE events.

Public API: unchanged. These are internal changes to the Solid data store only.

One regression worth fixing before merge: clearing the outbox guard as soon as session.prompt resolves lets an older inbox snapshot that is still in flight drop a prompt that is still pending. Details are inline.

This also overlaps with #58072, which edits the same outbox handling in data.ts and the same test file in another way. Whichever lands second will need to reconcile the two.

Related: #56748

},
gate,
).catch((error) => {
).then((item) => {

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.

Clearing outbox here lets an older pending.sync that is still in flight drop this prompt. invalidate only queues a reload behind the current read. If that read started before the server admitted the prompt, its snapshot doesn't include it. When it lands, inflight no longer keeps the row, because the guard is gone, so the queued card disappears until the follow-up read brings it back.

I reproduced this with a small fixture: start pending.sync, resolve the prompt POST, then resolve the older read with []. input.list goes ["msg_local"] → [] → ["msg_local"]. On the base branch it stays ["msg_local"] throughout.

The guard should only be lifted for a read that starts after the acknowledgement. For example, record the acknowledged ID and let only a sync that started later drop it. Clearing it before that older read finishes is what causes the drop.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tui: delivered inbox items can retain a pending label

1 participant