Repository navigation
feat(dsh): implement nativeSessionFile via sessionPersistence.stat - #1107
Merged
Merged
Conversation
stamp-build
Bot
force-pushed
the
agent/lookout/dsh-native-session-file
branch
from
November 21, 2026 10:06
2083a93 to
d1adcb3
Compare
stamp-build Bot
added a commit
that referenced
this pull request
Nov 21, 2026
<!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> (open-agent-runtime) opened via Stamp · <a href="https://stamp.build/review?receipt=prc_2ce5096582e05d834584b22aa9756a40"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View →</a></sup> --- <!-- /stamp:review:v1 --> ## OAR 0.128.1 ### Fixes - **Pi moves to 1.6.0 as one family, with undici 8.12.4** (#1110, #1112, issue #1109). OAR 0.128.0 declared `@earendil-works/pi-ai` and `@earendil-works/pi-coding-agent` at `^1.5.2` while `pi-durable` and `chord` were `~1.5.2` and `undici` was pinned to Pi 1.5.2's exact `8.12.3`. Pi 1.6.0 (published 2026-11-20) therefore installed into fresh 0.128.0 hosts untested: a second `undici` copy, a failing resume reset of restored pending tools, and missing Qwen Token Plan credentials. - All four Pi packages are now `~1.6.0` in `@botiverse/oar` and `@botiverse/oar-cli`, and `undici` is `8.12.4`, the version Pi 1.6.0 pins, which carries the upstream security fixes. A fresh install has a single `undici` copy. - A manifest check fails if the Pi ranges differ, if one is not a tilde or exact version, or if OAR's `undici` differs from the exact `undici` Pi pins. - Resume no longer depends on a private side effect of Pi's `setActiveToolsByName`. OAR opens a resumed session with Pi's public `noTools: "builtin"`, which skips restoring the transcript's tool selection, then applies the current default tools. A resume whose registry has no activatable tools now opens with an empty loadout instead of failing with `UnsupportedOptionError("resume")`. - Pi credentials gain `QWEN_TOKEN_PLAN_TEAM_API_KEY`, `QWEN_TOKEN_PLAN_TEAM_CN_API_KEY`, `QWEN_TOKEN_PLAN_INDIVIDUAL_API_KEY` and `QWEN_TOKEN_PLAN_INDIVIDUAL_CN_API_KEY`. - Hosts that also depend on `@earendil-works/pi-durable` or `chord` need 1.6.x of those peers. ### New - **DSH reports its session log file** (#1107). From DSH 0.2.2-alpha.2, `Session.nativeSessionFile()` returns the absolute path DSH reports from `sessionPersistence.stat(id).location.path` (typically `session.v4.jsonl.zstd`), `null` before the log is on disk, and the last known path after disposal. An explicit call drains DSH's 200 ms write batch with DSH's own `sessions.flush` before reading, so a just-finished turn is on disk. `sessionCapabilities` declares `nativeSessionFile: true` from 0.2.2-alpha.2, `false` below it (0.2.1-rc.5's `stat` has no location), and leaves it absent when the version is unreadable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Cindy <[email protected]>
Ancienttwo
added a commit
to Ancienttwo/oar
that referenced
this pull request
Nov 21, 2026
Files: packages/oar/src/runtimes/dsh/bridge.ts `runtimes/dsh/bridge.ts`. Invariant: the SDK exposes no native session file (botiverse#1107 nativeSessionFile is omitted), so the bridge reads none. `opened()` makes no `persistence.stat` call and reports no `sessionFile` or `sessionFileStat`, so the `dsh/opened` record names no host path and a rejecting stat cannot fail the open. `dispose()` flushes and reports no `sessionFiles`. `bridge-controls.ts` keeps upstream bytes; its `sessionFile` command stays unused. Upstream: none (SDK omits native session files).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement
Session.nativeSessionFile()and declarenativeSessionFile: trueondshRuntime.sessionCapabilitiesusing DSH's nativesessionPersistence.stat(sessionId)service (snapshot.location.path), without constructing or guessing$DSH_HOME/sessions/<cwd key>/<id>paths.Requested by Cindy in
#core:#396following the real Raft DSH transcript lookup gap (#oar-raft:4b887fbe).Release notes
New
Session.nativeSessionFile()and capability declaration.dshRuntime.sessionCapabilities()now declaresnativeSessionFile: true, and opened DSH sessions exposenativeSessionFile()backed by DSH's nativesessionPersistence.stat(id)(location.path). Each live call queriessessionPersistence.stat(id)so selected-generation changes are picked up rather than cached. It returnsnullbefore the durable log file materializes on disk, returns the absolute path once a regular file exists (verified via the sharedsessionFileLocator), reports existing files immediately on resume before a new turn, and continues to work aftersession.dispose()even ifnativeSessionFile()was not called before disposal.Native verification (DSH 0.2.1-rc.5 and 0.2.2-rc.5)
Probed real DSH
0.2.2-rc.5in an isolatedDSH_HOMEwith aimock and verified the matching implementation in DSH0.2.1-rc.5(DSH_MINIMUM_VERSION):ctx.get("sessionPersistence")implements the abstractSessionPersistence.stat(id)method (@deepseek-ai/dsh-session-persistence-jsonl).agents.create()(before the first turn materializes on disk),persistence.stat(sessionId)returns{ header, revision }with nolocationfield (nativeSessionFile()answersnull).resumeimmediately afteragents.resume()),persistence.stat(sessionId)returnslocation: { kind: "jsonl", path: "<abs path>/session.v4.jsonl.zstd" }, andstatSync(path).isFile()istrue.handle.dispose()andpersistence.flush(),persistence.stat(sessionId)still returns the samelocation.path.Call-site audit
Audited all
nativeSessionFiledeclarations, implementations, wrappers, and tests across OAR:packages/oar/src/runtimes/dsh/bridge.ts: addedsessionFileOf(sessionId)readingpersistence.stat(sessionId)?.location?.path, exposedsessionFileStat/sessionFileinopened, addedsessionFilecontrol command, returnedsessionFilesfromdispose()afterpersistence.flush()(omitted when no handles were open so baredisposestill returns{}), and added"stat"toready.services.sessionPersistence.packages/oar/src/runtimes/dsh/session.ts: wirednativeSessionFilethrough the sharedsessionFileLocator(sessionFilePath, credentials.redact)whenopened.sessionFileStat === true(absent ifsessionPersistence.statis missing), re-queryingsessionFileon every live call so generation changes are reflected, and keeping the last observed path (refreshed atturn_endedanddispose()) for post-disposal calls.packages/oar/src/runtimes/dsh/index.ts: declarednativeSessionFile: trueindshRuntime.sessionCapabilities.docs/spec/runtime-matrix.mdanddocs/runtimes/dsh.md: documented DSH'snativeSessionFiledeclaration andsessionPersistence.stat(id)mapping.sea-trial/vendor/native-session-file.vendor.test.ts: enabled the shared fresh/resume/post-dispose vendor check fordsh-aimock.tests/fixtures/fake-dsh.mjsandtests/dsh/native-session-file.test.ts: added unit tests for declaration, pre/post-turn and post-dispose lookup (including dispose without prior call), generation-change re-querying across turns, nonexistent reported path, missingstatmethod, and resumed sessions.packages/oar/src/shared/native-session-file.ts(sessionFileLocator),packages/oar/src/shared/session-credentials.ts(nativeSessionFilecredential guard),sea-trial/cases/session-capabilities.ts(session.capabilities-match-declaration): already handle any runtime exposingnativeSessionFileand declaringnativeSessionFile: true.codex,pi(SDK & RPC): already implement and declarenativeSessionFile.#core:#396.Verification
pnpm vitest run tests/dsh/native-session-file.test.ts: 4/4 failed before the implementation.OAR_TEST=dsh-aimock OAR_DSH_BIN=/tmp/probe-dsh-file/prefix/bin/dsh pnpm vitest run sea-trial/vendor/native-session-file.vendor.test.ts: failed before the implementation (TypeError: missing native session file).OAR_TEST=dsh-aimock OAR_DSH_BIN=/tmp/probe-dsh-file/prefix/bin/dsh pnpm vitest run sea-trial/vendor/native-session-file.vendor.test.tson real DSH0.2.2-rc.5: passed (fresh, resume, filesystem identity match, post-dispose).OAR_TEST=dsh-aimock OAR_DSH_BIN=/tmp/probe-dsh-file/prefix/bin/dsh pnpm exec tsx sea-trial/main.ts session.capabilities-match-declarationon real DSH0.2.2-rc.5: passed.CI=1 OAR_COMMUNITY_TESTS=1 pnpm run check && pnpm run build: passed (typecheck, oxlint 0 warnings / 0 errors, all unit + community tests, mock sea-trial, build).