Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d2d5c78
fix(runtime-host): page Session traces at the source
Astro-Han Aug 17, 2026
c8632fe
chore: refresh Astryx surface inventory
Astro-Han Aug 17, 2026
1d92643
fix(runtime-host): keep oversized trace pages pageable
Astro-Han Aug 17, 2026
458a46c
fix(desktop): preserve a contiguous trace page window
Astro-Han Aug 17, 2026
ee2509f
fix(desktop): reuse the scoped Session usage summary
Astro-Han Aug 17, 2026
d073d80
test: sharpen Session trace pagination coverage
Astro-Han Aug 17, 2026
bd6a1d0
refactor(desktop): remove obsolete Inspector state
Astro-Han Aug 17, 2026
f6bf658
test(desktop): align trace stories with summary bridge
Astro-Han Aug 17, 2026
8aeb5c8
fix: make Session trace reads consistent at scale
Astro-Han Aug 17, 2026
6dc8bfc
fix: preserve authoritative Session trace semantics
Astro-Han Aug 17, 2026
1e765ed
fix: close Session trace review gaps
Astro-Han Aug 17, 2026
733e26f
fix: close session trace review findings
Astro-Han Aug 17, 2026
b630077
test: assert stale trace retry stays superseded
Astro-Han Aug 17, 2026
c4adc3e
fix: invalidate usage after repair marker changes
Astro-Han Aug 17, 2026
6a9ce84
test(desktop): align pricing fixture with trace coverage
Astro-Han Aug 20, 2026
b20f148
fix: preserve cache-only usage evidence
Astro-Han Aug 21, 2026
b23e8ba
fix: publish usage changes only for mutations
Astro-Han Aug 21, 2026
a5cee15
fix(desktop): flag partial Session usage
Astro-Han Aug 21, 2026
93551aa
fix(storage): derive usage repair from AgentRun sequence
Astro-Han Aug 21, 2026
58de960
perf(storage): index model-call projection high-water
Astro-Han Aug 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 @@ -625,6 +625,7 @@ test('publishes typed invalidations and refreshes only changed Runtime Resources
handle.sessionDomainChanged({ sessionId: 'session-1', domain: 'task' });
handle.sessionDomainChanged({ sessionId: 'session-1', domain: 'deep_research' });
handle.sessionDomainChanged({ sessionId: 'session-1', domain: 'plan' });
handle.sessionDomainChanged({ sessionId: 'session-1', domain: 'usage' });
handle.sessionDomainChanged({
sessionId: 'session-1',
domain: 'runtime_resource',
Expand Down Expand Up @@ -658,6 +659,10 @@ test('publishes typed invalidations and refreshes only changed Runtime Resources
channel: 'plan-mode:changed',
payload: { sessionId: 'session-1' },
},
{
channel: 'usage:changed',
payload: { sessionId: 'session-1' },
},
{
channel: 'graphs:changed',
payload: {
Expand Down Expand Up @@ -697,6 +702,10 @@ test('publishes typed invalidations and refreshes only changed Runtime Resources
channel: 'plan-mode:changed',
payload: { sessionId: 'session-1' },
},
{
channel: 'usage:changed',
payload: { sessionId: 'session-1' },
},
{
channel: 'graphs:resync',
payload: { rootSessionId: 'session-1' },
Expand Down
138 changes: 138 additions & 0 deletions apps/desktop/src/main/__tests__/session-inspector-panel-model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,117 @@ import {
type SessionTrace,
} from '@maka/core/session-trace';
import { deriveInspectorPanelModel } from '../../renderer/session-inspector-panel-model.js';
import {
deriveInspectorOverviewModel,
estimatedSessionCost,
hasUnavailableSessionUsage,
} from '../../renderer/session-inspector-overview-model.js';

test('does not render legacy zero cost as a known free Session', () => {
const summary = {
range: { from: 0, to: 1 },
totalRequests: 1,
totalCostUsd: 0,
totalTokens: {
input: 1,
output: 1,
cacheMiss: 1,
cacheRead: 0,
cacheWrite: 0,
reasoning: 0,
total: 2,
},
cacheHitRequests: 0,
cacheCreateRequests: 0,
errorRequests: 0,
provenance: {
coverage: {
attempts: 0,
pricedAttempts: 0,
unpricedAttempts: 0,
usageReportedAttempts: 0,
usagePartialAttempts: 0,
usageMissingAttempts: 0,
},
legacyRecords: 1,
unreadableRecords: 0,
pendingRepairs: 0,
},
};
assert.equal(estimatedSessionCost(summary), undefined);
assert.equal(estimatedSessionCost({ ...summary, totalCostUsd: 0.01 }), 0.01);
});

test('reports incomplete provenance as unavailable regardless of recorded request count', () => {
const summary = {
range: { from: 0, to: 1 },
totalRequests: 0,
totalCostUsd: 0,
totalTokens: {
input: 0,
output: 0,
cacheMiss: 0,
cacheRead: 0,
cacheWrite: 0,
reasoning: 0,
total: 0,
},
cacheHitRequests: 0,
cacheCreateRequests: 0,
errorRequests: 0,
provenance: {
coverage: {
attempts: 0,
pricedAttempts: 0,
unpricedAttempts: 0,
usageReportedAttempts: 0,
usagePartialAttempts: 0,
usageMissingAttempts: 0,
},
legacyRecords: 0,
unreadableRecords: 1,
pendingRepairs: 0,
},
};

assert.equal(hasUnavailableSessionUsage(summary), true);
assert.equal(hasUnavailableSessionUsage({ ...summary, totalRequests: 1 }), true);
});

test('does not estimate a cache-hit ratio from partial usage', () => {
const overview = deriveInspectorOverviewModel(undefined, {
range: { from: 0, to: 1 },
totalRequests: 1,
totalCostUsd: 0,
totalTokens: {
input: 10,
output: 0,
cacheMiss: 0,
cacheRead: 10,
cacheWrite: 0,
reasoning: 0,
total: 10,
},
cacheHitRequests: 1,
cacheCreateRequests: 0,
errorRequests: 0,
provenance: {
coverage: {
attempts: 1,
pricedAttempts: 1,
unpricedAttempts: 0,
usageReportedAttempts: 0,
usagePartialAttempts: 1,
usageMissingAttempts: 0,
},
legacyRecords: 0,
unreadableRecords: 0,
pendingRepairs: 0,
},
});

assert.equal(overview.cacheHitRate, undefined);
});

test('shows one compact diagnostic line for a failed history-compaction call', () => {
const trace: SessionTrace = {
Expand Down Expand Up @@ -71,6 +182,7 @@ test('shows one compact diagnostic line for a failed history-compaction call', (
turnsMissingModelCalls: [],
turnsWithFewerModelCallsThanSteps: [],
unreadableRecords: 0,
oversizedRuns: 0,
},
};

Expand All @@ -80,4 +192,30 @@ test('shows one compact diagnostic line for a failed history-compaction call', (
row?.detail,
'route=provider_native · error=RequestRejected · HTTP 400 · code=invalid_request_error · request=req-compact-1 · retryable=false',
);
const turn = deriveInspectorPanelModel(trace).turns[0];
assert.equal((turn as { startedAt?: number } | undefined)?.startedAt, 1);
});

test('reports runs omitted only by the bounded online view separately', () => {
const model = deriveInspectorPanelModel({
schemaVersion: SESSION_TRACE_SCHEMA_VERSION,
sessionId: 'session-1',
turns: [],
totals: emptyTraceTotals(),
coverage: {
modelCalls: 'partial',
turnsMissingModelCalls: [],
turnsWithFewerModelCallsThanSteps: [],
unreadableRecords: 0,
oversizedRuns: 1,
},
});

assert.deepEqual(model.coverage, {
kind: 'partial',
turnsMissing: 0,
turnsShort: 0,
unreadableRecords: 0,
oversizedRuns: 1,
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ function traceWithAttempt(modelAttempt: TraceModelAttempt): SessionTrace {
modelCalls: 'no_known_gap',
turnsMissingModelCalls: [],
unreadableRecords: 0,
oversizedRuns: 0,
turnsWithFewerModelCallsThanSteps: [],
},
};
Expand Down
Loading