Repository navigation
iOS: Workspace Settings keep edits through a fold and save optimistically; cached workspace Git summaries - #928
sambitcreate wants to merge 20 commits into
Conversation
Workspace list, get, create and update now carry git {isRepo, branch?,
uncommitted?} for workspaces with a folder, read through the cached
GitService.info under one 1.5 s deadline. A failed or slow read leaves the
summary out and is aborted; no upstream, remote or path is projected and the
revision is unchanged. The desktop host and aiden serve are wired the same
way; the host feed stays Git-free and the API doc says so.
The cards keep their raised fill and card radius.
The button and confirm action read Forget all, the confirm title asks
"Forget everything {Bot} remembers?", a failure says "Memory wasn't
cleared. Please try again." and the unreadable-memory callout points at
Forget all. The action still clears both groups.
The sheet was driven by a Bool and a separate optional context; when the Bool won the race the sheet rendered empty. One Identifiable value now drives .sheet(item:), so the form always has its context. A UI test opens the sheet twice and checks the form each time.
The demo Bot advertises bot-memory-v1, so it now answers GET
/bots/{botId}/memory with both groups (one entry near the 500-character
cap) and POST .../memory/edits with the cleared view; the demo keeps no
state. AidenDemoHostsTests loads the page and Forget all through the
real client. Android's Bot memory description and load-failure strings
no longer name a Mac.
The iOS Bot chat composer reads "Message {name}" when nothing holds it.
"Meet your first Bot", "Start chat" and "Create my own" now match the
desktop on iOS and Android. Copy only.
Workspace list, get and update now read Git summaries from a stale-while-revalidate cache keyed by repository root. Reads run in the background under a concurrency limit, one per root, each with its own deadline, and back off after failures. Creating a workspace, the MCP workspace list and chat start never touch Git. A read that fails gives no git field rather than claiming the folder is not a repository, a detached HEAD omits branch, and long branch names are cut between code points. Desktop and the CLI server share the same wiring.
The Bot composer reads "Message {name}" on desktop and Android, as it
already does on iOS. Android says "your computer" wherever it meant the
paired computer, matching iOS; the Simulator strings, the shared activity
phase word and the mirrored desktop approval line keep "your Mac". The
Android memory load failure keeps a recovery hint, and the unreadable
memory callout reads "Choose Forget all to start {name}'s memory fresh."
on every client. Project memory notes now match the shipped copy.
Workspace Settings UI test launches like the rest of the shell suite and keeps its screenshot through AidenStateMatrix.keepScreenshot, which the Bot UX suite now uses too. The helper documents that TEST_RUNNER_AIDEN_SCREENSHOT_DIR on xcodebuild reaches the runner as AIDEN_SCREENSHOT_DIR.
The lane stores the newest edit's Task, each edit checks cancellation after waiting for the one before it, and an isolated deinit cancels the lane.
Each demo Bot machine keeps its memory and applies a delete, rewrite or Forget all with AidenBotMemory.applying, so other entries stay put, a stale entry answers 404 memory_entry_not_found and every edit moves the revision. Routes can now read the request body. The demo responder is checked Sendable: one Mutex holds its routes, holds, parked requests and logs, a parked request no longer keeps the responder alive, and delays use Task.sleep instead of a dispatch queue. The URL protocol's own state moves to a Mutex; it stays unchecked only because Foundation's URLProtocol base is not Sendable.
A fold between the split and the stack rebuilds the workspace detail and closes an open Workspace Settings sheet with its draft. The fix, shell-owned presentation and draft, is listed in the Duo plan's remaining work. The Phase 0 memory note now describes the stateful demo memory and the checked Sendable responder.
The shell now owns the Workspace Settings sheet and its unsaved draft and presents it above the split/stack switch, so folding an iPhone Duo, resizing an iPad window, or the workspace page rebuilding on a rename no longer closes the sheet or drops edits. A rename on the computer fills an untouched name and keeps an edited one, showing the computer's name under the field. The sheet closes when its workspace is removed or archived, its machine's pairing changes, or its page leaves every tab. Covered by shell-state unit tests, a hosted split/stack swap test, and an iPad window-width UI test.
The Remote workspace Git summary reader runs on its own GitService with the cache's read deadline as its per-command budget. A root folder's failure is recorded per folder and no longer overwrites a shared repository entry. A read past its deadline gives up its slot, at most eight at once; past that a stuck read keeps its slot until it ends. Documents the no-push follow-up.
…o memory replay Workspace Settings compares only the pairing lease, notes access and memory changes made on the computer, and Save now closes the sheet at once: the edit shows straight away, waits behind any change still on its way, and is put back if the computer refuses it. Removes the unused onRemoved callback and the dead memory-page deinit. The demo memory host gives a rewritten entry a new id and replays an answer for a repeated idempotency key.
…phase0 # Conflicts: # ios/CHANGELOG.md
There was a problem hiding this comment.
Important
Two concurrency edge cases can discard a queued iOS edit or exceed the Git cache's stuck-read guarantee; both should be addressed before merging.
Reviewed changes — I reviewed the complete 96-file diff, with emphasis on the iOS optimistic mutation lane, shell-owned settings draft, Git summary cache, Remote projections, demo responder, native contract consumers, and behavioral coverage.
- Workspace Settings continuity — The shell owns a lease-bound draft that survives split/stack rebuilds, follows host changes selectively, and dismisses when its workspace context disappears.
- Optimistic workspace saves — Owner-context edits update the machine list immediately, queue behind in-flight mutations, reconcile failures, and bridge revisions across repeated saves.
- Cached Git summaries — Desktop and CLI serve background stale-while-revalidate summaries with repository-root sharing, timeout abandonment, concurrency limits, folder-specific backoff, and MCP opt-out.
- Demo and memory behavior — The synchronized iOS demo responder now handles request bodies and idempotency keys, serves mutable Bot memory, and the memory edit lane retains submitted work after navigation.
- Cross-client polish — Desktop, iOS, and Android align Bot composer and memory copy; Android generalizes host wording; iOS updates the memory icon and Usage cards; docs and focused tests follow the behavior.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
…ilure notices Workspace Settings saves now go through one serial lane per workspace: edits show at once as an overlay on what the computer last confirmed, are sent one at a time in the order made, chain each revision from this phone's own answers (including a save confirmed only by a list re-read), and a stale list never undoes a newer edit. Only confirmed copies are persisted. A refused save falls back to the baseline under newer edits and leaves a dismissible inline notice with an error haptic instead of an alert. Remove waits for a save on its way. Footer attribution compares confirmed copies only. The git cache also skips a folder whose read is still in flight.
There was a problem hiding this comment.
Important
Removal is not fully serialized with the new save lane, so a save made while Remove is waiting can race the DELETE and surface a false failure.
Reviewed changes — I incrementally reviewed the new per-workspace save queue, confirmed-baseline overlay, failure notices, removal ordering, and the Git-cache follow-up since the prior Pullfrog review.
- Queued workspace saves — Replaced global mutation waiting with a FIFO lane per pairing and workspace, coalesced compatible unsent edits, and chained both direct and reconciled revisions.
- Confirmed optimistic state — Split host-confirmed workspaces from versioned optimistic edits, prevented stale list reads from restoring superseded revisions, and persisted only confirmed copies.
- Failure and removal behavior — Added dismissible per-workspace failure notices, error haptics, rollback beneath newer edits, and a removal wait for queued saves.
- Git-cache deduplication — Added folder-level in-flight tracking so a timed-out nested workspace cannot start a second read after its repository-root alias is removed.
- Behavioral coverage — Added focused tests for save ordering, stale lists, ambiguous-success revision chaining, failure rollback, removal waiting, and nested Git-cache timeout deduplication.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏
| // A removal waits for this phone's saves of the workspace, then goes | ||
| // against the revision their answers left. | ||
| let lane = workspaceSaveLanes[Self.workspaceSaveLaneKey(context, workspaceId: workspace.id)] | ||
| _ = await lane?.tail?.value |
There was a problem hiding this comment.
This awaits only the tail that existed before the suspension. Because the Settings sheet remains active, a later Save can replace lane.tail; when the original task completes, that PATCH and this DELETE can both proceed against the same confirmed revision, so either user action can fail depending on request order.
Technical details
# Serialize removal with saves enqueued while it waits
## Affected sites
- `ios/AidenOnTheGo/Features/Remote/AidenRemoteCoordinator.swift:823-835` — each new save replaces `lane.tail` without consulting the removal path.
- `ios/AidenOnTheGo/Features/Remote/AidenRemoteCoordinator.swift:949-960` — removal snapshots one tail and one `ownRevisions` list before starting DELETE.
- `ios/AidenOnTheGoTests/AidenOwnerRoutingTests.swift:532-550` — coverage enqueues the save before removal, so it cannot expose a later tail replacement.
## Required outcome
- Once removal starts waiting, a save enqueued before DELETE must either be included in the serialization barrier or refused; PATCH and DELETE for one workspace must never run concurrently.
- Add coverage that enqueues another save while removal is suspended on an earlier tail and verifies request order and revision chaining.
Problem
The new-direction iOS pass (Phase 0) found a set of rough edges across iOS, the server and Android:
Change
iOS: Workspace Settings
.sheet(item:)over anAidenWorkspaceSettingsDraft, so it always opens with its form.iOS: other fixes
Server: workspace Git summaries
git status.GitService, with the cache's 15 s read deadline as its per-command budget.Android
bot_activity_computerstill say "Mac" on purpose.Docs
docs/aiden-remote-api-v1.mdanddocs/aiden-on-the-go-remote-access.md.docs/plans/aiden-on-the-go-plan.md(the no-push follow-up),docs/plans/ios-iphone-duo-plan.md, and thedocs/plans/README.mdrow, which now records iOS: iPhone Duo layout, fold continuity, ink accent and card lists #880 as shipped and this follow-up as in review.ios/CHANGELOG.mdand.memory/ios-new-direction-phase0.md.Contracts: no Remote wire or protocol revision change.
Screenshots
Before: Workspace Settings could open blank.
After, iPhone: it opens with its form on the first open and on every later one.
After, iPhone Duo inner display (regular width):
After, iPad:
Bot composer placeholder and the Usage page in the demo:
No screenshot shows the "changed on your computer" footer notes, because no demo path triggers them.
AidenAppShellTestscovers them.Scope
A follow-up to the iPhone Duo work in #880.
Verification
Each item below says what was run and what was seen.
iOS (own simulator and
-derivedDataPath, Xcode 27.1):AidenOwnerRoutingTests,AidenAppShellTests,AidenDemoHostsTestsafter review round 3: 234/234 passed.AidenShellUITests/testWorkspaceSettingsOpensWithItsFormEveryTime(now also checks Save closes the sheet) passed on the iPhone and the iPhone Duo simulators.AidenOwnerRoutingTests.testASendCaughtBeforeItLeavesKeepsItsWords("The send left first"). It passed on rerun. This existing test races on a singleTask.yieldand is not touched here; it is recorded as flaky.Server:
npx tsx --test main/services/aiden-remote-workspace-git-cache.test.ts main/services/aiden-remote-workspaces.test.ts main/services/git.test.ts: 145/145 after the merge.git.test.tspush and timeout tests failed. A different one failed on each run: "freezes the reviewed push endpoint…", "reconciles a timeout after the exact branch ref…", "recognizes a candidate in branch ancestry…", "leaves the remaining-change count unknown…", "rechecks cancellation after post-push branch reads…" and "preserves an unknown push outcome…". They all pass when the file runs alone, and this PR doesn't touch those paths. They are recorded here as load-sensitive.npx tsc --noEmit -p tsconfig.json: clean.npm run test:ci-policy: 123/0.check-ios-shipping-target: 14/0.Android: gradle unit tests, 1397 passed.
AidenModelPickerUiTestwas updated for "Computer default".Desktop E2E (Cua Space):
tests/e2e/keep-going-goals.spec.ts:215failed once and passed on rerun. It is recorded as flaky; this PR only changes copy that spec reads.Known limits:
testWorkspaceSettingsKeepTheirEditsWhenTheWindowChangesWidthskips after the edit, because windows don't resize on the local iPadOS 27.0 simulator. The hosted split/stack swap test inAidenAppShellTestscovers the same continuity.Review rounds:
Deferred follow-ups:
AI disclosure
An AI coding agent wrote this change under the owner's direction. The owner reviews it before merge.
Checklist