Skip to content

The agent that grows with you

Merge remote-tracking branch 'origin/main' into ethie/pm-clean

ethernet9de3d9fdaa3f
diff --cc apps/desktop/src/store/session-states.test.ts
index 1bb5e4a0e73,731862473dc..ea676383642
--- a/apps/desktop/src/store/session-states.test.ts
+++ b/apps/desktop/src/store/session-states.test.ts
@@@ -261,6 -262,58 +262,76 @@@ describe('resetTileRuntimeBindings', (
})
})
++function runtimeBindingDelegate(
++ dropRuntimeBindings: (storedSessionIds: ReadonlySet<string>) => void,
++ invalidateRuntimeBindings: (preserveStoredSessionIds?: ReadonlySet<string>) => void
++): SessionTileDelegate {
++ return {
++ archiveSession: vi.fn(),
++ branchSession: vi.fn(),
++ deleteSession: vi.fn(),
++ executeSlash: vi.fn(),
++ interruptSession: vi.fn(),
++ resumeTile: vi.fn(),
++ submitToSession: vi.fn(),
++ updateSession: vi.fn(),
++ dropRuntimeBindings,
++ invalidateRuntimeBindings
++ }
++}
++
+ describe('resetRouteOwnedTileRuntimeBindings', () => {
+ afterEach(() => {
+ $sessionTiles.set([])
+ })
+
+ it('drops only tiles owned by the reopened route and leaves ambient tiles bound', () => {
+ const invalidateRuntimeBindings = vi.fn()
+ const dropRuntimeBindings = vi.fn()
- setSessionTileDelegate({ dropRuntimeBindings, invalidateRuntimeBindings } as unknown as SessionTileDelegate)
++ setSessionTileDelegate(runtimeBindingDelegate(dropRuntimeBindings, invalidateRuntimeBindings))
+ $sessionTiles.set([
+ {
+ ownerRoute: { connectionId: 'local', mode: 'local', profile: 'writer', targetProfile: 'writer' },
+ runtimeId: 'runtime-writer-bot',
+ storedSessionId: 'stored-writer-bot',
+ workspaceMode: 'bots'
+ },
+ {
+ ownerRoute: { connectionId: 'local', mode: 'local', profile: 'coder', targetProfile: 'coder' },
+ runtimeId: 'runtime-coder-bot',
+ storedSessionId: 'stored-coder-bot',
+ workspaceMode: 'bots'
+ },
+ { runtimeId: 'runtime-ambient', storedSessionId: 'stored-ambient' }
+ ])
+
+ resetRouteOwnedTileRuntimeBindings({ connectionId: 'local', profile: 'writer' })
+
+ const [writerBot, coderBot, ambient] = $sessionTiles.get()
+
+ expect(writerBot).toMatchObject({ storedSessionId: 'stored-writer-bot' })
+ expect(writerBot).not.toHaveProperty('runtimeId')
+ expect(coderBot).toMatchObject({ runtimeId: 'runtime-coder-bot' })
+ expect(ambient).toMatchObject({ runtimeId: 'runtime-ambient' })
+ expect(dropRuntimeBindings).toHaveBeenCalledWith(new Set(['stored-writer-bot']))
+ expect(invalidateRuntimeBindings).not.toHaveBeenCalled()
+ })
+
+ it('is a no-op when no open tile belongs to the reopened route', () => {
+ const invalidateRuntimeBindings = vi.fn()
+ const dropRuntimeBindings = vi.fn()
- setSessionTileDelegate({ dropRuntimeBindings, invalidateRuntimeBindings } as unknown as SessionTileDelegate)
++ setSessionTileDelegate(runtimeBindingDelegate(dropRuntimeBindings, invalidateRuntimeBindings))
+ const tiles = [{ runtimeId: 'runtime-ambient', storedSessionId: 'stored-ambient' }]
+ $sessionTiles.set(tiles)
+
+ resetRouteOwnedTileRuntimeBindings({ connectionId: 'local', profile: 'writer' })
+
+ expect($sessionTiles.get()).toBe(tiles)
+ expect(dropRuntimeBindings).not.toHaveBeenCalled()
+ expect(invalidateRuntimeBindings).not.toHaveBeenCalled()
+ })
+ })
+
describe('SessionTile workspace scope', () => {
afterEach(() => {
$activeGatewayProfile.set('default')
diff --cc tui_gateway/methods_session.py
index f4f8fd95aec,233d85d14d2..a96c2cdb49e
--- a/tui_gateway/methods_session.py
+++ b/tui_gateway/methods_session.py
@@@ -608,7 -610,7 +611,8 @@@ def _resume_live_unpersisted(ctx: _Resu
return _ok(ctx.rid, _attach_todo_state({
"session_id": live_sid, "stored_session_id": str(live.get("session_key") or ""),
"message_count": len(messages), "messages": messages,
- "info": {"model": _resolve_model(), "lazy": True, "desktop_contract": DESKTOP_BACKEND_CONTRACT,
+ "info": {"model": model, "provider": provider, "lazy": True,
++ "desktop_contract": DESKTOP_BACKEND_CONTRACT,
"profile_name": profile_name_for_home(live.get("profile_home")) or _response_profile_name(ctx.profile)}}, live))