mirror of
https://github.com/stablyai/orca.git
synced 2026-09-25 16:02:38 +00:00
`activateMobileSessionTab` gated only on `publicTab.status !== 'ready'`. A deliberately slept pane publishes as `pending-handle` indefinitely — indistinguishable at that call site from a pane awaiting reconnect — so the reconnect probe added by #11542 respawned it with a re-resolved agent launch, waking something the user had deliberately put to sleep. The first attempt refused activation for any pane with a `worktree-sleep` record, applied to every path. Independent review found that broke the documented wake gesture: opening the tab IS how those panes are meant to cold-restore (`wake-sleeping-agents-in-background.ts`: "Those panes cold-restore --resume when their own tab is opened"). A mobile tap sends the byte-identical call the reproduction test used, and in three of four topologies no wake clears the record first — so the tap became a permanent no-op with no feedback. This carries intent explicitly instead of inferring it. A new shared `TabActivationIntent` ('user' | 'automatic') rides the existing ActivateTab schema as an optional additive field; `isAutomaticTabActivation` returns true only for an explicit 'automatic', so an absent value is permissive BY CONSTRUCTION in one place — an older client that does not send it keeps today's behavior rather than silently losing its wake gesture. The field is required on the mobile helper's params, so no call site can be added without declaring who asked. Every user path (mobile tab switches, paired tab clicks, shortcuts, palette, the pane's own open) is labelled 'user'. The only automatic sender in the codebase is `waitForResubscribeHostSessionHandle`, the #11542 reconnect probe. Verified per topology: user activation materializes a parked pane under headless serve, a paired runtime client, a completed agent with restoreOnTabOpenOnly, and a running agent whose wake cleared the record. The automatic probe is refused without retiring the surface, and #11542's reconnect tests stay green. Also fixes a test fixture that made a real bug untestable: the store stub ignored the host id, so mutating the partition lookup to 'local' left the suite green. Correcting it exposed three existing SSH reattach tests that had been relying on that looseness — their workspace session sat in the local partition while their repo was SSH-hosted, a store production would never read. Production was always right; the tests described an impossible world. Fixes STA-3465.
19 lines
755 B
TypeScript
19 lines
755 B
TypeScript
export const TAB_ACTIVATION_INTENTS = ['user', 'automatic'] as const
|
|
|
|
/**
|
|
* Who asked for a tab activation: an explicit user gesture (opening the tab) or
|
|
* background machinery (a reconnect/recovery probe). Opening a tab is the
|
|
* documented way to wake a deliberately slept pane, so only an automatic
|
|
* activation may be refused for one.
|
|
*/
|
|
export type TabActivationIntent = (typeof TAB_ACTIVATION_INTENTS)[number]
|
|
|
|
/**
|
|
* Why: the field is additive on an existing method, so a client that predates it
|
|
* sends nothing. Absent must keep today's permissive behavior or those clients
|
|
* silently lose their wake gesture.
|
|
*/
|
|
export function isAutomaticTabActivation(intent: TabActivationIntent | undefined): boolean {
|
|
return intent === 'automatic'
|
|
}
|