The shell.env and experimental.session.compacting hooks dereferenced
output.env and output.prompt unconditionally. When OpenCode invokes a
hook without an output object, this threw TypeError: undefined is not an
object and aborted compaction entirely.
- shell.env: early-return when output is undefined
- experimental.session.compacting: guard the output.prompt/output.context
branches so a missing output no-ops instead of throwing
Add regression tests for both hooks covering the undefined-output case.
Fixes#3934
Cover byte identity without neighbors, ECC's decision unchanged in every mode, the anchored and clear-leader listing rule, Claude user, plugin and project discovery, the CLI snapshot round trip, the launch and hook surfaces, and a fixture on the shipped registry. Require the new module in the npm pack surface.
Exercise the real hook with isolated runtime directories. Verify that raw
cell content stays out of persisted metrics and is not executed, notebook
paths remain inert metadata, and traversal session IDs cannot select a
bridge file. Preserve the hook's pass-through input contract.
The focused notebook and bridge suites pass all 36 cases. Targeted
statement/line, branch and function coverage is 91.9%, 85.18% and 100%.
Changed-file ESLint and diff checks pass.
Resolve both sides of the source_doc containment check with
fs.realpathSync.native (falling back to fs.realpathSync). With the JS
realpath, a repo root reached through a Windows 8.3 short name stays in
short form while an in-repo symlink whose target uses the long-path form
resolves to the long form, so a legitimate in-repo doc was reported as
"resolves outside repository root". Escapes outside the repo are still
rejected.
Adds a cross-platform regression test that models differing JS and
native realpath results: in-repo docs are accepted through a short-form
root and an outside target is still rejected. It fails on the previous
implementation.
Not required for the #3882 Windows CI fix; kept as a separate commit so
it can be taken or dropped on its own.
A registered v1 project has CONTEXT.md but no context.json; init wrote
an empty history over that CONTEXT.md. Stop and point to /ck:migrate
while CONTEXT.md is still there, and only start fresh when neither file
exists. A context whose sessions array holds a null entry passed the
guard, then renderContextMd threw after context.json was rewritten; now
every session entry must be an object before anything is written.
Rebind the skill triggers manifest to the new registry digest.
Refs #3922
With both spellings of a folder registered, list marked both rows as
the current project while save and resume use only the exact one. Pass
the key findProject() selects to renderListTable(), which compares it
exactly again. Rebind the skill triggers manifest to the new registry
digest.
Refs #3924
A context.json that parses but has no sessions array (for example a
JSON array at the root) passed the guard, and init wrote an empty
context over it. Require a sessions array before reusing the context.
Rebind the skill triggers manifest to the new registry digest.
Refs #3922
When a registered project's context.json exists but cannot be parsed,
loadContext() returns null and init wrote a fresh context over the file,
destroying history that could still be recovered by hand. Stop with a
message and leave the files alone instead.
Tests: forgetting a project renamed by init leaves no context directory
behind, and init over an unreadable context.json exits 1 without
touching it. Rebind the skill triggers manifest to the new registry
digest.
Refs #3922