Skip to content

Extract StepTraceSession and port the step-cache tests against it - #425

Merged
kblok merged 2 commits into
mainfrom
step-trace-session
Oct 17, 2026
Merged

kblok merged 2 commits into
mainfrom
step-trace-session

Conversation

@kblok

@kblok kblok commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

The step cache logic ran inline in the act, so the tests could only reach it through a whole session and could not check what upstream checks: the host reads in order, the staged recording, and the exact miss reason. It now lives in StepTraceSession (src/E2E/Agent/StepCache.cs) with StepOutcome and FailedStepOutcome, and the act calls it as upstream's act does. The step-cache.test.ts tests are ported against that seam with a MakeHost helper; the through-the-pipeline versions stay under _through_the_pipeline names. Behavior does not change, except that CANCELLED now keeps the cache like a model outage, as upstream's failedStepOutcome does. The built-in agent's start capture now falls back to a second observe when the session's probe of the start screen fails, so a flaky first capture still lets the step run but records nothing.

.NET-only symbols: IStepCacheHost.FirstActedOn (the port reads the delta from the screen the first action was resolved against), StepCacheOptions with the cache context folded in, ClaimedKey, the private WatchedHost, StepTraceSession.Pending/Start, the REPLAY_STALE case in FailedStepOutcome, and the test types StepCacheHarness, StepHost, CacheContext, StubCache. ReplayOptions.LooksBeforeFree is upstream's looksBeforeFree and replaces the host's OnEndRoute. The port keeps its own gap/strict rules and settles evictions in Flush, not in conclude.

Partial tests (renamed): "keys on the params with each unique() value as a placeholder..." (the key claim and slotting are the attempt's and dispatcher's; kept as Records_nothing_and_says_so_when_a_unique_value_is_spelled_by_another_param for the collision half), "looks at the page a navigate opened before free actions" (..._before_a_free_press...: no untargeted typing), "stages the entry it replayed whole to keep" (no recorded verdict), "self-finalizes when the recorded destination arrives after the replayed action" (summary wording), "still runs live a step with no recording and a recording too long to replay" (no truncated half), "leaves an entry the same flow re-recorded untouched" (no summary or end wait to vary; kept as the pipeline test). Not ported, feature missing: recordedVerdictOf (an entry records no verdict), the three pixel-evidence tests, truncated entry, no start anchor, the two end-wait tests, live progress replaying, "leaves an entry untouched when only the rule differs", "says a confirmed recording ... was not written", and "compares the step as the entry stores it" (the act masks the step before the session).

Closes #382

🤖 Generated with Claude Code

https://claude.ai/code/session_01KWUdrjfarTEM4dmBbK6GaV

@kblok
kblok merged commit c916dc5 into main Oct 17, 2026
1 check passed
@kblok
kblok deleted the step-trace-session branch October 17, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract StepTraceSession and port step-cache.test.ts against it

1 participant