Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f284818
fix(sidebar): a slept chat workspace reads asleep and hides
brennanb2025 Oct 18, 2026
86df5e4
fix(sidebar): a wake during Sleep's teardown keeps the workspace awake
brennanb2025 Oct 19, 2026
80921d4
Merge remote-tracking branch 'origin/main' into brennanb2025/slept-ch…
brennanb2025 Oct 19, 2026
00afaa6
test(sidebar): give the activation-race mock store the chat tab map S…
brennanb2025 Oct 19, 2026
274eff8
feat(native-chat): the host marks the chats an explicit Sleep stopped
brennanb2025 Oct 19, 2026
16e6105
refactor(sidebar): read a slept chat from its host's mark, not a wind…
brennanb2025 Oct 19, 2026
34530d0
fix(native-chat): preserve host-owned Sleep across fallback and legac…
brennanb2025 Oct 20, 2026
12bebe9
Merge origin/main and preserve Sleep receipts after provider start se…
brennanb2025 Oct 20, 2026
2fac7c2
fix(native-chat): clear Sleep when a new send is admitted
brennanb2025 Oct 20, 2026
67a8f65
chore: restore incoming documentation after merge hook formatting
brennanb2025 Oct 20, 2026
45b4e11
fix(native-chat): let admitted sends supersede pending Sleep receipts
brennanb2025 Oct 20, 2026
c323afe
fix(sidebar): wait for host Sleep state before showing restored chats
brennanb2025 Oct 20, 2026
c96fca5
fix(sidebar): retain host Sleep answers when chat projections remount
brennanb2025 Oct 20, 2026
aa0bd59
fix(native-chat): clear Sleep when queued drafts become sends
brennanb2025 Oct 20, 2026
13b1b70
test(sidebar): cover unknown and known chat Sleep state on the board
brennanb2025 Oct 20, 2026
fb9dd82
test(vault): expect both host status capability checks
brennanb2025 Oct 20, 2026
7d53c0a
test(native-chat): consolidate Sleep behavior coverage
brennanb2025 Oct 20, 2026
9ff4572
fix(native-chat): commit Sleep wake with send admission
brennanb2025 Oct 20, 2026
df2281e
test: pin visibility while chat host is unidentified
brennanb2025 Oct 20, 2026
3963fbd
Merge origin/main into slept chat workspace visibility
brennanb2025 Oct 20, 2026
75fdf27
test: consolidate workspace sleep regression flows
brennanb2025 Oct 20, 2026
85c308e
Merge main and preserve chat Sleep status with naming updates
brennanb2025 Oct 21, 2026
cbb493e
test: keep status feed regression within renderer boundary
brennanb2025 Oct 21, 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
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ export class StructuredAgentSessionClientDelivery {

publishStatus = (sessionId: string): void => this.statusFeed.publish(sessionId)

publishConversationName = (sessionId: string): void =>
this.statusFeed.publishConversationName(sessionId)
publishRecordNotes = (sessionId: string): void => this.statusFeed.publishRecordNotes(sessionId)

publishChildWork = (
sessionId: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import { sameProviderChild } from './structured-agent-session-provider-child'
import type { ExecutionHostId } from '../../../shared/execution-host'
import {
stopWorkspaceSleepChat,
workspaceSleepStartAborts
workspaceSleepStartAborts,
type WorkspaceSleepCloseResult
} from './structured-agent-session-workspace-sleep-stop'
import type { StructuredAgentSessionExpiredStartup } from './structured-agent-session-startup-attempt'
import {
Expand Down Expand Up @@ -122,7 +123,7 @@ export function createStructuredAgentSessionConversationLifetime(host: {
sessionId: string,
workspaceId: string,
executionHostId: ExecutionHostId
): Promise<{ fence: number; stopped: boolean } | null> => {
): Promise<WorkspaceSleepCloseResult | null> => {
const matches = (): boolean => {
const location = deps().store.getRecord(sessionId)?.location
return location?.workspaceId === workspaceId && location.executionHostId === executionHostId
Expand All @@ -143,6 +144,7 @@ export function createStructuredAgentSessionConversationLifetime(host: {
return null
}
const fence = record.lease.runtimeFence
const admittedSends = deps().store.admittedSendCount(sessionId)
const session = sessions.get(sessionId)
const child = session?.child
const owned = deps().adapter.hasOwnedAcquisition?.(sessionId) === true
Expand All @@ -168,7 +170,11 @@ export function createStructuredAgentSessionConversationLifetime(host: {
)
// Lease release advances the fence; preserve the value after this close for the caller's
// final identity check against a later restart.
return { fence: deps().store.getRecord(sessionId)?.lease.runtimeFence ?? fence, stopped }
return {
fence: deps().store.getRecord(sessionId)?.lease.runtimeFence ?? fence,
stopped,
admittedSends
}
})
return starts.settle({ deps: deps(), sessions, sessionId }, await closed)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export class StructuredAgentSessionHost {
this.lifetime.close(sessionId, cause)

/** One bounded host-owned snapshot; a tab need not be visible for its child to be stopped. */
sleepWorkspace = (workspaceId: string): Promise<{ stoppedSessionIds: string[] }> =>
sleepWorkspace = (workspaceId: string, markAsleep?: boolean) =>
sleepStructuredAgentSessionWorkspace(
{
deps: this.deps,
Expand All @@ -224,9 +224,11 @@ export class StructuredAgentSessionHost {
// A start registered after the stop is newer work, as a running delivery is.
deliveryRunning: (id) =>
this.conversationDelivery.loop.isRunning(id) || this.runtimeState.startFlights.has(id),
childWorkIncomplete: this.clientDelivery.childWorkIncomplete
childWorkIncomplete: this.clientDelivery.childWorkIncomplete,
publishRecordNotes: this.clientDelivery.publishRecordNotes
},
workspaceId
workspaceId,
markAsleep
)

supportsCreate = (location: AgentSessionExecutionLocation, agent: string): boolean =>
Expand Down Expand Up @@ -351,7 +353,7 @@ export class StructuredAgentSessionHost {

/** Every session's projected status for session lists; unlike `subscribe`, retains nothing. */
subscribeStatus = this.clientDelivery.subscribeStatus
publishConversationName = this.clientDelivery.publishConversationName
publishConversationName = this.clientDelivery.publishRecordNotes

/** Turns that settle, and prompts raised, from now on. Live-only: nothing missed is replayed. */
subscribeTurnCompletions = this.clientDelivery.subscribeTurnCompletions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import type { StructuredAgentSessionLogger } from './structured-agent-session-lo
import { agentSessionAttachmentExpiredRefusal } from './structured-agent-session-turns'
import { isAgentSessionAttachmentExpiredError } from '../agent-session-attachments/agent-session-attachment-claims'
import { captureStructuredExecutionOptions } from './structured-agent-session-execution-options'
import type { JournalOperationReceipt } from '../agent-session-journal/journal-row-writer'

/** Waiting, not held on its own, and not positioned behind a returned card or a
* card the queue's pause holds: the queue never reorders. The admission rule
Expand Down Expand Up @@ -252,6 +253,7 @@ export type QueuedMessageDrainDeps = {
currentWork: (sessionId: string) => StructuredAgentSessionCurrentWork | null
/** The consumed submission is ordinary #22821 work from here on. */
wakeDelivery: (sessionId: string) => void
submissionReceipt?: (sessionId: string) => JournalOperationReceipt
logger: StructuredAgentSessionLogger
}

Expand Down Expand Up @@ -359,7 +361,8 @@ export class StructuredAgentSessionQueuedMessageDrain {
settledByOp: null,
hostInstance: structuredAgentSessionHostInstance(),
yieldsToPause: true
}
},
this.deps.submissionReceipt?.(sessionId)
)
} catch (error) {
if (error instanceof QueuedMessageNotConsumableError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function wireStructuredAgentSessionQueuedMessages(
currentWork: (sessionId) =>
hostStructuredAgentSessionCurrentWork({ store: context().deps.store, sessions }, sessionId),
wakeDelivery: (sessionId) => context().wakeDelivery(sessionId),
submissionReceipt: (sessionId) => context().deps.store.submissionReceipt(sessionId),
// Read lazily, like the rest of this wiring: the host's deps are not assigned yet.
logger: deferredStructuredAgentSessionLogger(() => context().deps.logger)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function namedFeed() {
feed.publish('session')
const name = (conversationName: string) => {
record = { ...record, conversationName }
feed.publishConversationName('session')
feed.publishRecordNotes('session')
}
return { feed, events, sessions, name }
}
Expand All @@ -63,7 +63,7 @@ it('publishes a held chat its saved name once, and not again for an unchanged re
expect(lastName(events)).toBe('Explain the parser')
const count = events.length
feed.publish('session')
feed.publishConversationName('session')
feed.publishRecordNotes('session')
expect(events).toHaveLength(count)
})

Expand Down Expand Up @@ -91,6 +91,6 @@ it('keeps the name on the summary a closing chat retains', async () => {
it('publishes nothing for a chat this host never projected', async () => {
const { feed, events } = await namedFeed()
const count = events.length
feed.publishConversationName('unknown-session')
feed.publishRecordNotes('unknown-session')
expect(events).toHaveLength(count)
})
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ import type {
StatusFeedSession,
StructuredAgentSessionStatusFeedDeps
} from './structured-agent-session-status-feed-deps'
import { structuredAgentSessionStatusSummary } from './structured-agent-session-status-summary'
import {
structuredAgentSessionStatusSummary,
withRecordNotes
} from './structured-agent-session-status-summary'
import { structuredStatusChildWork } from './structured-agent-session-status-child-work'
import {
StructuredAgentSessionJournalProjections,
Expand Down Expand Up @@ -158,20 +161,18 @@ export class StructuredAgentSessionStatusFeed {
})
}

/** The record's name changed outside the journal. A closed chat's retained row follows it too,
* so every list still showing that conversation learns the name without a tab. */
publishConversationName(sessionId: string): void {
/** The record's name or Sleep mark changed outside the journal. A closed chat's retained row
* follows it too, so every list still showing that conversation learns it without a tab. */
publishRecordNotes(sessionId: string): void {
if (this.deps.sessions.has(sessionId)) {
this.publish(sessionId)
return
}
const publication = this.published.get(sessionId)
const name = this.deps.getRecord(sessionId)?.conversationName
if (!publication || publication.summary.conversationName === name) {
const summary = withRecordNotes(publication?.summary, this.deps.getRecord(sessionId))
if (!publication || !summary) {
return
}
const { conversationName: _previous, ...rest } = publication.summary
const summary = name ? { ...rest, conversationName: name } : rest
this.published.set(sessionId, { ...publication, summary })
this.broadcast({ type: 'status', session: summary })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function structuredStatusSummariesEqual(
a.lastAssistantMessage === b.lastAssistantMessage &&
a.launchDirectory === b.launchDirectory &&
a.conversationName === b.conversationName &&
a.sleptAt === b.sleptAt &&
a.turnOutcome === b.turnOutcome &&
a.stopping === b.stopping &&
agentSessionBackgroundTasksEqual(a.backgroundTasks, b.backgroundTasks) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,32 @@ export function structuredAgentSessionStatusSummary({
...childWork,
...(providerSession ? { providerSession } : {}),
...(launchDirectory ? { launchDirectory } : {}),
...(record?.conversationName ? { conversationName: record.conversationName } : {}),
...structuredAgentSessionRecordNotes(record),
updatedAt: journal.lastActivityAt() || now()
}
}

/** What the row reads from the record alone; a closed chat's retained summary re-reads it too. */
function structuredAgentSessionRecordNotes(
record: AgentSessionRecord | null
): Pick<AgentSessionStatusSummary, 'conversationName' | 'sleptAt'> {
return {
...(record?.conversationName ? { conversationName: record.conversationName } : {}),
...(typeof record?.sleptAt === 'number' ? { sleptAt: record.sleptAt } : {})
}
}

/** A retained summary re-read from its record; null when there is none or nothing it shows moved. */
export function withRecordNotes(
summary: AgentSessionStatusSummary | undefined,
record: AgentSessionRecord | null
): AgentSessionStatusSummary | null {
if (!summary) {
return null
}
const { conversationName: _name, sleptAt: _sleptAt, ...rest } = summary
const next = { ...rest, ...structuredAgentSessionRecordNotes(record) }
return next.conversationName === summary.conversationName && next.sleptAt === summary.sleptAt
? null
: next
}
Loading