You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In public e2e@0.21.2, an external runner using openHost() / host.openSession() can supply the public cache configuration, but hosted agent acts do not participate in action replay caching. A file cache directory or custom CacheStore cannot enable it on this execution path.
We need persistent replay for the same logical test across fresh hosted sessions, while retaining the existing external runner, borrowed engine, and SDK built-in agent. This is separate from provider prompt caching.
standalone-attempt.ts:171–175 calls createFixtures without a cache context. Hosted close also does not settle staged action recordings.
fixtures.ts:207 only forwards cache when environment.cache was supplied.
act.ts:246–250 creates StepTraceSession only when runtime.cache exists. Resolving cache configuration is not sufficient.
The ordinary suite executor does create/pass AgentCacheContext and call settleStagedTraces; its engine launch/settle methods reused by hosted sessions do not execute that suite-body cache plumbing.
There is a second requirement once cache is connected: hosted testId is host:<attemptId>, with a fresh attempt UUID. buildTraceCacheKey includes testId. Public OpenSessionOptions has no stable logical test/cache identity input; reusing name or projectId does not replace this field.
Verification limit: this is a source-path audit, not a measured cold/warm device reproduction. The current hosted path constructs no trace-cache lookup at all; the UUID is an additional cross-session identity gap, not an observed sequence of cache misses.
Was this removed?
It appears to be missing hosted integration rather than a recent removal. In the original hosted-session introduction, merged as 3a53fbd8e5fb8ed345dd00331b3a5b5b90bac1d3, createFixtures already omitted cache, and hosted identity was already per attempt. Suite-runner replay caching remains present in 0.21.2. I did not find evidence establishing an intentional removal decision for hosted caching.
Related: #1075 discusses stable external test identity, but does not currently provide hosted replay-cache wiring or an agreed identity API.
Requested supported behavior
Could the public hosted API:
Honor the existing cache configuration by creating/forwarding the SDK-owned action-cache context and awaiting confirmed-recording settlement at close.
Provide a documented stable logical cache identity scoped with project/target, distinct from unique attempt IDs and artifact directories. The precise public API is for maintainers to choose.
Acceptance: two separate hosts/sessions for the same logical test can record an act confirmed by a subsequent SDK assertion, then actually replay that act on the second session; assertions remain live. Different logical tests must not collide, attempt/artifact identities remain unique, and cache-off/cleanup/interruption behavior remains correct.
The external runner would still own final pass/fail and any success-only remote publication. This does not request an external-outcome/retry framework, new executor, private cache API, custom key format, or migration to e2e run. If another supported public hosted integration is intended, please point us to it.
Hi @bheemreddy-samsara this is unclaimed, and I'd like to help. Two questions before I start:
Are you planning to implement this yourself? If so, I'll step back.
If not would you accept a PR that does only stage 1 (wire AgentCacheContext into createFixtures in the hosted path and settle staged recordings at close), leaving the stable-identity API for a separate follow-up? That keeps the API decision with the maintainers while unblocking the cache plumbing.
I can reproduce the current behavior first (hosted session with a file cache configured, two attempts, assert no replay) and include that in the PR description.
Following the closure of #1220 and the feedback from @okwasniewski, I’d like to propose a design to solve the identity problem mentioned in the issue.
Currently, the hosted path uses testId = host:. Because attemptId is a fresh UUID, caching can't work across sessions. We need a way for the external runner (the host) to tell e2e: "This is the same logical test as last time."
Proposed API Shape
I suggest adding an optional cacheIdentity string to OpenSessionOptions (or the openHost() configuration):
constsession=awaithost.openSession({name: 'checkout-flow',// New: stable logical identity, scoped to the project/target by e2ecacheIdentity: 'tests/checkout.spec.ts::checkout-flow',});
How it works internally
· Fallback: If cacheIdentity is omitted, the session falls back to the current behavior (host:), meaning no replay across sessions. This keeps it strictly opt-in and doesn't break existing external runners.
· Key Composition: When building the cache key via buildTraceCacheKey, the testId is set to this cacheIdentity instead of the attemptId. This ensures the cache lookup finds the recording from the previous session.
· Scoping: The cache key already includes projectId and the target's sessionIdentity, so cacheIdentity doesn't need to be globally unique—just unique within the project.
Acceptance Criteria
If this design is approved, I am ready to submit a PR that includes:
Adding cacheIdentity to the public types.
Wiring createAgentCacheContext into standalone-attempt.ts (using cacheIdentity for the testId and falling back to host:).
Calling the settlement function correctly at close, respecting the external runner's verdict.
An integration test that opens two sessions with the same cacheIdentity, records an act, and asserts it replays on the second session.
Let me know if cacheIdentity is the preferred name, or if something like testId or logicalId fits the SDK’s naming conventions better!
Thanks @samki6576. A couple of clarifications before implementation:
What do you mean by “respecting the external runner’s verdict” at close? Following the decision on Hosted sessions: accept external runner outcomes and retry metadata #1075, can this stay within the existing SDK verification/settlement semantics (settleStagedTraces), without adding an external-outcome API or treating a passing outer test as confirmation of an act? The intended proof is an act confirmed by a subsequent SDK assertion; assertions must remain live.
Can you confirm that the stable logical identity is used for cache matching while unique attempt IDs and artifact-directory isolation remain unchanged, with an integration test that opens two separate hosts/sessions and observes actual replay on the second—not just equal cache keys?
@okwasniewski, is an optional per-session cacheIdentity the preferred public shape, or would you prefer another name/existing identity mechanism? It would be helpful to agree on that before another implementation PR. The requested scope remains stable identity plus hosted cache wiring/settlement, not a new runner-outcome protocol.
Hi @bheemreddy-samsara, thanks for the feedback! Here are the clarifications:
Respecting the external runner's verdict / Settlement semantics:
You are completely right, and I apologize for the confusion in my previous PR. I will not add any external-outcome API or treat a passing outer test as confirmation. The settlement at close will rely strictly on the existing SDK semantics (settleStagedTraces), using the lastVerifiedStepIndex from the internal SDK assertions. The proof of a recorded act will be exactly what you described: a subsequent SDK assertion remaining live and passing.
Stable identity vs. Unique attempt IDs:
Yes, I can confirm. The unique attemptId (UUID) will remain completely unchanged for artifact directories, trace logs, and reporting. The new cacheIdentity string will be strictly injected into buildTraceCacheKey (replacing the UUID in the testId field for cache lookup only).
And yes, the integration test will open two separate hosts/sessions with the same cacheIdentity and assert an actual replay (e.g., verifying the model isn't called the second time), not just checking that the cache keys match.
Naming / API Shape:
I'll wait for @okwasniewski's thoughts on the preferred name (cacheIdentity, logicalId, or an existing mechanism) before writing the implementation PR. I'm happy to adapt to whatever shape fits the SDK best.
Once the name is agreed upon, I'll submit the PR with the wiring in standalone-attempt.ts and the two-session integration test. Thanks for the guidance!
Activity
samki6576 commentedon Oct 17, 2026
Hi @bheemreddy-samsara this is unclaimed, and I'd like to help. Two questions before I start:
Are you planning to implement this yourself? If so, I'll step back.
If not would you accept a PR that does only stage 1 (wire AgentCacheContext into createFixtures in the hosted path and settle staged recordings at close), leaving the stable-identity API for a separate follow-up? That keeps the API decision with the maintainers while unblocking the cache plumbing.
I can reproduce the current behavior first (hosted session with a file cache configured, two attempts, assert no replay) and include that in the PR description.
samki6576 commentedon Oct 19, 2026
Proposed API for Stable Hosted Session Identity
Following the closure of #1220 and the feedback from @okwasniewski, I’d like to propose a design to solve the identity problem mentioned in the issue.
Currently, the hosted path uses testId = host:. Because attemptId is a fresh UUID, caching can't work across sessions. We need a way for the external runner (the host) to tell e2e: "This is the same logical test as last time."
I suggest adding an optional cacheIdentity string to OpenSessionOptions (or the openHost() configuration):
· Fallback: If cacheIdentity is omitted, the session falls back to the current behavior (host:), meaning no replay across sessions. This keeps it strictly opt-in and doesn't break existing external runners.
· Key Composition: When building the cache key via buildTraceCacheKey, the testId is set to this cacheIdentity instead of the attemptId. This ensures the cache lookup finds the recording from the previous session.
· Scoping: The cache key already includes projectId and the target's sessionIdentity, so cacheIdentity doesn't need to be globally unique—just unique within the project.
Acceptance Criteria
If this design is approved, I am ready to submit a PR that includes:
Adding cacheIdentity to the public types.
Wiring createAgentCacheContext into standalone-attempt.ts (using cacheIdentity for the testId and falling back to host:).
Calling the settlement function correctly at close, respecting the external runner's verdict.
An integration test that opens two sessions with the same cacheIdentity, records an act, and asserts it replays on the second session.
Let me know if cacheIdentity is the preferred name, or if something like testId or logicalId fits the SDK’s naming conventions better!
bheemreddy-samsara commentedon Oct 19, 2026
Thanks @samki6576. A couple of clarifications before implementation:
settleStagedTraces), without adding an external-outcome API or treating a passing outer test as confirmation of an act? The intended proof is an act confirmed by a subsequent SDK assertion; assertions must remain live.@okwasniewski, is an optional per-session
cacheIdentitythe preferred public shape, or would you prefer another name/existing identity mechanism? It would be helpful to agree on that before another implementation PR. The requested scope remains stable identity plus hosted cache wiring/settlement, not a new runner-outcome protocol.samki6576 commentedon Oct 20, 2026
Hi @bheemreddy-samsara, thanks for the feedback! Here are the clarifications:
Respecting the external runner's verdict / Settlement semantics:
You are completely right, and I apologize for the confusion in my previous PR. I will not add any external-outcome API or treat a passing outer test as confirmation. The settlement at close will rely strictly on the existing SDK semantics (settleStagedTraces), using the lastVerifiedStepIndex from the internal SDK assertions. The proof of a recorded act will be exactly what you described: a subsequent SDK assertion remaining live and passing.
Stable identity vs. Unique attempt IDs:
Yes, I can confirm. The unique attemptId (UUID) will remain completely unchanged for artifact directories, trace logs, and reporting. The new cacheIdentity string will be strictly injected into buildTraceCacheKey (replacing the UUID in the testId field for cache lookup only).
And yes, the integration test will open two separate hosts/sessions with the same cacheIdentity and assert an actual replay (e.g., verifying the model isn't called the second time), not just checking that the cache keys match.
I'll wait for @okwasniewski's thoughts on the preferred name (cacheIdentity, logicalId, or an existing mechanism) before writing the implementation PR. I'm happy to adapt to whatever shape fits the SDK best.
Once the name is agreed upon, I'll submit the PR with the wiring in standalone-attempt.ts and the two-session integration test. Thanks for the guidance!