The sandbox policy derived a linked checkout's shared Git directory from its
`.git` pointer and granted it. That put Git worktree knowledge and a
worktree-only entry (`prepare`) into a generic service. The policy now bounds
a Session by its directory and adds only configured directories and those a
Host plugin registered through `registerWritableRoot`; relative to the lower
branch its source changes in one place, the root it reads.
- `prepare`, the derivation state, its three listeners, and
`src/linked-checkout.ts` are removed.
- The worktree service creates under the Session's policy as on the lower
branch; removal and restoration swap the root for the source checkout. The
forge panel's blocker reads the Session's root alone.
- A Session that works in a linked worktree cannot write the repository's Git
directory under workspace-write without a grant. Tests pin the denial and
that a registered grant admits creation, restoration, and a commit.
Granting the Git directory of the checkout a Session works in is left to a
separate plugin that reads the layout and registers the directory.
Fixtures construct the store with the plugin's frame defaults and read
durable history through frames; existing tests query the frames table
and its triggers. New tests cover the frame codec, frame layout per
write and per setting, sliced reads across frame boundaries, decode
grouping, and the corruption refusals for a missing frame, a frame
shorter than its range, an unknown codec, and damaged bytes.
The SQLite README, the persistence subsystem page and the generated
configuration catalog describe `frameEvents` and the frame encoding
selected by `compression`.
* test(session): cover SQLite persistence and document the provider
* test(session): align coverage with the latest SQLite implementation
* test(session): adapt storage coverage to the current SQLite backend
* feat(session)!: pass fork source through agent creation
* refactor: prepare forks privately and append child segment events
* refactor: choose fork sharing in SQLite creation transaction
* fix(session): preserve caller-prepared fork seeds
* feat(session): flush fixed fork prefix before child creation
* fix(session): persist fork sources and await parent drain
* chore: remove test and documentation changes from fork PR
* refactor(agent-loop): reuse agent fork source type
* fix(session): retain SQLite handle and JSONL errors after rebase
* perf(session): create forks from the caller's history without reloading the parent
The fork source carries the complete child history from seq 0. A live
parent's log supplies the shared prefix; a cold parent's prefix is used as
persistence returned it to the caller. The factory no longer reopens the
parent, and the JSONL backend copies the supplied history instead of
decoding the parent log again. The SQLite backend drains a live parent
writer before sharing its persisted prefix, so the factory no longer flushes
the parent or tracks owner disposal during that wait; its fork creation
serializes child events without the read-side validation and reports
publication failures through the shared wrapper.
* refactor(session-query): report the persisted prefix length on live observations
A live observation reports its event count as the persisted prefix, so the
fork command's boundary fallback only covers observations from other
producers.
* test(session): exclude the SQLite POSIX lease from Windows coverage
The SQLite copy of the session write lease executes its POSIX face only off
Windows, matching the JSONL exclusion.
* test(session): report legacy opener failures on stderr
The two-process suite asserts only the error name; the message and cause now
reach the inherited stderr so a CI failure identifies the SQLite error.
* refactor(agent): keep seed as the constructor input and narrow the fork source
CreateAgentOptions.seed stays the only constructor history; source names the
parent and cut a seeded fork shares. The factory stores the constructed log
with that source at creation, so no fork-only seed selection remains in the
loop.
* test(session): complete fork regressions and documentation
* test(session): propagate current SQLite fixtures through fork regressions
* test(session): describe fork creation from the caller's history
The fork source now carries the complete child history and the factory no
longer reopens or flushes the parent, so the fake factories, source
expectations, and cancellation cases follow that flow: a sharing backend
drains the parent writer itself, JSONL copies the supplied history, and
observations always report the persisted prefix. Documentation, the upgrade
guide, and the generated catalogs describe the same behavior.
* test(session): cover fork creation without a factory flush
The in-process fork provider's cases no longer wait for a parent flush: the
live log supplies the completed prefix and cancellation is exercised while
child storage is pending. The Remote fork command's boundary fallback is
covered by an observation that omits its persisted count.
* test(session): drop redundant observation assertions in the fork fallback case
* test(session): describe fork creation with seed beside a parent source
The agent factory keeps seed as the constructor history and source names
only the parent and cut, so the fakes, source expectations, and documentation
follow that split; the case where a live parent replaced the supplied prefix
no longer applies.
* refactor(session): name the fork parent option parentSource
`CreateAgentOptions.source` and `SessionPersistenceCreateOptions.source`
become `parentSource`: the field names the parent Session a seeded fork
shares its prefix with, and the shorter name read as a generic origin.
* refactor(session-query): report persistedEventCount on cold observations only
A live observation holds the Session's own events, none of them read-time
repairs, so its stored prefix is its whole log and the field said nothing;
only a cold read appends interrupted-turn closers in memory and needs to
tell the fork cut where the stored prefix ends.
Review of the consumers layer:
- `SandboxPolicyRequest.root` is removed. `resolve` answers only for a Session.
`prepare` accepts a Session or a checkout directory and returns that
checkout's validated Git administration directories. The worktree service
builds the policy of removal and restoration itself: the Session's mode and
grants, the source checkout as the root, and that checkout's derived
directories. The forge panel swaps the root for its two reads of the source
repository.
- The Git layout reads move to `src/linked-checkout.ts` with direct tests; the
security rationale stays in the README, which the function comment links.
- `resolve` and the model-visible policy share one merge of configured,
registered, and derived writable roots.
- `workspace-files` takes a live Session's root from the sandbox policy instead
of repeating its fallback chain.
- `TurnRecorder` takes a fixed directory and an explicit `moveTo`, which the
plugin calls on `workspace-root/change`; each turn keeps its own canonical
paths.
A real-sandbox test restores a missing worktree of a linked source checkout in
a process that never worked in it.
The plugin_manager description now says that an applied change is in
effect and needs no restart, so models stop inferring restart needs
from other evidence.
Refs #8614
Route admission requires a Peer for a route without auth, and Connection
refuses cross-site requests even for anonymous routes, so the authorization
server's redirect never reached the callback route. The callback is now a
webserver/request listener that handles only the redirect URI's own
authority and path and passes every other request on.
Delegation and list_subagent_models read the Host subagent model-selection setting on every call instead of a per-Session policy event, so settings edits apply immediately in running, restored, and child Sessions. The released event type stays declared but is no longer written or read.
The package entry now default-exports the Host Service `ctx.cliAccounts`
and exports only types. A CLI app plugin calls `register` once with its
CLI, account, and Plugins page text; the Service adds the CLI path to
runtime context, runs the account operations, registers the account on
the Plugins page, and withdraws all of it when the plugin unloads.
`commandTimeoutMs` is one Service setting. The base bundle loads the
Service, so the package gains locale metadata and leaves the library
and optional-package lists.
The lower branch merged master, which added a fetch of the remote base branch
to worktree creation. On this branch a Session opened in a linked checkout can
create worktrees, and the fetch writes the Git directory that checkout shares
outside its root. The fetch now runs under the policy resolved after
`prepare`, which grants that directory, as the later writes do. A real-sandbox
test fetches from a linked checkout.
* feat(forge): name worktree branches, start them from remote branches, and show changes being read
The New Session worktree option's base menu now searches local branches and
each remote's branches, pins the current branch and every remote's default
branch, and names each remote group by its repository. Its last row opens a
dialog that names the new branch, starting from `worktreePrefix` and checking
Git's branch-name rules; the Host refuses an invalid or taken name. A request
records the full ref of its base and the optional name; every attempt uses the
name.
A remote-tracking base is fetched first: the worktree service gains a
`fetch` request field and a `fetch` phase, fetching only that branch without
tags. A failed fetch leaves the message waiting with Retry, Use the last
fetched version, and Continue without a worktree; a taken name offers Rename.
While the changes view reads changes it has not shown yet, it says
"Reading changes" above file card placeholders, and the files menu names no
count.
* fix(worktree): forward only the declared create_worktree arguments
The create_worktree parameter object is open, and the tool passed it to the
worktree runtime unchanged. Now that a runtime request can ask to fetch, an
undeclared `fetch: true` from the model would have fetched, or refused a local
`from`. The tool now forwards only `name` and `from`, so it never fetches.
* docs(forge): say that only generated worktree branch names come from the Session id
* fix(forge): keep the collapsed change request status on one line
In the Session panel the collapsed card's number line kept every part at
full width inside a clipping row, so a narrow panel cut the most urgent
flag off without an ellipsis, such as "有冲突" after "3 项检查失败".
The number and status now form one MarqueeText line as wide as the row.
While the line with failed checks does not fit, they take the shorter
wording without their count; a line that still does not fit ends in an
ellipsis and crawls into view with the title while the pointer rests on
the card's head. The line measures again when its width or the fonts
change. Expanded cards keep their branch names as before.
* fix(forge): hide remote credentials and read the branch a tag shares its name with
The base menu named an unrecognized remote's group by its fetch URL as
`git remote -v` prints it, so a token in the URL, such as
`https://oauth2:[email protected]/...`, reached the browser and showed
in the menu. The group now shows the URL without its user name and password.
Inspection read the checked-out branch with `symbolic-ref --short HEAD`,
which prints `heads/main` while a tag is also named `main`; the New Session
option then requested `refs/heads/heads/main` and every worktree attempt
failed. Inspection now reads the full ref and takes the name under
`refs/heads/`, so the option, the pinned current branch, and the checkout
row name `main`. HEAD that names a ref outside `refs/heads/` reads as no
branch.
* test(worktree): set up nested remotes and line endings the CI runners' Git accepts
Git 2.55 on the CI runners refuses `git remote add team` next to an
existing `team/fork` remote; the check runs only in `git remote add`, so
the longest-remote case now writes the second remote with `git config`, as
configuration written earlier or by hand holds it. The test clone also
turns off `core.autocrlf`, as `repository` does, because the Windows
runner's global setting checked the fetched file out with CRLF.
The lower branch now ignores stored `working-directory/change` events. On this
branch the sandbox test asserts that such an event moves neither the directory
nor the write boundary, the boundary upgrade guide says so again, and the
working-directory README drops the limitation about stored subdirectories.
Earlier releases recorded both a model's `cd` and an entered worktree as
`working-directory/change`, and a log cannot tell them apart. The fold kept
such a directory when it lay inside the Session's original project. That let a
stored `cd` into a subdirectory narrow the workspace once consumers follow the
directory, and dropped a worktree outside the directory a Session was opened in.
Readers now ignore the event: a stored Session resumes in its original project,
or in the directory of its last `workspace-root/change`, and returns to a
worktree through `enter_worktree`. The fold state is the directory alone (state
version 3), and the forge worktree fold reads only `workspace-root/change`
(state version 7). Tests and Web fixtures that simulated a Host move with the
old event record `workspace-root/change`.
The lower branch removed `rootOf` and the `workspaceRoot` projection: a Session
has one directory, read through `ctx.workingDirectory.get`. This merge moves the
consumers of this branch to that read.
- sandbox-policy, workspace-files, and workspace-changes read `get`; the
`recordedRootOf` read is removed. With the working-directory service mounted,
a Session without a header directory is bounded by that service's default
directory.
- The skill catalog, sidebar terminals, project instructions, `@` file
candidates, the LSP workspace, and skill lookup return to the lower branch's
code, which already reads the directory.
- The client helper exports `selectSessionDirectory` and `sessionDirectory`
in place of the `{ root, cwd }` pair; `WorkspaceChangesSummary` keeps `cwd`,
now the directory the turn started in.
- A stored `working-directory/change` inside the project moves the write
boundary and file views with the directory; one outside returns to the project.
`get(session)` is the only read of a Session's directory again. `rootOf` and
the `workspaceRoot` projection are removed: the directory relative paths
resolve from is the workspace root.
The difference the second read expressed lives in the `workingDirectory` fold.
`workspace-root/change`, the event Host moves record, sets the directory. A
stored `working-directory/change`, whose directory the model could choose, sets
it only when the directory lies inside the Session's original project; a
directory outside the project returns the Session to the project, and the next
request's context reports it. The fold state gains the original project, so
its state version is 2. The forge worktree fold reads stored changes by the
same rule.
The subagent manager resolves a child's directory as on master. The compaction
snapshot fixture records its fixed directory as a Host move.