Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 11 additions & 7 deletions public/entry-rendering.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function addEntry(e) {
const entryCwd = e.cwd || null;
if (!sessionsMap.has(sid)) {
const shortSid = sid.slice(0, 8);
sessionsMap.set(sid, { id: sid, firstTs: e.ts, firstId: entryId, lastId: entryId, count: 0, mainCount: 0, subCount: 0, model, totalCost: 0, cwd: entryCwd, title: null, titleReqTs: 0, lastAssistantText: null, agent: e.agent || 'claude', provider: e.provider || 'anthropic', latestCacheHitRatio: 0, latestCacheReadTokens: 0, resumeCommand: null });
sessionsMap.set(sid, { id: sid, firstTs: e.ts, firstId: entryId, lastId: entryId, count: 0, mainCount: 0, subCount: 0, retryCount: 0, model, totalCost: 0, cwd: entryCwd, title: null, titleReqTs: 0, lastAssistantText: null, agent: e.agent || 'claude', provider: e.provider || 'anthropic', latestCacheHitRatio: 0, latestCacheReadTokens: 0, resumeCommand: null });
// Live-update visibleProviders when a new provider appears
const settings = window.ccxraySettings;
if (!Array.isArray(settings.visibleProviders)) settings.visibleProviders = [];
Expand Down Expand Up @@ -277,10 +277,12 @@ function addEntry(e) {
sess.lastId = entryId;
if (e.receivedAt) sess.lastReceivedAt = Number(e.receivedAt);
const isSubagent = e.isSubagent || false;
sess.count++; // total (shown in session item as "Nt")
if (isSubagent) sess.subCount++;
const isRetry = !isSubagent && !isHttpStatusOk(e.status) && !(usage && usage.output_tokens > 0);
sess.count++;
if (isRetry) { sess.retryCount = (sess.retryCount || 0) + 1; }
else if (isSubagent) sess.subCount++;
else sess.mainCount++;
const displayNum = isSubagent ? ('s' + sess.subCount) : String(sess.mainCount);
const displayNum = isRetry ? ('r' + (sess.retryCount || 0)) : isSubagent ? ('s' + sess.subCount) : String(sess.mainCount);
if (entryId && window.entryById) {
window.entryById.set(entryId, { id: entryId, sessionId: sid, cwd: entryCwd, receivedAt: e.receivedAt || null, displayNum });
}
Expand Down Expand Up @@ -333,7 +335,7 @@ function addEntry(e) {
// Gap timing: idle time from end of previous turn to start of this turn
let prevInSession = null;
for (let i = allEntries.length - 1; i >= 0; i--) {
if (allEntries[i].sessionId === sid && allEntries[i].receivedAt) { prevInSession = allEntries[i]; break; }
if (allEntries[i].sessionId === sid && !allEntries[i].isRetry && allEntries[i].receivedAt) { prevInSession = allEntries[i]; break; }
}
let gapMs = null, gapColor = '', gapTitle = '';
if (prevInSession && e.receivedAt) {
Expand All @@ -356,7 +358,7 @@ function addEntry(e) {
if (!isSubagent && ctxUsed > 0 && msgCount > 0) {
for (let i = allEntries.length - 1; i >= 0; i--) {
const prev = allEntries[i];
if (prev.sessionId === sid && !prev.isSubagent && prev.ctxUsed > 0) {
if (prev.sessionId === sid && !prev.isSubagent && !prev.isRetry && prev.ctxUsed > 0) {
const msgDrop = (prev.msgCount || 0) - msgCount;
const tokenDrop = prev.ctxUsed - ctxUsed;
// Require both: msgCount dropped by 5+ AND tokens dropped by >15% of window
Expand All @@ -371,7 +373,7 @@ function addEntry(e) {
req: e.req || null, res: e.res || null, reqLoaded: !!(e.req || e.res),
msgCount, toolCount, toolCalls: e.toolCalls || {}, stopReason,
status: e.status, elapsed: e.elapsed, method: e.method, id: e.id,
isSubagent, sessionInferred: e.sessionInferred || false, displayNum, ctxUsed, isCompacted, receivedAt: e.receivedAt || null,
isSubagent, isRetry, sessionInferred: e.sessionInferred || false, displayNum, ctxUsed, isCompacted, receivedAt: e.receivedAt || null,
thinkingDuration: e.thinkingDuration || null,
duplicateToolCalls: e.duplicateToolCalls || null,
hasCredential: e.hasCredential || false,
Expand All @@ -383,6 +385,8 @@ function addEntry(e) {
provider: e.provider || 'anthropic',
});

if (isRetry) return;

// ── V3 turn card: five-line layout ──
const toolFail = e.toolFail || false;
const hasCred = e.hasCredential || false;
Expand Down
26 changes: 23 additions & 3 deletions public/miller-columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ function renderSessionItem(sess, sid) {
pinBtn +
'</div>' +
titleRow +
'<div class="si-row2"><span class="turn-model">' + escapeHtml(shortModel) + '</span> · ' + sess.count + 't</div>' +
'<div class="si-row2"><span class="turn-model">' + escapeHtml(shortModel) + '</span> · ' + (sess.count - (sess.retryCount || 0)) + 't' + (sess.retryCount ? ' <span class="retry-count" title="' + sess.retryCount + ' failed retries (hidden from turn list)">' + sess.retryCount + 'r</span>' : '') + '</div>' +
'<div class="si-cost-row"><span class="si-cost">' + escapeHtml(costStr) + '</span></div>' +
ctxBarHtml +
previewRow +
Expand Down Expand Up @@ -1676,7 +1676,25 @@ function setFocus(col) {
function getVisibleTurnIndices() {
return allEntries
.map((e, i) => i)
.filter(i => selectedSessionId && allEntries[i].sessionId === selectedSessionId);
.filter(i => selectedSessionId && allEntries[i].sessionId === selectedSessionId && !allEntries[i].isRetry);
}

function updateRetryEmptyState(sid) {
let el = colTurns.querySelector('.retry-empty-state');
if (!sid) { if (el) el.remove(); return; }
const sess = sessionsMap.get(sid);
const hasVisibleTurns = colTurns.querySelector('.turn-item[style=""]') || colTurns.querySelector('.turn-item:not([style*="display: none"])');
if (!hasVisibleTurns && sess && sess.retryCount > 0) {
if (!el) { el = document.createElement('div'); el.className = 'retry-empty-state col-empty'; colTurns.appendChild(el); }
const rc = sess.retryCount;
const codes = [];
for (let i = 0; i < allEntries.length; i++) {
if (allEntries[i].sessionId === sid && allEntries[i].isRetry) codes.push(allEntries[i].status);
}
const summary = Object.entries(codes.reduce((a, c) => { a[c] = (a[c] || 0) + 1; return a; }, {})).map(([k, v]) => v > 1 ? v + '× ' + k : k).join(', ');
el.textContent = 'No turns — ' + rc + ' failed request' + (rc > 1 ? 's' : '') + ' (' + summary + ')';
el.style.display = '';
} else { if (el) el.remove(); }
}

function renderSessionToolBar(sid) {
Expand Down Expand Up @@ -1963,6 +1981,7 @@ function selectSessionAndLatestTurn(sid) {
// Auto-select latest turn in this session
const visible = getVisibleTurnIndices();
if (visible.length) selectTurn(visible[visible.length - 1]);
updateRetryEmptyState(sid);
renderSessionToolBar(sid);
renderSessionSparkline(sid);
renderBreadcrumb();
Expand Down Expand Up @@ -2064,6 +2083,7 @@ function selectSession(id) {
colSections.innerHTML = '';
colDetail.innerHTML = '';

updateRetryEmptyState(id);
renderSessionToolBar(id);
renderSessionSparkline(id);
renderBreadcrumb();
Expand Down Expand Up @@ -2346,7 +2366,7 @@ function fetchPricingData() {

function renderCostEfficiencyPanel(currentEntry) {
const sid = currentEntry.sessionId;
const sessionTurns = allEntries.filter(e => e.sessionId === sid && !e.isSubagent && e.usage);
const sessionTurns = allEntries.filter(e => e.sessionId === sid && !e.isSubagent && !e.isRetry && e.usage && (e.usage.input_tokens || 0) > 0);

// --- Cache efficiency ---
let totalCacheRead = 0, totalCacheCreate = 0;
Expand Down
Loading
Loading