Repository navigation
Phones show when a Bot is waiting on you (provisional revision 68) - #912
sambitcreate wants to merge 23 commits into
Conversation
… 68) A Bot's session state stays "running" while it waits on an approval, so phones showed "Working…" for a Bot that was actually waiting for the person. GET /bots summaries now carry needsYou: true, gated per device by the new bot:needs-you opt-in (Android's Bot decoder rejects unknown keys). The host reads the same signal its own Bot rows, host feed and Dock badge use, without reading transcripts, and drops it rather than failing the list if the read fails. iOS and Android negotiate the opt-in alone. Home rows read "Waiting for you" and stop showing as working; an approval the phone can see keeps "Needs your OK". The iOS inbox lists the Bot under Needs you. Revision 68 is provisional and is re-claimed at merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ
There was a problem hiding this comment.
Important
The iPhone Bots row currently replaces a phone-visible approval status with the generic Waiting for you label, contrary to the new client contract and Android behavior.
Reviewed changes the complete revision-68 diff was reviewed across the desktop host projection, Remote protocol and negotiation, iOS and Android clients, behavioral tests, shared fixture, OpenAPI schema, and documentation.
-
Capability and host projection — adds the audience-gated
bot:needs-youopt-in and computesneedsYoufrom the existing live Bot projection without transcript reads. -
Native client behavior — negotiates the capability independently on both phones, decodes the additive summary flag, suppresses working indicators, and adds iOS Inbox attention handling.
-
Contract and verification — advances the provisional contract revision, updates capability schemas and docs, and adds focused router, decoder, row, and Inbox coverage.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…thread-awyxuf-pr4
Mirror Android: a conversation waiting on an approval reads "Needs your OK" or "Waiting for your OK on your Mac" instead of the generic waiting line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review, I reviewed the iOS approval-precedence fix, its focused regression coverage, the accompanying changelog update, and the full current PR diff.
- Preserved approval-specific status — changed the iOS Bots row so a visible approval keeps
Needs your OKorWaiting for your OK on your Macinstead of being replaced by genericWaiting for youcopy. - Covered combined states — added row tests for answerable and Mac-only approvals with
needsYou, plus the existing-host path where an approval is visible without the new flag. - Kept platform behavior aligned — reused shared iOS copy and documented behavior that now matches Android’s established row precedence.
- Integrated the stacked base — merged the updated base without introducing a new net regression in the PR’s 41-file change set.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
…thread-awyxuf-pr4
…thread-awyxuf-pr4
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review, I reviewed the latest stacked-base merge and rechecked the full current PR diff.
-
Counted raw history pages — carried each page’s raw host entry count through the peer bridge so newer entry kinds filtered by this client still advance reconciliation correctly.
-
Bounded snapshot reconciliation — stopped same-epoch history re-reads after the previously loaded host range and preserved the raw cursor for the next manual Load older request.
-
Extended behavioral coverage — added mixed and all-unknown page assertions plus a follower regression test, updated the Remote guide, and passed the focused peer and follower suites with 39 tests.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
…thread-awyxuf-pr4
There was a problem hiding this comment.
Important
The stacked-base merge introduces a history reconciliation regression that can make a remote Bot chat display entries older than the range the person had loaded.
Reviewed changes since the prior Pullfrog review, I reviewed the latest stacked-base merge and rechecked the full current PR diff.
- Tracked raw history spans — Added
olderLoadedandolderHostSpanso filtered entry kinds still count toward the range represented by loaded pages. - Reconciled rewritten snapshots — Changed same-epoch rereads to stop at the oldest carried entry or the raw host span when that entry is gone.
- Expanded behavioral coverage — Extended the follower test for unchanged history and deletion of the oldest loaded entry, updated the Remote contract guide, and passed the 39 focused peer-operation and remote-Bot follower tests.
⚠️ Same-epoch reconciliation can expand the loaded range
When a rewrite removes entries and shifts the fresh snapshot boundary into a loaded page, the carried prefix keeps that page's full old host span. The reread then prepends entries older than the person's prior boundary, so the visible transcript can grow backward without another Load older messages action.
Technical details
# Preserve the prior loaded boundary when the snapshot window shifts backward
## Affected sites
- `renderer/lib/hosts/remote-bot-session.ts:291-299` — carrying only part of a loaded page still retains its complete aggregate `olderHostSpan`.
- `renderer/lib/hosts/remote-bot-session-follower.ts:232-264` — the reread requests that full span and stores the entire returned page before testing whether it contains the old boundary.
- `renderer/lib/hosts/remote-bot-session.test.ts:563-612` — coverage deletes the oldest loaded entry while leaving the snapshot boundary unchanged, but does not exercise a rewrite that moves the fresh boundary into the loaded page.
- `docs/aiden-remote-api-v1.md:1517` — the stated guarantee that rereads never go farther back than the kept range does not hold in this case.
## Required outcome
- A same-epoch rewrite must not add entries older than the oldest history the person had loaded when that boundary entry still exists.
- Cover a loaded `c,d` page followed by a fresh snapshot that starts at `d`; if the host page before `d` is `b,c`, reconciliation must retain `c` without introducing `b`.
## Suggested approach
- Retain enough boundary metadata to distinguish a partially carried page, and trim a reread page at the old boundary before folding it into the view.@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using GPT Sol | 𝕏
…thread-awyxuf-pr4
|
The review's "same-epoch reconciliation can expand the loaded range" finding was fixed in #910 by 805f572, and that fix is merged into this branch. The re-read now reads until it reaches the oldest kept entry and cuts everything older than it before the result is used. It also restores the view's previous Generated by Claude Code |
There was a problem hiding this comment.
Important
The latest stacked-base merge still expands a remote Bot chat beyond the history the person had loaded when the exact oldest entry is deleted, even if a later carried entry survives as a usable boundary.
Reviewed changes since the prior Pullfrog review, I reviewed the latest stacked-base merge, its same-epoch history reconciliation fix and tests, and the full current PR diff.
- Trimmed boundary-crossing pages — cut reread pages back to the prior oldest visible entry and restored the previous pagination cursor when that entry survives.
- Broadened missing-boundary rereads — added a bounded slack window so filtered host entries can still be traversed while searching for the old boundary.
- Expanded behavioral coverage — added a shifted-snapshot case, changed the deleted-boundary expectation, and updated the Remote contract documentation.
⚠️ A deleted boundary still expands loaded history
The new trim only recognizes the single oldest carried ID. If that entry is deleted while a later carried entry survives, the larger fallback window is accepted whole and prepends messages the person had not loaded; the updated test demonstrates the view growing from m3… to m1… without another Load older messages action.
Technical details
# Preserve a surviving loaded boundary
## Affected sites
- `renderer/lib/hosts/remote-bot-session-follower.ts:240-269` — the missing-boundary fallback now reads up to `span + carried` host entries.
- `renderer/lib/hosts/remote-bot-session.ts:358-360` — trimming happens only when the exact former oldest ID survives; otherwise the complete reread is returned.
- `renderer/lib/hosts/remote-bot-session.test.ts:603-610` — after deleting `m3`, the new expectation accepts `m1` and `m2` even though previously loaded `m4` survives.
## Required outcome
- When the exact oldest entry is gone, trim at the earliest surviving carried entry so reconciliation does not reveal older history automatically.
- Use the bounded approximate-span fallback only when none of the carried entries survive.@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using GPT Sol | 𝕏
…thread-awyxuf-pr4
|
Deleted-boundary review: fixed in #910 (e8eea76, merged into this branch as 7baa700). When the oldest kept entry is gone, the re-read is now cut back to the earliest kept entry the host still has, and Load older resumes from that entry, so nothing the person hadn't loaded is added. The bounded span fallback only stands when no kept entry survives. The mixed-version test now expects Generated by Claude Code |
…thread-awyxuf-pr4
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review, I reviewed the surviving-boundary reconciliation fix incorporated by the latest stacked-base merge, its focused regression coverage and documentation, and the full current PR diff.
- Trimmed at a surviving boundary — Changed same-epoch rereads to discard fetched entries older than the earliest carried entry the host still has when the exact oldest entry was deleted.
- Preserved explicit pagination — Kept
hasOlderandolderCursoranchored to that retained entry so discarded history returns only after the person chooses Load older messages. - Verified the regression path — Extended the follower test through the deletion and subsequent manual load; the focused 23-test suite and targeted ESLint both pass.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
There was a problem hiding this comment.
Important
The latest stacked-base merge adds an unbounded serial probe path when carried Bot history has been removed; bound this recovery work before merging.
Reviewed changes since the prior Pullfrog review, I reviewed the new kept-entry probe fallback, its continuation and trim behavior, the added hidden-entry regression coverage and documentation, and the full current PR diff.
- Probed retained history — Added one-entry existence checks when the bounded reread cannot reach the oldest carried entry through newer host entry kinds this Mac cannot show.
- Continued to a confirmed boundary — Changed reconciliation to read onward after a probe succeeds, then trim at the earliest retained entry the host still has.
- Covered wide hidden gaps — Added a regression where several unshown host entries separate retained messages and where the original oldest retained message is later deleted; the focused 24-test suite and targeted ESLint pass.
⚠️ Deleted carried histories trigger one remote request per entry
The fallback advances one retained ID for every operation_stale, while loaded history can span hundreds of entries. If a rewrite removes all carried entries, reconciliation performs hundreds of serial remote calls and leaves the provisional stale history in place until that chain finishes.
Technical details
# Bound retained-entry existence probes
## Affected sites
- `renderer/lib/hosts/remote-bot-session-follower.ts:285-297` — `probe(index + 1, ...)` issues one additional remote request for every deleted carried ID, with no request or entry cap.
- `renderer/lib/hosts/remote-bot-session.test.ts:512-533` — existing behavior demonstrates that one view can carry at least 300 loaded entries.
- `renderer/lib/hosts/remote-bot-session.test.ts:693-700` — the new case deletes only the first retained ID, so it does not exercise or bound the all-stale path.
## Required outcome
- Keep same-epoch recovery work within a fixed request or entry budget independent of the number of carried entries.
- Cover a rewrite where every carried ID returns `operation_stale` and assert the recovery request cap and settled view.
## Suggested approach
- Stop probing after a small fixed budget and settle with the bounded reread, or add one bounded host operation that can identify a surviving boundary without one round trip per retained entry.@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using GPT Sol | 𝕏
…thread-awyxuf-pr4
…thread-awyxuf-pr4
|
Probe budget review: fixed in #910 (3053180, merged here as 1652811). After a bounded re-read misses, the follower now asks about at most 8 kept entries ( Generated by Claude Code |
There was a problem hiding this comment.
Important
The latest stacked-base merge can still drop a loaded Bot entry when the host reorders it across a bounded reread page.
Reviewed changes since the prior Pullfrog review, I reviewed the latest stacked-base merge, its reordered-history helper and regression coverage, and the full current PR diff.
- Selected the host-order boundary — Changed reread trimming to use the first retained entry in the host's current order instead of the first match in the old order.
- Added reorder coverage — Added a direct-helper regression where two carried entries exchange order within one returned page.
- Kept the revision-68 feature unchanged — Confirmed the merge does not alter the current 41-file
bot:needs-youprotocol, host, mobile, fixture, or documentation diff.
⚠️ Reordered loaded entries can disappear across a page boundary
withRereadOlderRemoteBotEntries now chooses the first kept entry among the pages it receives, but the production follower stops fetching as soon as the old first kept entry appears. A still-present entry moved just before that page is therefore omitted from the replacement view, making previously loaded history disappear even though the host retained it.
Technical details
# Preserve reordered carried entries across bounded pages
## Affected sites
- `renderer/lib/hosts/remote-bot-session-follower.ts:260-278` — the reread settles immediately when `kept[0]` appears, before checking whether another kept ID moved earlier than that page.
- `renderer/lib/hosts/remote-bot-session.ts:363-365` — the new host-order boundary can consider only retained IDs that the follower actually fetched.
- `renderer/lib/hosts/remote-bot-session.test.ts:706-718` — the new direct-helper test injects both reordered entries into one page, bypassing the production stopping condition.
## Required outcome
- Keep a carried entry that moves earlier than the old first entry across a page boundary instead of dropping it from the visible transcript.
- Keep reorder recovery within a fixed request or entry budget independent of the number of carried entries.
- Add follower-level coverage where shown history is `[m3,m4,m5,m6]`, the host becomes `[m1,m4,u1,m3,m5,m6]`, and the first bounded read before `m5` reaches `m3` without `m4`; the settled view must still retain both reordered entries in host order.
## Suggested approach
- Do not treat finding the old first retained ID as sufficient proof that the reread has reached the earliest retained ID in the host's current order; continue or probe only within an explicit fixed recovery budget.@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using GPT Sol | 𝕏
…thread-awyxuf-pr4
|
Reorder across pages: fixed in #910 (3333387, merged here as be318fb). Reaching the old first kept entry no longer ends the re-read. Any kept entry not yet read back, whether removed or moved further back, is asked about within the same 8-probe budget, and reading goes on to each one the host still has. The cut stays at whichever kept entry comes first in host order. The new follower test is the case you gave: shown Generated by Claude Code |
There was a problem hiding this comment.
Important
The eight-probe cap can still discard retained Bot history; it needs a bounded fallback that does not classify unexamined entries as gone before merge.
Reviewed changes since the prior Pullfrog review, I reviewed the fixed probe budget, continued cross-page reorder recovery, new follower regressions, documentation update, and the full current PR diff.
- Bounded stale-history probes — capped retained-entry checks at eight requests so a rewrite cannot trigger one serial request per loaded entry.
- Continued reorder recovery — kept reading after finding the old boundary so a carried entry moved farther back can be recovered in current host order.
- Expanded follower coverage — added production-path cases for an all-stale carried range and a carried entry moved across the initial reread page.
- Integrated the stacked base — merged both reconciliation fixes without changing the 41-file revision-68 feature diff.
⚠️ The probe cap treats unexamined history as deleted
After eight operation_stale responses, ask() settles even though later carried IDs have not been checked. If a ninth carried entry still exists outside the bounded reread pages, reconciliation drops that host-retained message and can display reread entries older than the person’s previous boundary.
Technical details
# Preserve unprobed carried history when the recovery budget is exhausted
## Affected sites
- `renderer/lib/hosts/remote-bot-session-follower.ts:292-305` — the first eight unseen IDs are checked in old order, then the remaining IDs are implicitly treated as absent.
- `renderer/lib/hosts/remote-bot-session.ts:363-365` — when no checked kept ID appears in the reread, the bounded pages become the replacement without a retained boundary.
- `renderer/lib/hosts/remote-bot-session.test.ts:711-736` — the new cap test removes every kept ID and therefore cannot distinguish a genuinely all-stale range from a surviving ninth ID.
## Required outcome
- Keep recovery work within a fixed request or entry budget independent of the carried range.
- Exhausting that budget must not silently drop an unprobed entry that the host still retains or expose history older than the previously loaded boundary.
- Add a follower case where the first eight probed IDs are stale and a later carried ID survives outside the bounded reread pages; assert both the survivor and the prior history boundary.
## Suggested approach
- Use a bounded host operation that can classify multiple carried IDs, or settle conservatively when the client cannot prove that the remaining IDs are gone.@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using GPT Sol | 𝕏
…thread-awyxuf-pr4
|
Probe-cap fallback: fixed in #910 (cfac9e5, merged here as 934f9aa). The budget is still 8 questions. Once it runs out with kept entries unaccounted for, unprobed entries are no longer treated as gone. The follower drops the loaded part and returns to the snapshot's own state, and Load older starts again from there. It never shows a partial re-read as the loaded part. The bounded re-read stands only when every unread kept entry was confirmed gone within the budget. A new test keeps 12 entries, of which the host removed 10. The other 2 sit far back behind 60 entries this Mac can't show, and 2 new entries fall inside the bounded window. The result is the snapshot alone, and at most 8 probes are sent. The test fails without the fix. Generated by Claude Code |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review, I reviewed the conservative probe-budget fallback merged from the stacked base, its focused regression coverage and documentation, and the full current PR diff.
- Dropped uncertain carried history — changed budget exhaustion to discard the entire carried range and restore the fresh snapshot’s pagination state instead of presenting a partial reread as authoritative.
- Preserved bounded recovery — kept the eight-probe ceiling while ensuring surviving, unprobed entries remain available through an explicit Load older messages action.
- Covered the ambiguous survivor case — added a follower regression where retained entries survive beyond the bounded reread and verified the fresh tail plus
hasOlder; the focused 28-test suite passes. - Documented the fallback — updated the Remote API guide to state that exhausted recovery drops loaded pages and restarts pagination from the snapshot.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
Swift requires the helper's labelled arguments in declaration order, so issues has to come before needsYou. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ
…m/sambitcreate/aiden-agent into claude/project-thread-awyxuf-pr4
…thread-awyxuf-pr4
…m/sambitcreate/aiden-agent into claude/project-thread-awyxuf-pr4
|
Desktop tests (renderer-other) on cd7555c failed 1 CLI test: Generated by Claude Code |
…e made The third Bot was updated at 16:00 but created at 17:00, so the summary decoder rejected it before the test could check its row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes since the prior Pullfrog review, I reviewed the two iOS test-fixture corrections, the intervening stacked-base merges, and the full current PR diff.
- Corrected Inbox test syntax — reordered the
issuesandneedsYoulabeled arguments to match the Swift helper declaration. - Restored approval-row coverage — advanced the synthetic Bot timestamps so every summary satisfies the decoder’s
updatedAt >= createdAtinvariant and the approval-precedence assertions execute. - Integrated the stacked base — merged the updated base without changing the net revision-68
bot:needs-youfeature behavior.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
|
iOS build and simulator tests (Xcode 27, non-blocking) on 85e3ca9 failed Generated by Claude Code |
…b' into claude/project-thread-awyxuf-pr4
…thread-awyxuf-pr4
…thread-awyxuf-pr4
…thread-awyxuf-pr4
…thread-awyxuf-pr4

Requested by sbt · project thread
Stacked on #910 (which is stacked on #909 → #907 → #895). PR 4 of the "Fix Bots shown across Macs" plan. Release once the whole stack merges.
Problem
A Bot's session state stays
runningwhile it waits on an approval, so iPhone and Android showed "Working…" for a Bot that was actually waiting for the person. The Mac already knows the answer (needsYou, used by its own Bot rows, the host feed and the Dock badge), but phones never received it.Change
GET /botssummaries carryneedsYou: truefor a Bot the person owes an answer (approval, question, hand-off, access request, pending plan or issue). It is sent only to devices holding the new opt-inbot:needs-you, because Android's Bot decoder rejects unknown keys. The router readsbotLiveProjection().needsYou(no transcript read) four at a time; a failed read sends the list without the flag rather than failing it. Offered inserverCapabilitiesonly when wired; negotiation answers 404 otherwise. No/serverfeature token (list is at 32).AIDEN_REMOTE_BOT_NEEDS_YOU_CONTRACT_REVISION = 68(provisional, one constant to re-claim at merge), OpenAPIBotSummary.needsYou(const: true) and the capability in every capability enum, fixturecontractRevision68.bot:needs-youalone. Home row reads "Waiting for you" and isn't shown as working; the unified inbox lists the Bot under Needs you with that reason (after an issue count). An approval the phone can see keeps its own line.stream:snapshot-reasons), strict boolean decode, never written back when false. Home row reads "Waiting for you" and isn't working; "Needs your OK" stays when the phone sees the approval.aiden servedoesn't offer it yet; PR 5 wires the server.Screenshots
Not captured yet: this change is phone-only, and this cloud container has no iOS Simulator or Android emulator. The visible change is the Bots home row's second line reading "Waiting for you" without the working spinner. Screenshots need a run on a Mac with Xcode / an Android emulator before merge.
Scope
Host router, protocol, OpenAPI, fixture, iOS and Android clients, docs. No desktop UI change. Phones pick the flag up whenever they read the Bot list again; nothing new is pushed.
Verification
tsx --test main/services/aiden-remote-protocol.test.ts main/services/aiden-remote-state.test.ts(114 pass),aiden-remote-router.test.ts(125 pass, incl. new "revision 68: only a device holding bot:needs-you reads needsYou…" covering holder, older phone, unwired host, failed read), bot-peers/bots/bot-ux/host-feed/pairing suites (78 pass)tsc --noEmit, eslint on touched host files,npm run test:ci-policy(123 pass)testBotNeedsYouIsAnOptInNegotiatedAlone,testARunningBotWaitingOnThePersonNeedsYouInsteadOfWorking,testHomeRowSaysWaitingForYouWhenTheMacSaysTheBotNeedsThePerson; new Android tests inAidenBotHomeBehaviorTest(row line + decode). These run in CI only (no Xcode or Android SDK here). Revision asserts moved 67 → 68 across iOS and Android contract tests.AI disclosure
Written by Claude Code from the approved fix plan; reviewed by tests above.
Checklist
docs/aiden-remote-api-v1.md(capability row, revision 68 section),docs/aiden-on-the-go-remote-access.md,ios/PROJECT_SPEC.md,ios/CONTRACT_TESTS.md, iOS and Android changelogs,android/README.md,.memory/bot-chat-activity.mdGenerated by Claude Code