Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7958615
Load older messages and take back a queued message in a paired Mac's …
claude Nov 24, 2026
f6f3a59
Keep the older-page cursor only while the session has older entries
claude Nov 24, 2026
6e36dde
Merge branch 'claude/project-thread-awyxuf-pr3' into claude/project-t…
claude Nov 24, 2026
90270d6
Merge branch 'claude/project-thread-awyxuf-pr3' into claude/project-t…
claude Nov 24, 2026
85123b3
Fence remote Bot paging against rewrites and decide queued ownership …
claude Nov 24, 2026
e8c218b
Re-read all carried Bot history across a snapshot, a bounded page at …
claude Nov 24, 2026
9ff3054
Count a newer host's unshown entries when re-reading kept Bot history
claude Nov 24, 2026
17dd210
Re-read kept Bot history to its oldest entry, bounded by the host spa…
claude Nov 24, 2026
805f572
Cut a Bot history re-read back to the oldest kept entry
claude Nov 24, 2026
e8eea76
Trim a re-read at the earliest kept Bot entry the host still has
claude Nov 24, 2026
29460b4
Read kept Bot history back to the earliest entry the host still has
claude Nov 24, 2026
b646dab
Trim a Bot history re-read at the kept entry that comes first now
claude Nov 24, 2026
3053180
Ask the host about at most 8 kept Bot entries after a re-read misses
claude Nov 24, 2026
3333387
Read back a kept Bot entry the host moved further back
claude Nov 24, 2026
cfac9e5
Drop loaded Bot history rather than guess when re-read questions run out
claude Nov 24, 2026
542d584
Resume the recording card on the main thread in its ownership UI test
sambitcreate Nov 24, 2026
f68566c
Hop to the main thread through withContext in the recording ownership…
claude Nov 24, 2026
73ab980
Restore the post-and-resume main-thread hop in the recording ownershi…
sambitcreate Nov 24, 2026
5d4788b
Merge remote-tracking branch 'origin/claude/project-thread-awyxuf-pr3…
sambitcreate Nov 24, 2026
f7fcd5a
Merge branch 'claude/project-thread-awyxuf-pr3' into claude/project-t…
claude Nov 24, 2026
bfce1ff
Merge branch 'claude/project-thread-awyxuf-pr3' into claude/project-t…
claude Nov 24, 2026
b6cb17c
Merge branch 'claude/project-thread-awyxuf-pr3' into claude/project-t…
claude Nov 24, 2026
f771efc
Merge branch 'claude/project-thread-awyxuf-pr3' into claude/project-t…
claude Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .memory/bot-chat-activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ If `main` has moved past 29, change every `30` D introduced to the next free rev
### Parked (full list in spec §17)
- Pre-merge bug sweep (PR #479 review and follow-ups), done: Remote — `model_error` is a 409 state refusal (bbd13274e); snapshot and every frame fit the 1 MiB SSE limit by priority allocation (f78443bae, 7aebccfe5). iOS — Chat activity picks stay with their pairing (25574c1ae); a send before the outbox restore never replaces the last launch's file (cc7ae5c6b); Try Again replays the frozen Create through a catalog change (9a2feca96); outbox diagnostics through the typed wrapper (65e00968b); a restore landing after an access-loss purge is dropped (7744dd31b); a New Bot cut off by a relaunch comes back with Try Again (9685204a9, 89b91a071); Files sheet skeletons (7eddc5be8); bounded test waits (d4d63580d); Chat activity reports after leaving and keeps a pick made during a timed-out save (4030c06a5, 978caa670). Android — a restore after an access-loss purge is dropped (e0202df7a); unconfirmed edits never reach the Bot cache's disk (6352bfbad); null literals refused (ea29ffe2f); optimistic New Bot with a Creating… row and same-key Try again, surviving process death (c47d018f6, 212f69254, e348b0131); scheme-derived error text at ≥4.5:1 (4de4bf33f). Test harness — the core-git EPIPE race (3d3cbc959).
- Still open: a manual VoiceOver/TalkBack pass and an end-to-end run against a real Mac on this branch.
- Overlapping Stops where one fails briefly clear "Stopping" (cosmetic). No Remove for queued messages on phones (no Remote withdraw route). Chat activity picks have no durable queue.
- Overlapping Stops where one fails briefly clear "Stopping" (cosmetic). No Remove for queued messages on phones yet (revision 67 added the route; only the desktop uses it). Chat activity picks have no durable queue.

### Bots across Macs (2026-11-24)
- PR 1 (#895, desktop only): paired Mac's Bot rows show the feed's avatar, Needs you over Thinking over stop status, never the description; `ChatSidebar` owns `usePeerHostSidebar` so feeds stay live on the Bots page; remote Bot chat only treats 404/403 as gone.
- PR 2 (Remote revision 66, provisional; re-claim at merge): host-feed Bot rows (`HostFeedBot` in openapi.json, `parseAidenRemoteHostFeedBot`) carry an optional one-line `preview` (140 characters, no control or format characters) and always come from `BotLiveProjection.summary` (`inboxSignals` was removed). New peer binary operation `botAvatar` (`GET /bots/{botId}/avatar/{assetRevision}`) fetches photo avatars for the row and chat title. Unread dots for remote Bots are a per-device record in local storage (`renderer/lib/remote-bot-seen.ts`, key `aiden-agent.remote-bots-seen.v1`, record version 2). Every time in it is the host's, never this Mac's clock: a per-host baseline (the newest `lastReplyAt` when this Mac first lists that host's Bots, so existing replies start read) and per-Bot seen times. A reply counts as seen only once the remote chat's session view shows it (`remoteBotShownReplyAt`), not when its row is selected. The host baseline is taken only from a listing whose every row is `summarized: true` (proof of revision 66, and no Bot whose summary read failed is left out; `summarized` marks every row whose summary the host read, so a host whose Bots are all still empty gets baseline 0 and their first reply shows a dot), since an older host sends `lastReplyAt` only for open feeds. Host feed Bot signals are cached per Bot (`createHostFeedBotSignalsCache` in `aiden-remote-host-feed.ts`) and invalidated by that Bot's `bots:changed` / `bots:attention`; `onBroadcast` forwards only the `botId` of a `bots:*` payload.
- PR 3 (desktop only, no revision): the desktop asks for `bot:cards`, `bot:access-requests` and `bot:plans` (each `own_call`, only when the host lists them) and answers them through new peer ops `botRespondRoutineProposal`, `botAnswerAccessRequest`, `botRespondPlan`. `remote-bot-session.ts` maps plan/access frames onto `snapshot.plan`/`accessRequest` (plan items get place ids; `revision` is a hash of what the card shows, so re-reading the same plan keeps the card mounted) and memory/routine entries onto local rows. `RemoteBotChatView` puts access and pending plan cards in the Needs-you slot, an active plan in the body, echoes sends at once (shared `BotPendingSend` helpers from bot-chat-pane) and shows a re-pair hint group for old pairings (`remoteBotGroups`). Host: `AidenRemoteBotService.list()` leaves out (and logs by id) a Bot whose summary fails the contract instead of failing the whole list (and the host feed); a transient summary read error fails the list so clients keep their last rows.
- Still to come: PR 3b (load older, remove a queued message, every waiting approval; next revision), PR 4 (phones show Needs you), PR 5 (headless server sends the same Bot signals). Not planned yet: a model picker for a remote Bot with a model problem (no remote route sets a Bot's model).
- PR 3 follow-up: `peerBotSessionCompat` dropped `accessRequest` and `plan` from session reads, so a reload lost the card; both are now kept (an unreadable one becomes null).
- PR 3b (Remote revision 67, provisional; re-claim at merge): `GET /bots/{botId}/session/entries?before=&limit=` (projector `olderEntries`, same audience as the snapshot; unknown `before` = 409 operation_stale) and `POST /bots/{botId}/queued/{submissionId}/withdraw` (needs `bot:activity`; routine/intro inputs read `gone`; runtime gained `withdraw`). No feature tokens: the server feature list is at its 32-token cap, so the desktop treats a 404 as an older host. Peer ops `botSessionEntries`, `botWithdrawQueued`; the follower's `loadOlder` + `carryOlderRemoteBotEntries` keep loaded pages across same-epoch snapshots. "Every waiting approval" was dropped: the next approval already follows each answer, and a count would need a new opt-in because phone approval decoders are strict.
- Still to come: PR 4 (phones show Needs you), PR 5 (headless server sends the same Bot signals). Not planned yet: a model picker for a remote Bot with a model problem (no remote route sets a Bot's model).

8 changes: 8 additions & 0 deletions .memory/browser-recordings-chat-and-phones.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ Status (2026-10-27): implemented on branch `claude/project-thread-p5v2my-browser
- iOS local validation: focused 10 recording checks pass; broader AidenChatTests, AidenRemoteClientTests and AidenBrowserRecordingOwnershipTests run 519 tests with zero failures and the three existing physical-device-only checks skipped. Destination: dedicated iPhone 17 / iOS 26.5 simulator `DD3ECACB-4B94-41F8-AC36-E559833ADC03`. Physical-device playback/Keychain acceptance is not claimed.
- Initial local checks caught a Swift actor-isolated default initializer and Android comment indentation; corrected without suppressions or policy changes. One Android instrumentation attempt was interrupted by my own queued force-stop while diagnosing the slow first emulator startup; the subsequent unchanged six-case run passed. Final diff review caught a callback/method name collision in the Android owner; the five release-path tests failed on that compiled intermediate candidate (the cancellation control passed), and the callback was renamed before rebuilding. This was a deterministic implementation failure, not a flaky rerun. Final checks are recorded in the PR checkpoint.
- Final checkpoint validation: Android full JVM suite 1,120 tests / zero failures; all six production lifecycle instrumentation cases pass on the corrected binary, with Kotlin app/test compilation and `lintDebug` passing. Broader iOS results are 516 passes plus the three configured physical-only skips (519 total), zero failures. Final source/test/docs review and diff checks pass; fresh `origin/main` remains `9b2875d65f316265323d3d06a73904fbe00e2277`. No retry, timeout, lint baseline or failure-policy weakening. PR remains open for root's exact-head CI and merge decision.

## 2026-11-24: Android ownership UI test race (found on PR #910 CI)

- `AidenBrowserRecordingOwnershipUiTest.replacingCardReleasesOldDeliveryAndOwnsTheNextOne` failed once in hosted CI (run 45362691722, job 138337222924) with a bare `AssertionError` from `eventually`. The PR it ran on changed no Android app code.
- Cause was the test harness, not the card. `createComposeRule()` runs composition coroutines on an unconfined test dispatcher, so the card's Play continuation (`owner.adopt`, `playing = file`) ran on the `Dispatchers.IO` worker that finished the download. The test's `runOnMainSync {}` therefore did not wait for it, and a main-thread disposal could run between adopt's `disposed` check and its `owned` assignment, leaving the file unreleased. On a device the card resumes on the main thread.
- Logging showed the delivery on `DefaultDispatcher-worker-*`. A temporary 300 ms pause in `adopt` when it was off the main thread turned four of the six cases red, with the same `eventually` symptom.
- Fix (test only): the test's `load` hops back to the main thread before handing over the result. It uses a hop that always suspends and ignores cancellation, so late delivery after disposal is still exercised. Do not use `suspendCoroutine` with a posted resume for this: it can resume before suspending and stay on the worker. Production code is unchanged.
- `withContext(NonCancellable) { withContext(Dispatchers.Main) {} }` was tried as a replacement (f68566c49) and does not hold. With the same off-main probe, 10 of 13 adopts ran on the worker and 3 or 4 of the 6 cases failed on each run: the empty main-thread block usually finishes before the caller suspends, so the caller continues on the download thread. The `suspendCoroutineUninterceptedOrReturn` post-and-resume hop puts 15 of 15 adopts on main.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package sbtbiswas.AidenOnTheGo.features.chat

import android.content.Context
import android.os.Handler
import android.os.Looper
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -43,6 +45,10 @@ import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.Executors
import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.TimeUnit
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
import kotlin.coroutines.intrinsics.intercepted
import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
import kotlin.coroutines.resume
import javax.net.ssl.KeyManagerFactory
import javax.net.ssl.SSLContext
import sbtbiswas.AidenOnTheGo.auth.InMemoryAidenSecureStore
Expand All @@ -58,6 +64,7 @@ class AidenBrowserRecordingOwnershipUiTest {
@get:Rule
val compose = createComposeRule()
private val instrumentation get() = InstrumentationRegistry.getInstrumentation()
private val mainThread = Handler(Looper.getMainLooper())
private val visible = mutableStateOf(true)
private val releaseFiles = CopyOnWriteArrayList<File>()
private val requested = CountDownLatch(1)
Expand Down Expand Up @@ -144,6 +151,7 @@ class AidenBrowserRecordingOwnershipUiTest {
// transfers a real file; the disposed owner must reject it.
withContext(NonCancellable) { model.browserRecording(recording) }
} else model.browserRecording(recording)
continueOnMainThread()
resultFile = (loaded as? AidenBrowserRecordingLoad.Ready)?.recording
delivered.add(loaded)
loaded
Expand Down Expand Up @@ -188,6 +196,23 @@ class AidenBrowserRecordingOwnershipUiTest {
}
}

/**
* The test composition's dispatcher is unconfined, so the card would otherwise adopt its
* file on the download thread, racing its main-thread disposal and finishing after
* [finishWithoutFrame]'s main-thread sync. On a device the card resumes on the main thread.
* Ignores cancellation, so a late delivery still reaches the disposed owner.
*
* This always suspends and is always resumed by the posted main-thread task. A
* `withContext(Dispatchers.Main) {}` hop is not enough: when its empty block finishes before
* the caller suspends, the caller keeps the result and carries on on the download thread.
* Resuming from main while the download thread is still returning COROUTINE_SUSPENDED is the
* ordinary dispatcher handoff; nothing runs on that thread after the return.
*/
private suspend fun continueOnMainThread(): Unit = suspendCoroutineUninterceptedOrReturn { continuation ->
mainThread.post { continuation.intercepted().resume(Unit) }
COROUTINE_SUSPENDED
}

private fun startPaused() {
compose.mainClock.autoAdvance = false
compose.onNodeWithText("Play").performClick()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class AidenBackgroundJobsTest {
* person stopped, or a reason this version does not know, reads as plain Stopped. */
@Test
fun aJobStoppedAfterTheChatWentQuietSaysSo() {
assertEquals(66, contract.getValue("contractRevision").jsonPrimitive.int)
assertEquals(67, contract.getValue("contractRevision").jsonPrimitive.int)
val list = contract.getValue("backgroundJobsChatSettled").jsonObject.getValue("list")
val decoded = AidenBackgroundJobs.decode(list.toString())
val labels = decoded.jobs.associate { it.id to AidenBackgroundJobCopy.status(it, start) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AidenBotAccessRequestsContractTest {
private fun frame(element: JsonElement) = AidenBotSessionEventStream.decodeFrame(element.toString().toByteArray(), "bot_fixture_01")

@Test fun canonicalCardsSessionFramesIssuesAndLegacySettlement() {
assertEquals(66, root.getValue("contractRevision").jsonPrimitive.int)
assertEquals(67, root.getValue("contractRevision").jsonPrimitive.int)
assertEquals("bot:access-requests", fixture.getValue("capability").jsonPrimitive.content)
val folder = AidenBotAccessRequest.parse(fixture.getValue("folder"))
val mac = AidenBotAccessRequest.parse(fixture.getValue("wholeMac"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AidenBotPlanContractTest {
assertNull(plan.items.first().used); assertNull(plan.items.first().max)
}
@Test fun canonicalSnapshotAndOrderedPlanFramesDecode() {
assertEquals(66, root.getValue("contractRevision").jsonPrimitive.int)
assertEquals(67, root.getValue("contractRevision").jsonPrimitive.int)
val session = wire.decodeFromJsonElement(AidenBotSession.serializer(), fixture.getValue("session"))
assertEquals(0L, session.seq)
assertHostFolderReview(requireNotNull(session.plan))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ class AidenRemoteClientTest {
@Test
fun streamSnapshotReasonsDecodeSharedFixtureRejectInvalidReasonsAndNegotiateSolo() = runBlocking {
val fixture = contractFixture()
assertEquals(66, fixture.getValue("contractRevision").jsonPrimitive.int)
assertEquals(67, fixture.getValue("contractRevision").jsonPrimitive.int)
val section = fixture.getValue("streamRecovery").jsonObject
assertEquals("stream:snapshot-reasons", section.getValue("capability").jsonPrimitive.content)

Expand Down
Loading
Loading