Skip to content

fix(agent,host,desktop,mobile): a queued edit keeps its place; host-remote store init retries - #1604

Merged
huichen merged 3 commits into
mainfrom
pr/huichen
Nov 13, 2026
Merged

huichen merged 3 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

What

Editing a message that is still waiting in the send queue now corrects the queued item in place — same run id, same position, same files, same parked state — instead of cancelling it and re-sending at the back of the queue. Remote clients talking to an older host keep the old cancel-and-resend behaviour on purpose.

The second commit fixes the two red host-remote CI jobs on this branch: the remote fixtures' test HOME published an app.db and then called store::initialize_app_store directly, so a SQLITE_BUSY from a task still mid-write failed the whole suite instead of one attempt. The retry that TestHome has always had now lives in one initialize_store_retrying_busy helper that both fixtures call.

Commits

  • fix(agent,host,desktop,mobile): editing a queued message keeps its place
  • test(host): retry a busy store in the remote fixtures' store init

Verification

  • cargo fmt --all -- --check: clean.
  • cargo check / cargo clippy --all-targets -D warnings for future-agent, future-host, future-rpc, futureos: clean.
  • cargo test -p future-host --lib: 2248 passed / 0 failed / 15 ignored; cargo test -p future-rpc: green.
  • cargo test -p future-agent --lib: 3074 passed with 5 failures in agent/src/sandbox — the identical five fail at origin/main in a full parallel run and pass when the module runs alone, so they are pre-existing and not from this diff.
  • desktop: tsc --noEmit clean, eslint clean on the changed sources, the changed vitest suites green (186 tests).
  • mobile: tsc --noEmit clean, the changed jest suites green (88 tests, node 22 — this suite fails under the default node 26).
  • make check-docs: green.
  • The follow-up test fix was validated by re-running cargo test -p future-host --lib -- --test-threads=4 remote and the affected remote suites locally before it was pushed.

User-visible changes

Editing a message still waiting in the send queue corrects it in place instead of moving it to the back of the queue (revert d744cbe9b); a remote client paired with an older host deliberately keeps the old behaviour. No migration, no default or permission change.

A queued message edited from the send-queue panel used to be a cancellation and
a re-send: the corrected text was a new prompt, which enters at the back of the
queue. So fixing a typo in the second of four waiting messages sent it after the
fourth — the order the reader built, arriving as an order they never chose
(reported 2026-11-14).

The Agent now has an edit that is an edit: `edit_queued_run` swaps the accepted
payload's `message` in place. Same run id, same sequence, same position; the
files, images, model-context sidecar and frozen run settings the prompt was
accepted with stay exactly as they were, so a correction changes the words and
nothing else. A parked row is editable too and stays parked — editing is not the
press that starts it, and it does not reset the wait the parking rule measured.

- `InMemoryRunQueue::edit_queued` does the in-place swap, re-deriving the
  queue's byte accounting (and shrinking the global reservation) or refusing the
  whole edit when the corrected text would not fit.
- The durable acceptance is rewritten too (`replace_queued_receipt_input`): a
  restart restores the corrected words instead of the version the reader already
  fixed away. The acceptance's identity — run id, sequence, fingerprint — is
  deliberately untouched, so a retried request id stays the same acceptance.
- Wired through the host (`agent_bridge`, `application::queue`, the Tauri
  command and the remote host's prompt route) and used by all three clients that
  offer the pencil: this machine's queue, a paired computer's, and the phone.
- A host too old to know the command answers "Unsupported command"; the two
  remote clients fall back to the cancel-and-re-send they used before, files
  included, rather than failing the edit. Editing *which files* a queued row
  carries (phone only) still goes through that path.

Tests: queue ordering/limit/parked cases at the queue, the handler and the
session (durable receipt round trip), the command registry sweeps, and the
three client surfaces rewritten to assert the in-place command instead of the
re-send.
@huichen
huichen enabled auto-merge (squash) November 13, 2026 20:31
`remote::test_support::init_store` called `store::initialize_app_store`
directly, so a `SQLITE_BUSY` — a task outside the cancel registries still
mid-write on the freshly published test HOME's `app.db` — failed a whole
suite run instead of one attempt. `TestHome` has retried exactly that
since it was written (the comment there names the condition); the fixtures
that only publish a HOME never did, and the Windows `host-remote` job
failed on it:

    remote_host::sync_measurement::tests::the_gzip_declaration_...:
    store init under test HOME: Database(SqliteFailure(Error { code:
    DatabaseBusy, extended_code: 5 }, Some("database is locked")))

Move the retry into one `initialize_store_retrying_busy` that both HOME
fixtures call, so the two cannot drift apart on it again, and cover the
remote fixture with the `arm_busy_fault` seam `TestHome`'s retry test
already uses: with the fault armed, `init_store` has to consume the first
attempt and leave a usable store behind. Calling
`store::initialize_app_store` from `init_store` again fails that test
("the armed fault is consumed by the first attempt").
@huichen huichen changed the title fix(agent,host,desktop,mobile): editing a queued message keeps its place fix(agent,host,desktop,mobile): a queued edit keeps its place; host-remote store init retries Nov 13, 2026
@huichen
huichen merged commit 252d1c8 into main Nov 13, 2026
60 of 62 checks passed
@huichen
huichen deleted the pr/huichen branch November 13, 2026 22:46
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