Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c6631d1
feat(timeline): show the prompts and questions behind each wait
san360 Nov 21, 2026
bcfb08d
fix(timeline): reply text without written code, turns joined by reque…
san360 Nov 21, 2026
767b852
fix(timeline): empty replies, task summaries, stable turn identity an…
san360 Nov 21, 2026
3f15cd9
fix(timeline): OpenCode replies without written code; drop a text rea…
san360 Nov 21, 2026
73db9d8
fix(timeline): waits open from the keyboard; scrub prefixed secret na…
san360 Nov 21, 2026
475042f
fix(timeline): no reasoning in Codex and VS Code replies; find a live…
san360 Nov 21, 2026
1a0cbd0
fix(timeline): scrub camelCase secret names again
san360 Nov 21, 2026
2692e57
fix(timeline): a recorded answer goes to its own question only; scrub…
san360 Nov 21, 2026
5b4875e
fix(timeline): a recorded answer marks only the question it answered
san360 Nov 21, 2026
3bbffce
fix(timeline): no compaction summary as a reply; a highlight ends wit…
san360 Nov 21, 2026
6fb4ef9
fix(timeline): scrub credentials in three layers, before the text lea…
san360 Nov 21, 2026
0f82087
fix(timeline): a reply once, the agent's words before a question show…
san360 Nov 21, 2026
466b6e9
fix(timeline): mask a credential value to its delimiter, however long
san360 Nov 21, 2026
6cb7136
fix(timeline): build a lane's text in the parse worker, for what the …
san360 Nov 21, 2026
9cf7a79
fix(timeline): keep the Timeline's raw text out of the session detail…
san360 Nov 21, 2026
8694ca6
fix(timeline): mask credentials given in context, and drop lane reads…
san360 Nov 21, 2026
5aabe7e
fix(timeline): re-parse caches from before the answer fix; a harness …
san360 Nov 21, 2026
199fdea
chore: merge the updated Timeline revamp, with main, into wait details
san360 Nov 23, 2026
4733337
chore: merge the Timeline revamp's fork resolution fix into wait details
san360 Nov 23, 2026
b4554a1
feat(timeline): date picker and custom date ranges (#383)
san360 Nov 23, 2026
0378b90
feat(timeline): replace the footnote with a collapsed "How these numb…
san360 Nov 23, 2026
78229be
feat(timeline): keep "Show prompts and questions" off until you turn …
san360 Nov 23, 2026
2a76573
fix(timeline): keep a recorded answer for the later question that reu…
san360 Nov 23, 2026
25567d1
feat(timeline): say how to show a lane's prompts and questions while …
san360 Nov 23, 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ A few features depend on the local VS Code language model and are hidden in canv
| Page | Description |
| ------------------ | ------------------------------------------------------------------------------------- |
| **Dashboard** | Practice scores with week-over-week trends, daily activity chart, top workspace stats |
| **Timeline** | Autonomy lanes per day or week, waits on you, and session families with verdicts |
| **Timeline** | Autonomy lanes per day, week or chosen range, waits on you, families with verdicts |
| **Coding Moments** | Screenshot gallery from AI coding sessions with story reels and workspace filtering |

### Measure
Expand Down
58 changes: 46 additions & 12 deletions docs/content/observe/timeline.md

Large diffs are not rendered by default.

Binary file added docs/static/screenshots/screen-timeline-range.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/screenshots/screen-timeline-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/static/screenshots/screen-timeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/core/analyzer-timeline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ describe('TimelineAnalyzer', () => {
const data = createAnalyzer([session]).getTimelineData({ fromDate: '2024-03-15', toDate: '2024-03-15' }, ctx);
expect(data.sessions).toHaveLength(1);
expect(data.sessions[0]).toMatchObject({ id: 's1', repo: 'shop', harness: 'Copilot App', parent: -1, via: null });
expect(data.sessions[0].turns).toEqual([
expect(data.sessions[0].turns.every(t => typeof t.id === 'string')).toBe(true);
expect(data.sessions[0].turns.map(({ id: _id, ...turn }) => turn)).toEqual([
{ t: at(10), d: 600_000, k: 'you', sub: 0, comp: false, cr: 2.5, tok: 1000 },
{ t: at(10, 20), d: 0, k: 'autopilot', sub: 1, comp: false, cr: 0, tok: 0, noDuration: true },
]);
Expand Down
2 changes: 2 additions & 0 deletions src/core/analyzer-timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { toDateStr, isoWeek } from './helpers';
import { AnalyzerBase } from './analyzer-base';
import type { EditLocIndex } from './edit-loc-diff';
import { harnessLabel, scrubBranch, scrubLabel, scrubRepository, type ScrubContext } from './session-labels';
import { turnIdentity } from './fork-ownership';
import { localScrubContext } from './session-workspace-meta';
import { resolveParentLinks, type ParentLink } from './timeline-links';
import { addDays, dayStart, prepareTimeline } from './timeline-model';
Expand Down Expand Up @@ -69,6 +70,7 @@ function timelineTurn(r: SessionRequest, paired: RelayPairs, origin?: Map<Timeli
comp: Boolean(r.compaction || r.compactions?.length),
cr: r.aiCredits ?? 0,
tok: r.loggedTokens ?? Math.max(0, (r.promptTokens ?? 0) + (r.completionTokens ?? 0)),
...(turnIdentity(r) ? { id: turnIdentity(r) } : {}),
...(r.totalElapsed == null ? { noDuration: true } : {}),
...(waits.length ? { w: waits } : {}),
};
Expand Down
21 changes: 21 additions & 0 deletions src/core/cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,27 @@ describe('cache written by an earlier parser', () => {
expect(await loadCacheData()).toBeNull();
clearCache();
});

it('re-parses a version 32 cache, whose Copilot waits beside editor chats took a later question reusing an answered one’s ID for answered', async () => {
clearCache();
const editor = makeSession();
const cli = createSession({
sessionId: 'cli-beside-editor', workspaceId: 'ws1', workspaceName: 'workspace', harness: 'GitHub Copilot CLI',
requests: [createRequest({ requestId: 'r1', timestamp: 1, messageText: 'go', responseText: '',
userWaits: [{ start: 2, end: 3, kind: 'question', answered: true, answeredAt: 3 }, { start: 5, end: 6, kind: 'question', answered: true, answeredAt: 3 }] })],
});
const result: ParseResult = {
workspaces: new Map(), sessions: [editor, cli], editLocIndex: new Map(),
sessionSourceIndex: new Map([[cli.sessionId, { kind: 'cli-events', filePath: '/logs/ws1/copilot/events.jsonl', workspaceId: 'ws1', workspaceName: 'workspace', harness: 'GitHub Copilot CLI' }]]),
};
await saveCacheData(result, { '/logs/ws1': { chatCount: 1, chatMaxMtime: 1, editCount: 0, editMaxMtime: 0 } });
await flushCacheWrites();
expect((await loadCacheData())?.result.sessions.length).toBe(2);
const metaFile = path.join(getCacheDir(), 'meta.json');
fs.writeFileSync(metaFile, JSON.stringify({ ...JSON.parse(fs.readFileSync(metaFile, 'utf-8')) as object, version: 32 }));
expect(await loadCacheData()).toBeNull();
clearCache();
});
});

describe('computeDirMetas', () => {
Expand Down
35 changes: 26 additions & 9 deletions src/core/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
import * as fs from 'fs';
import * as path from 'path';
import { Worker } from 'worker_threads';
import { Session, Workspace } from './types';
import { Session, Workspace, type TimelineSessionText, type TimelineTextScope, type TimelineTextSuperseded } from './types';
import { EditLoc, EditLocIndex } from './edit-loc-diff';
import { warnCore } from './log';
import { loadSessionDetails } from './session-image-loader';
import { loadSessionDetails, loadSessionTimelineText } from './session-image-loader';
import type { ScrubContext } from './session-labels';
import { stripSingleSession } from './parser-shared';
import { getCacheDir } from './cache-paths';
import { isCacheWriteWorkerResult, removeStaleTempFiles, writeCacheFiles, type CacheWritePayload } from './cache-write';
Expand Down Expand Up @@ -72,8 +73,10 @@ const cacheMetaPath = (): string => path.join(getCacheDir(), 'meta.json');

/** Bump when a parser change alters what a cached session holds. 32: Copilot waits keep the time of your answer's own
* record and the request it answered (`answeredAt`, `requestId`); sessions from Copilot logs beside editor chats are
* cached with their workspace, and an older entry would date their answers by the result. */
const CACHE_VERSION = 32;
* cached with their workspace, and an older entry would date their answers by the result. 33: a record of your answer
* marks only the question it answered, not a later one that reused its tool call ID. 34: nor a question a record for
* another request was logged before. */
const CACHE_VERSION = 34;

/** Refuse to JSON.parse cache files beyond these sizes: a corrupted (or
* tampered) cache must degrade to a full re-parse, not OOM the host. */
Expand Down Expand Up @@ -472,11 +475,7 @@ export function stripSessionsForMemory(sessions: Session[]): void {
*/
export async function loadSessionFromDisk(sessionId: string): Promise<Session | null> {
try {
let source = memoryCache?.result.sessionSourceIndex.get(sessionId);
if (!source) {
const cached = await loadCacheData();
source = cached?.result.sessionSourceIndex.get(sessionId);
}
const source = await sessionSource(sessionId);
if (!source) return null;

return await loadSessionDetails(source, sessionId);
Expand All @@ -485,3 +484,21 @@ export async function loadSessionFromDisk(sessionId: string): Promise<Session |
return null;
}
}

async function sessionSource(sessionId: string): Promise<SessionSource | undefined> {
return memoryCache?.result.sessionSourceIndex.get(sessionId) ?? (await loadCacheData())?.result.sessionSourceIndex.get(sessionId);
}

/** One Timeline lane's text, read again from its log and scrubbed in the parse worker (see `TimelineTextRequest`). */
export async function loadTimelineTextFromDisk(
sessionId: string, scope: TimelineTextScope, labels: ScrubContext, kept?: string[],
): Promise<TimelineSessionText | TimelineTextSuperseded | null> {
try {
const source = await sessionSource(sessionId);
if (!source) return null;
return await loadSessionTimelineText({ type: 'timeline-text', source, sessionId, scope, labels, ...(kept ? { kept } : {}) });
} catch (error) {
warnCore('cache', `Could not read the Timeline text of session ${sessionId}`, error);
return null;
}
}
8 changes: 6 additions & 2 deletions src/core/fork-ownership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,16 @@ export function withInheritedTurnsRemoved(sessions: readonly Session[]): Session
};
});
}
/** A turn's identity that stays the same while its session is still being written: its prompt's event, else its
* request (a Copilot request ID is its latest reply's, so it changes as the turn gains messages). */
export const turnIdentity = (r: Pick<SessionRequest, 'userEventId' | 'requestId'>): string => r.userEventId || r.requestId;

/** A session re-read in full (for its detail view) with the same turns the analysis kept: a fork's copied turns stay
* counted once, in their source. `analyzed` is the session as the analyzer holds it. */
export function withAnalyzedTurns(full: Session, analyzed: Session | null): Session {
if (!analyzed?.inheritedTurns) return full;
const kept = new Set(analyzed.requests.map(r => r.requestId));
const requests = full.requests.filter(r => kept.has(r.requestId));
const kept = new Set(analyzed.requests.map(turnIdentity));
const requests = full.requests.filter(r => kept.has(turnIdentity(r)));
return {
...full, requests, requestCount: requests.length, inheritedTurns: analyzed.inheritedTurns,
...(analyzed.forkedFromId ? { forkedFromId: analyzed.forkedFromId } : {}),
Expand Down
27 changes: 23 additions & 4 deletions src/core/parse-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { getParseWarningCounts, getParseWarnings, setCuriosityDetector } from '.
import { detectCuriosity } from './curiosity';
import { installRuntimeDebugHooks, runtimeDebug } from './runtime-debug';
import { createTelemetrySampler } from './worker-telemetry';
import { extractSourceImages, loadSourceSession, type SessionSourceRequest } from './session-images';
import { extractSourceImages, loadSourceSessionDetail, loadTimelineText, type SessionSourceRequest, type TimelineTextRequest } from './session-images';

interface ParseWorkerRequest {
logsDirs?: string[];
Expand Down Expand Up @@ -75,10 +75,26 @@ function isAckMessage(msg: unknown): msg is AckMessage {
/** Set by the streaming step to receive chunk acks from the parent. */
let onAck: ((seq: number) => void) | null = null;

const isStringArray = (value: unknown): value is string[] => Array.isArray(value) && value.every(item => typeof item === 'string');
const isFiniteNumber = (value: unknown): value is number => typeof value === 'number' && Number.isFinite(value);

/** A Timeline text request's scope, kept turns and scrub labels. */
function isTimelineTextFields(candidate: Partial<TimelineTextRequest>): boolean {
const { scope, labels } = candidate;
return typeof scope === 'object' && scope !== null && isFiniteNumber(scope.from) && isFiniteNumber(scope.to)
&& Array.isArray(scope.turns) && scope.turns.every(t => typeof t === 'object' && t !== null && isFiniteNumber(t.t)
&& (t.id === undefined || typeof t.id === 'string'))
&& (candidate.kept === undefined || isStringArray(candidate.kept))
&& typeof labels === 'object' && labels !== null && isStringArray(labels.names)
&& (labels.home === undefined || typeof labels.home === 'string') && (labels.handles === undefined || isStringArray(labels.handles));
}

function isSessionSourceRequest(value: object): value is SessionSourceRequest {
const candidate = value as Partial<SessionSourceRequest>;
const source = candidate.source;
return (candidate.type === 'session-detail' || (candidate.type === 'session-images' && typeof candidate.requestId === 'string'
return (candidate.type === 'session-detail'
|| (candidate.type === 'timeline-text' && isTimelineTextFields(candidate))
|| (candidate.type === 'session-images' && typeof candidate.requestId === 'string'
&& (candidate.userEventId === undefined || typeof candidate.userEventId === 'string')
&& (candidate.requestIndex === undefined || (Number.isSafeInteger(candidate.requestIndex) && candidate.requestIndex >= 0))))
&& typeof candidate.sessionId === 'string'
Expand All @@ -99,13 +115,16 @@ function onMessage(handler: (msg: ParseWorkerRequest) => void | Promise<void>):
onAck?.(raw.seq);
return;
}
if (typeof raw === 'object' && raw !== null && 'type' in raw && (raw.type === 'session-images' || raw.type === 'session-detail')) {
if (typeof raw === 'object' && raw !== null && 'type' in raw
&& (raw.type === 'session-images' || raw.type === 'session-detail' || raw.type === 'timeline-text')) {
try {
if (!isSessionSourceRequest(raw)) throw new Error('Invalid session source request');
if (raw.type === 'session-images') {
send({ type: 'session-images', images: extractSourceImages(raw.source, raw.sessionId, raw.requestId, raw) });
} else if (raw.type === 'timeline-text') {
send({ type: 'timeline-text', text: loadTimelineText(raw) });
} else {
send({ type: 'session-detail', session: loadSourceSession(raw.source, raw.sessionId) });
send({ type: 'session-detail', session: loadSourceSessionDetail(raw.source, raw.sessionId) });
}
} catch (error) {
send({ type: 'error', message: error instanceof Error ? error.message : String(error) });
Expand Down
45 changes: 43 additions & 2 deletions src/core/parser-claude.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,38 @@ describe('parseClaudeSessions', () => {
const request = parseClaudeSessions(projectsDir)[0].sessions[0].requests[0];
const ms = Date.parse;
expect(request.userWaits).toEqual([
{ start: ms('2025-06-15T10:00:05Z'), end: ms('2025-06-15T10:04:05Z'), kind: 'question', answered: true },
{ start: ms('2025-06-15T10:00:05Z'), end: ms('2025-06-15T10:04:05Z'), kind: 'question', answered: true, text: { answer: 'User answered: B' } },
{ start: ms('2025-06-15T10:04:10Z'), end: ms('2025-06-15T10:04:11Z'), kind: 'question', answered: false },
{ start: ms('2025-06-15T10:04:20Z'), end: ms('2025-06-15T10:04:20Z'), kind: 'question', answered: false },
]);
expect(request.totalElapsed).toBe(300_000);
});
});

it('keeps the agent’s own text apart from the file contents its write tools wrote', () => {
withProjectsDir('s.jsonl', [
makeUser('write it'),
makeAssistant('I will write the file.', '2025-06-15T10:00:01Z'),
makeToolAssistant('Write', { file_path: '/p/a.ts', content: 'export const x = 1;' }, '2025-06-15T10:00:02Z', 't1'),
{ type: 'user', timestamp: '2025-06-15T10:00:03Z', message: { role: 'user', content: [{ type: 'tool_result', tool_use_id: 't1', content: 'ok' }] } },
], (projectsDir) => {
const request = parseClaudeSessions(projectsDir)[0].sessions[0].requests[0];
expect(request.responseText).toContain('export const x = 1;');
expect(request.replyText).toBe('I will write the file.');
});
});

it('logs an empty reply, not the file contents, for a turn that only wrote a file', () => {
withProjectsDir('s.jsonl', [
makeUser('write it'),
makeToolAssistant('Write', { file_path: '/p/a.ts', content: 'export const x = 1;' }, '2025-06-15T10:00:02Z', 't1'),
{ type: 'user', timestamp: '2025-06-15T10:00:03Z', message: { role: 'user', content: [{ type: 'tool_result', tool_use_id: 't1', content: 'ok' }] } },
], (projectsDir) => {
const request = parseClaudeSessions(projectsDir)[0].sessions[0].requests[0];
expect([request.responseText.includes('export const x = 1;'), request.replyText]).toEqual([true, '']);
});
});

it('marks a turn logged with its own queue or API records as logged live, and a fork’s copied turn not', () => {
withProjectsDir('s.jsonl', [
{ type: 'queue-operation', timestamp: '2025-06-15T10:00:00Z', sessionId: 'sess-1', operation: 'enqueue' },
Expand Down Expand Up @@ -222,6 +246,23 @@ describe('parseClaudeSessions', () => {
}
});

it('keeps an AskUserQuestion call’s questions, options, your answer and what the agent said before it', () => {
withProjectsDir('s.jsonl', [
makeUser('plan it', '2025-06-15T10:00:00Z'),
makeAssistant('Two ways to do this.', '2025-06-15T10:00:03Z'),
makeToolAssistant('AskUserQuestion', {
questions: [{ question: 'Which approach?', header: 'Approach', options: [{ label: 'Rewrite', description: 'x' }, { label: 'Patch' }], multiSelect: false }],
}, '2025-06-15T10:00:05Z', 'q1'),
{ type: 'user', timestamp: '2025-06-15T10:01:00Z', sessionId: 'sess-1', message: { role: 'user', content: [{ type: 'tool_result', tool_use_id: 'q1', content: [{ type: 'text', text: 'User has answered your questions: "Which approach?"="Patch"' }] }] } },
makeAssistant('done', '2025-06-15T10:02:00Z'),
], (projectsDir) => {
const [wait] = parseClaudeSessions(projectsDir)[0].sessions[0].requests[0].userWaits ?? [];
expect(wait.text).toEqual({
ask: 'Which approach?', choices: ['Rewrite', 'Patch'], before: 'Two ways to do this.', answer: 'User has answered your questions: "Which approach?"="Patch"',
});
});
});

it('keeps a fork that holds only copied turns, from its transcript to the Sessions list', () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'claude-fork-copies-only-'));
try {
Expand Down Expand Up @@ -282,7 +323,7 @@ describe('parseClaudeSessions', () => {
const waits = parseClaudeSessions(projectsDir)[0].sessions[0].requests.map(r => r.userWaits);
expect(waits).toEqual([
[{ start: ms('2025-06-15T10:00:05Z'), end: ms('2025-06-15T10:03:00Z'), kind: 'question', answered: false }],
[{ start: ms('2025-06-15T10:03:05Z'), end: ms('2025-06-15T10:06:00Z'), kind: 'question', answered: true }],
[{ start: ms('2025-06-15T10:03:05Z'), end: ms('2025-06-15T10:06:00Z'), kind: 'question', answered: true, text: { answer: 'User answered: B' } }],
undefined,
]);
});
Expand Down
Loading
Loading