Repository navigation
Agent Slider on the phone (Remote revision 68) - #927
sambitcreate wants to merge 15 commits into
Conversation
GET /models gains agentSlider (stops, home stop, each stop's fitted model and thinking-level resolution). Chats carry thinkingLevel, and a phone holding the opt-in chat:agent-slider capability saves its sent selection in the same write as the user message, so a refused send leaves nothing behind. Desktop server and aiden serve both wire it; aiden serve has no slider, so phones fall back to the model menu. Contract revision 66 must be rechecked against main at merge.
Negotiates chat:agent-slider alone, decodes agentSlider on the model catalog and thinkingLevel on chats, and checks the shared fixture through the real client. The Android slider UI is deferred.
The composer's model menu becomes a slider chip when the paired computer offers chat:agent-slider and the phone holds it. The sheet shows the computer's stops on a track, Reset to home and Other models; stops that can't run are shown but can't be chosen. Each send carries the stop the user saw, and stale catalog or chat loads never overwrite the current host or chat. The open sheet and the chosen stop live on the chat view model, so they survive an iPhone Duo fold. Settings gains a read-only Agent Slider page. Adds resolver unit tests, decoder and fixture tests on iOS and Android, a demo slider host and an XCUITest that sends on a chosen stop.
Server and contract (revision 66): - Only a phone pick the person made saves the chat's level: turns carry saveSelection, and the host saves only when the turn names a provider and model, the host has a slider, and the chat is not a Bot chat. - A saved level the model does not offer is fitted the way the desktop fits it, rather than refused; a model with no levels saves none. - Stop projection follows the phone catalog's allowlist: ids are sent only for ready stops, and the reason a stop can't run carries labels. - Android decodes the slider but no longer negotiates the capability, so its turns cannot overwrite a chat's stop. iOS: - A new chat starts on the computer's last model and level; Reset to home returns to the home stop. A late slider grant re-resolves a derived level. - The slider opens as a popover anchored on the composer chip at regular width and a sheet at compact width, and the open sheet and chosen stop survive a fold. - Reason texts never show raw ids; focus ring and accessibility fixes. - UI test starts from a cleared model preference and a demo chat on its home stop, so earlier runs can't decide the first stop.
…er-phone # Conflicts: # ios/CHANGELOG.md
There was a problem hiding this comment.
Important
An untouched new slider chat loses its default stop after the first authoritative refresh, and the iOS decoder accepts a malformed known-unavailable stop shape that the other revision-66 decoders reject.
Reviewed changes Reviewed the complete revision-66 diff and traced its model-selection authority through the desktop host, iOS, Android, fixtures, OpenAPI, and focused tests.
- Remote revision 66: Adds
chat:agent-slider, slider projection and availability, chat-level projection, fitted turn levels, and atomicsaveSelectionpersistence while leavingaiden serveunadvertised. - iOS slider experience: Adds capability negotiation, exact stop resolution, the composer chip and adaptive presentation, read-only Settings, fold-surviving state, demos, and behavioral coverage.
- Android and shared contracts: Adds tolerant Android decoding without negotiation, shared fixtures, OpenAPI definitions, protocol tests, and product/plan documentation.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…stop and chat contracts - A new chat's first send on the phone now carries saveSelection, because the host stores no level when it creates a chat; without it the chat came back off the stop it started on after the first message. The demo Mac now keeps a turn's level only with saveSelection, as the host does, and the slider UI test sends a plain follow-up that must stay on the chosen stop. - A slider that arrives after the catalog re-derives a new chat's selection from scratch, so a level fitted without the slider isn't kept. - The iOS stop decoder refuses ids or a level on a stop that isn't ready, as the TypeScript and Android decoders do; the demo's not-signed-in stop no longer sends a level. - OpenAPI Chat and ChatMessagesWindow refuse thinkingLevel with botId. - The sheet's chrome height scales with Dynamic Type and its fitted height only grows, so stepping between stops doesn't resize it under a finger. - Docs: the API doc's iOS client paragraph now covers the popover, Settings → Agent Slider, the phone's remembered pick and when saveSelection is sent; Settings copy, PROJECT_SPEC, CHANGELOG and the plan match. - Comment fixes: modelLabel can be the model id; two misplaced or badly wrapped Swift doc comments. --- Generated by Claude Code
There was a problem hiding this comment.
Important
A saved first-send retry can still lose the Agent Slider stop when the capability appears after the request was persisted.
Reviewed changes Reviewed the d1db649 fix round against the prior Pullfrog review, including the iOS first-send authority path, strict stop decoding, OpenAPI Bot exclusions, demos, tests, and corrected product documentation.
- Preserved fresh-chat stops: Added
saveSelectionto a newly constructed first turn, then exercised authoritative reconciliation and a plain follow-up. - Tightened revision-66 contracts: Rejected known unavailable iOS stop shapes carrying IDs or levels and aligned both OpenAPI chat projections with the Bot exclusion.
- Aligned client behavior and copy: Updated the demo host, settings copy, API guide, changelog, project spec, and plan status to match the implemented defaults and adaptive presentation.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…sure the sheet, skeleton Settings A new chat's first send saved before the Mac granted the Agent Slider has no saveSelection, and its retry must resend the same body under the same Idempotency-Key (the Mac answers a changed body with idempotency_conflict). Once that retry is accepted while the phone holds the slider, keep the chip's choice as the chat's unsent pick, so the chat stays on its stop and the next send asks the Mac to keep it. - The slider sheet's measured height shrinks as well as grows when the width or Dynamic Type size changes, and only grows within one layout. - Settings shows skeleton rows while the slider loads, keeps the loaded stops on Try again, and its footer says only a pick made in a new chat is remembered, stop or model. - The demo Mac serves the slider for a new chat, and a UI test covers a new chat's first send and follow-up on iPhone and Duo. - saveSelection doc comment, test doc placement, CHANGELOG, PROJECT_SPEC and the Remote API doc updated.
There was a problem hiding this comment.
Important
The retry fallback still loses the intended Agent Slider stop when a host-accepted first send is reconciled before its saved request is replayed.
Reviewed changes Reviewed the 215aca2 fix round against the prior Pullfrog review, including the late-grant retry state machine, compact-sheet remeasurement, Settings loading state, demo behavior, focused tests, and updated product documentation.
- Preserved immutable retry bodies: Kept a pre-grant retry request and idempotency key unchanged, then recorded the current chip selection as an unsent per-chat pick after acceptance.
- Remeasured adaptive sheets: Reset the fitted compact-sheet height when width or Dynamic Type changes while retaining grow-only sizing within one layout.
- Refined Settings loading: Replaced the spinner with accessible skeleton rows and retained a same-computer catalog during explicit reloads.
- Extended regression coverage and docs: Added the late-grant retry scenario and new-chat UI flow, then documented the immutable-body fallback across the Remote guide and iOS product records.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
Whether a send is a new chat's first send or carries an unsent pick is now decided once, when the send is built, and saved with its retry record (PendingSend.keepsSelection). A retry reads it instead of asking again, and its body and Idempotency-Key stay unchanged, since the Mac answers a changed body under the same key with idempotency_conflict. When such a send went out without saveSelection and the Mac accepts it once the phone holds the slider, the phone keeps the provider, model and level that turn carried as the chat's unsent pick, not the chip's current choice, which the slider's arrival may have re-resolved. A newer pick made while the send was out wins. The remembered pick is written only while the Mac's pairing is retained, the same check other installation-scoped writes use. Covered: a new chat's first send built before the phone knew of the slider, whether retried or sent before /models answered, that the Mac accepts once the phone knows of it, including when a refresh filled the chat before the retry was accepted. Not covered: a send the Mac accepted before the phone knew of the slider, and a send whose reply the phone never read (app quit after acceptance) whose saved retry is never sent. The chat then follows the Mac's level. Nothing new gates Send on the catalog or a host round-trip. Tests: the late-grant fixture now expects the stop its first turn ran on; new cases for a refresh before the retry is accepted and for forgetting the Mac during the retry. CHANGELOG, PROJECT_SPEC and the Remote API doc state the covered cases.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the aeaca72 fix round since the prior Pullfrog review, including the persisted retry intent, immutable-request fallback, host-retention fence, focused iOS state-machine coverage, and aligned product documentation.
- Persisted selection intent: Captured whether a send must keep its selection in
PendingSend.keepsSelectionand preserved it across manual, restored, and rate-limit retries. - Restored the actual turn selection: Reapplied the provider, model, and level carried by a late-granted immutable request after acceptance while allowing a newer phone pick to win.
- Closed the lost-reply ordering gap: Covered transcript reconciliation before retry acceptance and prevented a forgotten or re-paired host from retaining the recovered per-chat preference.
- Aligned documentation: Updated the Remote guide, iOS changelog, project specification, plan, and memory to describe the final retry semantics and intentional limitation.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Sol | 𝕏
…re the catalog A new chat's first send made before GET /models answered names the chat's model with no level, because the phone knew none, and the turn runs on the model's own setting. Holding that as the chat's pick after a late slider grant put the chat in Custom and made the next send save no level. For a model with levels the phone now holds the stop the chip resolved to from the catalog, or nothing in Custom; a turn with a level, or a model without levels, still holds exactly what the turn ran on. The fake Mac in the slider test now follows the real idempotency ledger: the same key with a different body is 409 idempotency_conflict, and a replay returns the original message id, so the chat shows the message once. A new test round-trips a saved retry's keepsSelection through the on-disk store. Docs: the API doc, CHANGELOG and PROJECT_SPEC describe the no-catalog case and that a retry saved by an earlier build reads as not keeping a level.
main now holds revision 66 (Bot feed preview) and 67 (Bot session pages), so the slider claims the next revision after main's. Every slider reference moves together: the host constant, packages/cli, iOS, Android, the contract fixture, openapi and docs/aiden-remote-api-v1.md. Pre-slider references that named 65 now name 67.
…er-phone # Conflicts: # android/app/src/test/java/sbtbiswas/AidenOnTheGo/AidenBackgroundJobsTest.kt # android/app/src/test/java/sbtbiswas/AidenOnTheGo/AidenBotAccessRequestsContractTest.kt # android/app/src/test/java/sbtbiswas/AidenOnTheGo/AidenBotPlanContractTest.kt # android/app/src/test/java/sbtbiswas/AidenOnTheGo/AidenRemoteClientTest.kt # docs/aiden-remote-api-v1.md # ios/AidenOnTheGoTests/AidenBackgroundJobsTests.swift # ios/AidenOnTheGoTests/AidenBotPlanTests.swift # ios/AidenOnTheGoTests/AidenBotSessionTests.swift # ios/AidenOnTheGoTests/AidenRemotePhase0Tests.swift # main/services/aiden-remote-protocol.test.ts # main/services/aiden-remote-protocol.ts # protocol/aiden-remote/v1/fixtures/contract.json
There was a problem hiding this comment.
Important
The new pre-catalog first-send recovery still drops the stop when the catalog arrives during the in-flight POST.
Reviewed changes Reviewed the changes since the prior Pullfrog review at aeaca72, including the no-catalog first-send fallback, retry persistence and idempotency fixture, the merge from main, and Remote revision 68 parity.
- Recovered pre-catalog first sends: Added
lateGrantedPick(for:)so a level-less request on a levels-bearing model can retain the stop resolved after the catalog arrives instead of persisting Custom. - Hardened retry state: Round-tripped
PendingSend.keepsSelectionthrough disk and made the fake host enforce immutable idempotency bodies plus replayed message identities. - Renumbered the Remote contract: Moved
chat:agent-sliderfrom revision 66 to 68 aftermainclaimed revisions 66 and 67, updating desktop, iOS, Android, fixtures, OpenAPI, tests, and docs together.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
… lands mid-POST A new chat's first send built before GET /models answered names no level. If the catalog and slider grant landed while its POST was still out, the optimistic message made the chat look populated, so resolution followed the chat's nil level into Custom and the acceptance hold gave up on a nil currentStop: nothing was kept and the next send saved no level. The send now captures its intent when it is built (startsWhereNewChatsStart, saved with the retry record) and keptSelection(for:) resolves it against the catalog on the chat as it was before its first message, never from chat state or the chip. resolveModelSelection applies the same intent while such a send is in flight or waiting to retry. A pick made meanwhile still wins (modelPickGeneration plus hasUnsentModelPick), a removed or re-paired Mac still keeps nothing, and Send is never held. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Important
The in-flight catalog fix still resolves a captured send intent from mutable cross-chat preference state.
Reviewed changes Reviewed the two commits since the prior Pullfrog review at e88bf15, covering the pre-catalog first-send intent state, its retry persistence, concurrent-pick fencing, the held catalog/POST regression test, and aligned revision documentation.
- Captured first-send intent: Added
startsWhereNewChatsStart,sendInFlight, and a pick-generation fence so catalog arrival during a successful first POST no longer resolves from the optimistic message. - Resolved the original race: Replaced
lateGrantedPick(for:)with catalog-based intent resolution against an empty chat and retained the resulting stop for the next saving send. - Extended ordering coverage: Held
/modelsand/turnsin the previously failing order, then asserted the chip, retained per-chat selection, authoritative reconciliation, and follow-upsaveSelectionrequest. - Aligned documentation: Recorded the revision-68 renumbering and the new pre-catalog send semantics in the Remote guide, iOS product records, plan, changelog, and project memory.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
| selectedProviderId: nil, | ||
| selectedModelId: nil, | ||
| selectedThinkingLevel: nil, | ||
| remembered: isReadOnlyFixture ? nil : modelPreferenceStore.selection(for: instanceId), |
There was a problem hiding this comment.
This rereads the shared per-host preference after the send was built, so startsWhereNewChatsStart does not freeze the original selection. If another new chat changes that preference while /models or the POST is outstanding, this chat can adopt the newer level or lose its retained stop instead of preserving this send's intent.
Technical details
# Freeze the original new-chat selection
## Affected sites
- `ios/AidenOnTheGo/Features/Chat/AidenChatViewModel.swift:1833-1835` — the pending send captures only a boolean intent.
- `ios/AidenOnTheGo/Features/Chat/AidenChatViewModel.swift:3020-3025` — resolution rereads mutable host-wide preference state; the provider/model guard cannot detect a same-model level change.
- `ios/AidenOnTheGo/Persistence/AidenModelPreferenceStore.swift:64-83` — another new chat can replace that shared preference while this send is outstanding.
## Required outcome
- Persist enough immutable intent with the pending send to resolve the new-chat selection that existed when the send was built, even if another chat changes the host-wide preference before catalog or POST completion.
- Keep a newer explicit pick in this chat authoritative and preserve retry-body/idempotency behavior.
- Add focused cross-chat ordering coverage for a preference change while the first send is outstanding.
Problem
The Agent Slider shipped on the desktop (#888, #889, #892, #893, #896), but phones still show the old model menu. A chat started on a phone can't pick a stop, and the Mac's per-chat thinking level isn't carried over Remote.
Change
Remote contract revision 68 (
chat:agent-slider) carries the Agent Slider to phones. It was written as 66 and renumbered to 68 in the 2026-11-25 merge ofmain, which had claimed 66 (Bot feed preview) and 67 (Bot session pages) first.saveSelection), the turn names a provider and model, the host has a slider, and the chat is not a Bot chat. Levels are fitted the way the desktop fits them, and a model with no levels saves null.packages/cli, with the fixtures, OpenAPI anddocs/aiden-remote-api-v1.mdupdated.saveSelectionon a new chat's first send and while a pick made on the phone is unsent. That is decided once, when the send is built, and saved with the retry record, so a retry keeps the same body and Idempotency-Key./modelsanswered names no level. The send captures its intent when it is built, before the optimistic message: the pick it carries, or, with none, where a new chat starts. For a model with levels, the phone resolves that intent against the catalog whenever the catalog arrives, even mid-POST, for the chat as it was before its first message. It never reads chat state or the chip. It keeps the resulting stop, or nothing if that lands on another model or in Custom, rather than a level-less pick, so the next send still saves a level./modelsanswered, including when the catalog lands while its POST is still out) that the Mac accepts once the phone knows of it. The phone keeps the provider, model and level that turn carried as the chat's unsent pick, not the chip's re-resolved choice, and the next send asks the Mac to keep it. This holds even if a refresh filled the chat before the retry was accepted. A newer pick wins, and nothing is kept for a Mac that is no longer paired.chat:agent-slideryet, so an Android reply can never overwrite a chat's stop. The Android UI follows later.ios/CHANGELOG.md, the Agent Slider plan anddocs/plans/README.md, and memory notes.Scope
Phone half (PR 5) of the Agent Slider plan.
Verification
npm run type-checkand thepackages/clitype-check pass.test:aiden-remote(protocol, router and service suites): 1503 passed, 0 failed, 2 skipped.test:ci-policy128/128.test:ios-release33/33 and the shipping-target check 14/14.testDebugUnitTeston an earlier head. The renumber changes only the expectedcontractRevisionin four Android tests.AidenChatTestsandAidenAgentSliderTests408/408 (serial). The new catalog-lands-mid-POST case failed on the e88bf15 code with 7 assertion failures and passes on a77c925. The r7 change is Swift-only plus docs, and touches no test registry.AidenChatTestsandAidenAgentSliderTests408/408 and the slider XCUITest (2/2) on iPhone. Earlier heads also ran the slider XCUITest on the closed iPhone Duo and iPad (regular width). In the first r5 run, one test (testAgentSliderStopIsSentExactlyAndAMacWithoutItKeepsTheModelMenu) failed with no assertion because the simulator failed to relaunch the test host. It passed alone and in a serial rerun of both suites.parity.test.mjs:2318, the Tailscale case inaiden-remote-service.test.ts, and anAidenBotPeersTestshang.e2e/inline-visuals.spec.ts:348, where theevaluatepromise was garbage-collected before it settled. The Linux arm64/x64 gate failures on that head follow from that one job. The spec doesn't touch the slider, and this push starts a fresh run.Screenshots
Before: a Workspace chat's composer shows the model menu. That's unchanged on Macs older than revision 68.
After (iPhone):
iPhone Duo, closed (compact):
Regular width (iPad; stands in for the Duo's open display), popover:
Review rounds
There were five adversarial review rounds plus Pullfrog. The round-2 fixes are in d1db649:
ready, matching the host and Android.thinkingLevelon Bot chats.Later rounds:
409 idempotency_conflict, and a replay returns the original message id), and a test round-trips a saved retry'skeepsSelectionthrough the on-disk store. Docs note that a retry saved by an earlier build reads as not keeping a level.PendingSend.startsWhereNewChatsStart, saved with the retry record), andkeptSelection(for:)resolves it against the catalog for the chat as it was before its first message. This replaceslateGrantedPick's dependence on chat state andcurrentStop.resolveModelSelectionapplies the same intent while that send is in flight or waiting to retry, so the chip shows the start stop at once. A pick made meanwhile still wins, now via a pick-generation counter as well ashasUnsentModelPick. A removed or re-paired Mac still keeps nothing, and Send is never held.Follow-ups
AI disclosure
Written with Claude Code agents. A person reviews before merging.
Checklist