fix(activity): roll subagent activity up to its root and accept only selectable windows

- List child sessions in the activity query and credit each child's latest update
  to its root, so Recent includes roots whose subagents were active inside the
  window; children never become rows, and only roots of in-window children are
  fetched
- Show and sort activity rows by that rolled-up time
- Restrict activityWindowMinutes to the selectable options on write, and coerce a
  stored unknown value to the default on read so it cannot reset every preference
This commit is contained in:
Chris Scott committed 2026-10-16 11:57:52 -04:00
1 parent 8b6251d83b
commit 84cdffa261
22 files changed
+343 -48

No files matched your search

+13
View File
@@ -125,6 +125,19 @@ describe('OpenCode facade', () => {
expect(lastRequest().init.method).toBe('GET')
})
it('omits the parentID filter when including child sessions', async () => {
fetchMock.mockResolvedValue(
jsonResponse({ data: [sessionInfo('ses_child', '/repo')], cursor: {} }),
)
await listSessionPage({ directory: '/repo', limit: 25, order: 'desc', includeChildren: true })
expect(lastRequest().url).toBe(
'http://localhost/api/opencode/api/session?limit=25&order=desc&directory=%2Frepo',
)
expect(lastRequest().init.method).toBe('GET')
})
it('reads a single session from the V2 session route', async () => {
fetchMock.mockResolvedValue(jsonResponse({ data: sessionInfo('ses_1', '/repo') }))
+2 -1
View File
@@ -48,6 +48,7 @@ export interface SessionPageInput {
order?: 'asc' | 'desc'
search?: string
cursor?: string
includeChildren?: boolean
}
export interface CreateSessionInput {
@@ -102,7 +103,7 @@ export async function listSessionPage(input: SessionPageInput): Promise<SessionP
...(input.directory === undefined ? {} : { directory: input.directory }),
...(input.project === undefined ? {} : { project: input.project }),
...(input.subpath === undefined ? {} : { subpath: input.subpath }),
parentID: 'null',
...(input.includeChildren ? {} : { parentID: 'null' }),
limit: input.limit,
order: input.order,
search: input.search,