Skip to content

Instant UI and optimistic updates across desktop Bots, iOS and Android - #576

Merged
sambitcreate merged 8 commits into
mainfrom
claude/project-thread-qbs790
Oct 21, 2026
Merged

sambitcreate merged 8 commits into
mainfrom
claude/project-thread-qbs790

Conversation

@sambitcreate

@sambitcreate sambitcreate commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Requested by sbt · project thread

Summary

Every tap changes the screen before the round trip; the server action starts whenever it starts. This is the write and navigation side of the cache-first loading plan (#516), written up in docs/plans/instant-ui-optimistic-updates-plan.md with the per-surface audit, what landed and what was deferred. No Remote protocol change.

Desktop Bots

  • Pending send echo: a "Sending…" bubble keyed by one idempotent requestId per submission, settled when the projected entry (or queued row) with the same text arrives, or 4 s after main confirmed. The id is kept across a retry after an uncertain failure; Try again mints one id per failed row and hides the failed card at once.
  • Remembered live views: reopening a Bot shows its last snapshot on the first frame (stale until the fresh one lands) instead of a skeleton; reload keeps the view; a resubscribe failure shows a red Try again callout over the kept view.
  • Resume / Dismiss hide the paused card at once and restore it if main still reports the pause; request ids are dropped once main answers so a blocked Resume can be retried after fixing access.
  • Optimistic identity edits (name, subtitle, character, instructions): one edit stack per Bot (the last confirmed Bot plus every patch still in flight) is shown before the IPC, which still does get → update so another surface's edit to a different field is kept. A failed patch drops out of the stack whichever order answers arrive in, builds on any newer revision a reread brought meanwhile, and rereads the Bot and the lists once nothing is pending. Clearing the Subtitle removes it from the cache as main removes it. Inline fields stay enabled; the Instructions editor closes when main confirms and keeps the draft on failure.
  • Create / preset / delete / routines / Advanced write the answer into the TanStack cache and only then invalidate; bots:createFromPreset answers before the self-intro is sent. useBot seeds from the cached list; /bots redirects from a list cached within five minutes.

iOS

  • AidenInstallation.serverFeatures keeps the Mac's last /server tokens per pairing; coordinator.knownServerFeatures serves them while connecting, so a durable-session Mac never lands on the legacy Bot path.
  • New chat and new Bot / preset open from the create receipt and refresh behind the screen; Bots home stays unsettled (skeleton) while connecting instead of "No saved Bots".
  • Routine and scheduled Pause/Resume toggles flip at once and roll back on failure.
  • Steer/Queue clears the draft on screen as the input leaves and keeps the saved draft until the Mac admits it; AidenChatDraftStore.consumeDraft then retires the admitted text under the pairing's ownership (only while the saved draft is still the one it was sent from), and a rejection or unconfirmed send restores the text merged under anything typed since.
  • Rename shows the new title in the chat list at once; delete removes the Recents row at once; both roll back on failure.

Android

  • AidenChatViewModel follows the pairing's current client (it captured the client once, so Retry after a failed connection stranded the open chat) and rereads the transcript when the pairing gets a new client.
  • coordinator.supportsBotDurableSession() reads the pairing's saved features until /server answers (Bot chat route, Bots home, deep links).
  • Routine Switch flips at once; a deep link to a chat saved on the device opens before the connection is up; the run-input draft clears, settles and restores like iOS; Bots home offline with nothing saved settles instead of a skeleton that never ends.

Deferred (in the plan)

Send while connecting (both phones), phone Steer/Queue pending bubbles, cold-cache transcript skeleton, Android New chat FAB and connecting banner.

Review

Reviewed between steps with an Opus 5.5 medium-effort pass (13 findings applied), then three Pullfrog rounds: subtitle clearing, overlapping failed edits, rejected run input losing its durable copy, failed edits overwriting a phone's newer rename, late admission leaving admitted text as a draft, and a same-prefix newer draft being consumed. All addressed; Pullfrog reports no new issues on the final head. The "Hermes Review Bot" status on the final head is that local bot's own engine timeout, not a finding.

Tests

  • Desktop: renderer/main/bots/*.test.tsx, bots-view.test.tsx, bots-home.test.tsx (247/247 incl. four new profile tests), bot-starter.test.ts, handlers/bots.test.ts; tsc and eslint clean.
  • iOS: AidenRemoteClientTests.testInstallationKeepsTheLastServerFeaturesForGatesWhileConnecting, AidenBotCacheTests.testDraftStoreConsumesAdmittedRunInputFromAnOlderSession (CI only; no Xcode here).
  • Android: AidenChatTest.chatKeepsLoadingWithThePairingsRefreshedClient (fails on the old code), AidenChatTest.testDraftStoreConsumesAdmittedRunInputFromAnOlderSession, AidenRemoteCoordinatorClientTest.botDurableSessionGateReadsThePairingsSavedFeaturesUntilServerAnswers, AidenProductShellTest.testBotsHomeContentStates (CI only; Gradle cannot fetch the Android plugin here).
  • Phone toggle and draft flows are view-state changes to exercise by hand on the next TestFlight / Android build.
  • Flaky note: the first CI run failed chatKeepsLoadingWithThePairingsRefreshedClient with only an Assert.java:89 frame (run); the test now names each step and compares the post-refresh error state with the pre-refresh one, and it passed on every run since.

Docs

docs/plans/instant-ui-optimistic-updates-plan.md (new), docs/plans/README.md, docs/design-guide.md (Loading and optimistic updates), .memory/instant-ui-optimistic-updates.md and related memory notes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RQjxbg1n4c3xNJRpUaF1WL

…, optimistic edits

The Bots section now shows every action on the next frame and lets main
follow: sends echo at once under one request id per submission (kept across
a failed retry so nothing double-sends), Retry hides the failed card and
reuses one id per failed turn, Resume and Dismiss hide the paused card
until main's state says otherwise, reopening a Bot shows its remembered
conversation before the fresh snapshot lands, reload keeps the view, and
rename, subtitle, avatar and instructions apply to the cache before the
save. Create and Start chat list the Bot and open its chat before the
list reread and the self-intro (the preset intro is now deferred by the
desktop handler), delete drops the row from the cached list at once, the
Bot page starts from the list entry, /bots opens the last viewed Bot from
a recent cached list, and routines and Advanced saves place their answers
in the cache instead of waiting for a reread.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RQjxbg1n4c3xNJRpUaF1WL
…ggles, instant opens

iOS keeps the Mac's last /server features per pairing and resolves Bot
routes from them while connecting, opens new chats and Bots from the
create receipt, flips routine and scheduled toggles at once, clears the
Steer/Queue draft as the input leaves (restored on failure), and renames
or removes chats in the list and Recents before the Mac answers.

Android follows the pairing's refreshed client in an open chat, reads the
durable-session gate from saved features, flips routine toggles at once,
opens a saved chat deep link without waiting for the connection, clears
the run-input draft at once, and settles the Bots home when offline with
nothing saved.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RQjxbg1n4c3xNJRpUaF1WL
…, pairing-bound client

Resume and Dismiss drop their request id once main answers, so a blocked
Resume can be retried after fixing access. updateBotIdentity rereads the
Bot before writing again and rolls back only this Bot's row where the cache
still holds the optimistic copy; the Instructions editor closes on confirm
and keeps the draft on failure; retried failed turns stay hidden as a set.
iOS keeps the optimistic rename list-local, restores a rejected run input
under text typed meanwhile, keeps the Bots home unsettled while connecting
and flips routine toggles in the Binding setter. Android binds the chat to
its pairing identity rather than the instance id and merges a rejected run
input the same way.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RQjxbg1n4c3xNJRpUaF1WL
@sambitcreate sambitcreate self-assigned this Oct 21, 2026
CI failed chatKeepsLoadingWithThePairingsRefreshedClient with only an
Assert.java frame. Each step now fails with its own message and source
line, and the reread is compared against the error state before the
refresh rather than against null.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RQjxbg1n4c3xNJRpUaF1WL

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

Caution

Rejected mobile Steer/Queue text can be lost after a client or screen-owner change. Desktop profile edits also have two reproducible save/rollback regressions.

Reviewed changes across desktop Bots, shared creation handling, iOS, Android, tests, and documentation.

  • Desktop chat feedback: Pending send echoes, retained retry request IDs, optimistic Resume/Dismiss, and remembered live snapshots.
  • Desktop mutations: Optimistic identity edits, cache reconciliation for creation/deletion/routines/access, list-seeded detail queries, and deferred preset introductions.
  • Native clients: Saved-feature routing, receipt-first navigation, optimistic toggles and chat-list edits, early run-input draft clearing, and Android client replacement handling.
  • Documentation and coverage: The instant-UI plan, design rules, project memory updates, and focused behavioral tests.

Validation: 244 desktop Bot tests and 8 starter tests passed. Two additional call-through probes reproduced the subtitle-clearing and overlapping-rollback findings. Changed Swift sources parse, and iOS release/policy tests pass; native XCTest requires macOS/Xcode. Android tests could not execute: offline resolution reported Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention', version: '1.0.0'] was not found; the online attempt returned Tool 'shell' timed out after 120000ms.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol | 𝕏

Comment thread renderer/main/bots/bot-identity.ts Resolved
Comment thread renderer/main/bots/bot-identity.ts Resolved

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

Important

No new issues found in this test-only update. The three findings from the previous review remain unresolved, so this is not an approval.

Reviewed changes in 1d08ff230 since the prior review at d1283c8d9, with the full PR diff read for context.

  • Added reconnect diagnostics to identify which connection invariant failed and explicitly verify that refreshClient() replaces the client object.
  • Changed error-state validation to compare the post-reconnect error with the pre-reconnect value, rather than require an initially error-free fixture.

Validation: Inspected the changed test and its client-refresh/load paths. The focused Android test could not execute because Gradle configuration failed: Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention', version: '1.0.0'] was not found. No production code changed in this delta.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6.1-sol | 𝕏

…ble run-input draft

Overlapping identity edits now share one edit stack per Bot, so a failed
patch drops out without undoing the other edit, whichever answers first.
Clearing the Subtitle removes the description from the cache as main does.
Steer/Queue on the phones clears the draft on screen but keeps the saved
draft until the Mac admits the input, so a rejection after a client or
screen change still restores the text.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RQjxbg1n4c3xNJRpUaF1WL

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

Important

Two new settlement regressions remain: late admitted mobile input can reappear as an unsent draft, and failed desktop edits can overwrite newer sidebar data.

Reviewed changes in a9e7c930 since the previous review at 1d08ff230, with the full PR diff read for context.

  • Replaced Bot edit rollback with a confirmed definition plus pending optimistic patches.
  • Corrected subtitle clearing and added profile tests for clearing and overlapping failures.
  • Deferred mobile draft persistence until run-input admission on iOS and Android, and updated the implementation plan.

Validation: All 246 focused desktop Bot tests passed, including the 15 profile tests. An independent call-through probe reproduced the stale-sidebar finding. The changed Swift source parses, and iOS release/policy checks pass; native XCTest requires macOS/Xcode. Android chat tests could not configure because Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention', version: '1.0.0'] was not found. Mobile receipt findings were source-traced, not executed natively.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol | 𝕏

Comment thread renderer/main/bots/bot-identity.ts Resolved
…the saved draft

A failed identity edit now builds on any newer revision a reread brought
while it was in flight and rereads the lists too, so a rename from a phone
is not undone in the sidebar. On both phones the draft store retires an
admitted Steer/Queue text under the pairing's ownership, so a client or
screen change before the receipt cannot offer it again as an unsent draft.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RQjxbg1n4c3xNJRpUaF1WL

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

Important

Late mobile admission can now remove text from a newer, independent draft when it shares the submitted prefix.

Reviewed changes in e316661f since the prior review at a9e7c930, with the full PR diff read for context.

  • Preserved refreshed Bot definitions during failed optimistic edits and invalidated both detail and list caches after final failure.
  • Added retained-ownership draft consumption before mobile screen/client checks, with older-session store tests on iOS and Android.
  • Updated implementation documentation to describe the revised rollback and admission behavior.

Validation: All 247 focused desktop Bot tests passed. Changed Swift app/test sources parse, and portable iOS release/policy checks pass. Native XCTest requires macOS/Xcode; Android chat tests could not configure because Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention', version: '1.0.0'] was not found. The mobile finding is source-traced, not a natively executed reproduction.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol | 𝕏

A draft typed and saved after the composer cleared is a different draft,
even when it starts with the admitted text; consumeDraft now compares the
saved text with the draft the input left from before stripping it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RQjxbg1n4c3xNJRpUaF1WL

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

✅ No new issues found.

Reviewed changes in 45696ea0 since the prior review at e316661f, with the full PR diff read for context.

  • Restricted mobile draft consumption to saved text matching the captured pre-send draft, preserving newer independent drafts that share the admitted prefix.
  • Passed the original draft snapshot through both iOS and Android admission paths while retaining settlement before the current-screen/client guard.
  • Extended both draft-store tests with newer same-prefix draft preservation and updated the implementation plan.

Validation: Changed Swift app/test sources parse successfully, and portable iOS checks pass (20 Ruby tests, 30 Node tests). Native XCTest requires macOS/Xcode. The focused Android test could not configure because Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention', version: '1.0.0'] was not found; its behavior was source-traced, not executed. Hosted CI on this head was still running when inspected.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@very-hermes-bot

very-hermes-bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Hermes review failed

Hermes could not produce a code-review verdict for this head SHA.

Engine: agy/gemini-3.8-flash-high
Review mode: full
Head: 45696ea051a39978e9fd42381e3d298066aede1c
Generated: 2026-10-21T09:49:31+00:00
Failure phase: engine

Safe summary:

Command '['/home/sambit1/.local/bin/agy', '--print-timeout', '30m0s', '--sandbox', '--add-dir', '/tmp/hermes-review-bot/aiden-agent-pr-576-45696ea051a3', '--model', 'gemini-3.8-flash-high', '--input-format', 'stream-json', '--output-format', 'stream-json', '--print', '']' timed out after 1920 seconds

Local logs: /home/sambit1/.hermes/logs/review-bot/aiden-agent.log

Copy link
Copy Markdown
Owner Author

The red "Hermes Review Bot" status on 45696ea is the local review bot's own engine timing out after 32 minutes (agy ... timed out after 1920 seconds), not a failure in this PR's code. It runs on the owner's machine, so it cannot be re-run from here. Pullfrog's review of the same head found no new issues, and the hosted CI run on this head is still in progress. Keeping the PR watched until CI reports.


Generated by Claude Code

@sambitcreate
sambitcreate merged commit a1508f1 into main Oct 21, 2026
25 of 26 checks passed
@sambitcreate
sambitcreate deleted the claude/project-thread-qbs790 branch October 21, 2026 09:48
sambitcreate pushed a commit that referenced this pull request Oct 21, 2026
Brings in #568 (MCP on pi-mcp, Aiden's connector catalog and Connectors
settings) and #576 (instant UI and optimistic updates on desktop Bots, iOS
and Android). Conflicts: the test:serial chain is a union (main dropped the
plugin catalog tests and plugins:refresh, this branch adds the Bot suites);
the Bot chat keeps the hand-off note path beside main's retry with one
request id per failed turn, and the person-paused card beside main's hidden
interrupted card; the test DOM and chat pane tests keep both sides.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FTLKrZsPKZM2hnxHVxEnak
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.

3 participants