Skip to content

fix(runtime): adopt ZCode 3.17.1 anchors and session features - #243

Merged
kingsword09 merged 2 commits into
mainfrom
fix/runtime-3.17.1
Oct 30, 2026
Merged

kingsword09 merged 2 commits into
mainfrom
fix/runtime-3.17.1

Conversation

@kingsword09

Copy link
Copy Markdown
Owner

Why

Desktop 3.17.1 ships runtime 0.17.1. Running bun run sync:local against it fails immediately:

Required runtime patch shared-config failed: ZCode runtime is incompatible with shared configuration (settings/migration anchors missing).

Three patch anchors moved and two runtime behaviors changed. Without this change the CLI cannot be built against 3.17.1 at all.

What changed

Patch Upstream 0.17.1 change Fix
shared-config (required) The native loader takes a scope: parseConfigFileToRuntimePatchWithDiagnostics(i, t.scope) Match optional trailing arguments; replace only the config value so ,t.scope survives
tui-bridge (required) Prompt admission forwards automationId before commandKind in steerTurn Accept it as an optional prefix in the native steer anchor
detached-agent-lifecycle (optional) Upstream tracks detached lifecycle promises and collects rejections itself Detect the native tracker and report already_present instead of failing
SQLite recovery Compaction and multi-part messages persist through the new commitMessageBundle transaction Add it as an optional replayable write; older stores keep installing

Two tests asserted 0.17.0 behavior:

  • test/node/session-lifecycle.test.cjs — the runtime now writes recorded session features after the first persist, so the stub needs sessionFeatures / sessionFeaturesWrite.
  • test/runtime/shared-oauth.test.ts — project-token transport failures report project_token_http_<status> instead of the generic project_token_request_failed.

New regression coverage in test/sync-runtime.test.ts for the scoped loader (including the unscoped fallback) and for native detached-lifecycle detection.

Verification

Against runtime 0.17.1 (local Desktop 3.17.1):

bun run sync:local   → Prepared zcode-app-cli@3.16.3-41 with 0.17.1
bun run check        → Runtime checks passed ... zcode-runtime 0.17.1
bun run typecheck    → pass
bun run test:unit    → 916 pass / 2 skip / 0 fail
bun run test:runtime → 88 pass / 0 fail
bun run test:tui     → 50 pass / 0 fail
bun run test:node    → 23 pass / 0 fail
bun run check:tui    → all PTY scenarios pass

Backward compatibility against the locked 0.17.0 artifact:

bun run sync:locked  → Prepared zcode-app-cli@3.16.3-41 with 0.17.0
bun run check        → pass
bun run test:runtime:compat → 19 pass / 0 fail
bun run test:node    → 23 pass / 0 fail

CI keeps running release:build (sync:locked), so this PR does not move the runtime lock. The stable update manifest still reports 3.16.3 for darwin/linux/windows; once it publishes 3.17.1, bun run sync will produce 3.17.1-41 and the release flow bumps the build.

Not included (needs a decision)

3.17.1 adds a workspace MCP trust gate. Project-scoped servers (zcode.json, .zcode/config.json, and now .agents/mcp.json) start as untrusted and are never launched until a digest is recorded in ~/.zcode/security/workspace-mcp-trust-v1.json. Observed on the same fixture:

  • 3.16.3: {"status":"failed"} — the project server process actually launches.
  • 3.17.1: {"status":"untrusted","workspaceTrust":{"declarationDigest":"3b40…","trusted":false}} — no process starts.

Desktop grants trust through the workspace/mcp/trust app-server method, but the CLI TUI receives no trust hook in loadStartupOptions and /mcp only supports list/connect/disconnect. workspace/mcp/trust does work over the CLI's app-server client (verified: {accepted:true}, then trusted:true), and the store is shared with Desktop.

I left this out deliberately: bypassing the gate would re-enable auto-launching MCP processes from cloned repositories. The recommended follow-up is a launcher-owned zcode mcp list|trust|untrust command over the public app-server protocol, matching how zcode plugins is built. Say which direction you want and I will implement it as a separate PR.

Desktop 3.17.1 ships runtime 0.17.1, which moves three anchors this
project patches and adds two behaviors the CLI must follow.

- shared-config: the native loader now takes a scope argument
  (`parseConfigFileToRuntimePatchWithDiagnostics(i, t.scope)`). Match
  optional trailing arguments and replace only the config value so
  project-scope parsing keeps working after Desktop settings merge.
- tui-bridge: native prompt admission forwards an automation id ahead
  of the command kind in `steerTurn`. Accept it as an optional prefix.
- detached-agent-lifecycle: upstream now tracks detached lifecycle
  promises and collects rejections itself, so the patch reports
  `already_present` instead of failing the sync.
- sqlite recovery: compaction and multi-part messages persist through
  the new `commitMessageBundle` transaction. Treat it as an optional
  replayable write so older stores keep installing.

Two tests asserted 0.17.0 behavior: session features are now written
after the first persist, and project-token transport failures report
`project_token_http_<status>` instead of the generic request code.

Verified on runtime 0.17.1 (Desktop 3.17.1) and on the locked 0.17.0
artifact: sync, check, typecheck, unit, runtime, TUI and Node suites.
@github-actions

Copy link
Copy Markdown
Contributor

pkg-pr-new preview for commit c1871f87f0298ae127627ff491ef119a789dd23f.

npx --yes https://pkg.pr.new/zcode-app-cli@c1871f8

Full repository URL

This preview uses the selected commit. PR updates publish automatically after CI succeeds; kingsword09 can also request a preview with /pkg-pr-new.

Workflow logs

@kingsword09
kingsword09 merged commit b842afe into main Oct 30, 2026
4 checks passed
@kingsword09
kingsword09 deleted the fix/runtime-3.17.1 branch October 30, 2026 17:20
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.

1 participant