mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-04 06:29:42 +02:00
harden(history): exclude automated transcripts by SDK shape, not by "not cli"
#215 filters non-interactive transcripts out of Past Sessions with `entrypoint !== 'cli'`. That is an allowlist on a value, and the check hides rows, so it fails CLOSED on anything Claude Code has not shipped yet: the day it stamps a new interactive entrypoint (a rename, or a second interactive host), no transcript matches 'cli' any more and the entire Past Sessions list goes blank with nothing in the UI explaining why. Invert it to a blocklist on the SDK shape (`sdk`, `sdk-cli`, `sdk-py`). An automated entrypoint we do not recognize yet now costs a few noisy rows, which is the annoyance the filter set out to fix, rather than a dead feature. Matches the fail-open reasoning #215 already applied to a MISSING entrypoint field; only the unknown-VALUE case was inverted. Test fails against the pre-fix line and passes after. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2478,6 +2478,24 @@ export function registerSessionRoutes(
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this `entrypoint` value an automated/SDK-driven invocation?
|
||||
*
|
||||
* ⚠️ Deliberately a BLOCKLIST on the SDK shape, not an allowlist on `'cli'`.
|
||||
* The exclusion below hides rows, so an allowlist fails CLOSED on any value
|
||||
* Claude Code has not shipped yet: the day it stamps a new interactive
|
||||
* entrypoint (a rename, or a second interactive host), every transcript stops
|
||||
* matching `'cli'` and the whole Past Sessions list goes blank with nothing in
|
||||
* the UI to explain it. A blocklist fails OPEN instead — an automated
|
||||
* entrypoint we do not recognize yet costs a few noisy rows, which is the
|
||||
* annoyance this filter set out to fix rather than a broken feature.
|
||||
*
|
||||
* Observed values: `cli` (interactive), `sdk-cli` / `sdk-py` (automated).
|
||||
*/
|
||||
function isAutomatedEntrypoint(entrypoint: string): boolean {
|
||||
return /^sdk(-|$)/.test(entrypoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* The `entrypoint` field Claude Code stamps on its own message records:
|
||||
* 'cli' for a real interactive session, something else (e.g. 'sdk-py') for
|
||||
@@ -2873,7 +2891,7 @@ export function registerSessionRoutes(
|
||||
const tailEntrypoint = tail ? extractTranscriptEntrypoint(tail) : undefined;
|
||||
const entrypoint =
|
||||
headEntrypoint === 'cli' || tailEntrypoint === 'cli' ? 'cli' : (headEntrypoint ?? tailEntrypoint);
|
||||
if (entrypoint && entrypoint !== 'cli') continue;
|
||||
if (entrypoint && isAutomatedEntrypoint(entrypoint)) continue;
|
||||
|
||||
out.push({
|
||||
sessionId,
|
||||
|
||||
Reference in New Issue
Block a user