* feat(#2584): Phase 2 — worktree create verb + orchestrator-exec resolver
Phase 2 of the negotiated executor-isolation feature (ADR-1239 Codex-binding amendment). Two building blocks for `dispatch.isolation: orchestrator-worktree` hosts, both unconsumed — no scheduler wires them yet (that is Phase 3), so no runtime behavior changes.
worktree create verb (planWorktreeCreate / executeWorktreeCreatePlan / cmdWorktreeCreate in worktree-safety.cts, routed via routeWorktree in gsd-tools.cjs): validates the wave base, creates a bounded branch+worktree, records it in the run manifest reusing record-agent 4-field entry shape, returns the executor working directory. Bounded git (10s timeout, degrade-not-throw); all manifest read/parse/validate/dedupe precedes the single git side effect (no unmanifested-orphan on a bad manifest); timeout-only best-effort partial rollback (a clean collision-exit never removes a live peer worktree); fail-closed on bad base, unsafe leading-dash / .. inputs, and malformed/mis-shaped manifest.
resolveOrchestratorExec (host-integration.cts): pure descriptor->argv resolver reading the new runtime.orchestratorExec descriptor field (codex/opencode/kimi/kimi-code), fail-closed on missing/invalid shape. Validator (capability-validator.cjs) + a parity guard asserting every orchestrator-worktree host declares a resolvable orchestratorExec.
Adding the create route edits the installed gsd-core/bin/gsd-tools.cjs, so the golden-install-parity fixtures for all 19 runtimes are regenerated (npm run gen:golden) — the only changed hash is gsd-tools.cjs. CONTEXT.md glossary updated; capability-registry regenerated. Behavioral tests (worktree-safety + host-integration) incl. a fast-check property test and the parity sweep.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: rebuild tracked state-transition.cjs to match #2400 source
The tracked compiled artifact drifted from src/state-transition.cts: #2400 (commit 2bcfaa2e2) added the progress.total_plans frontmatter sync to source but the tracked bin/lib/state-transition.cjs was never rebuilt, so the fix was not shipping to consumers of the compiled artifact. The mandatory build:lib step for Phase 2 surfaced the drift; recompiling makes the already-merged, already-changelogged #2400 fix effective. Artifact-only resync (no source/test change); drift class tracked by #2591.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1316,6 +1316,59 @@ function validateRuntimeBody(cap) {
|
||||
}
|
||||
}
|
||||
|
||||
// orchestratorExec — ADR-1239 Codex-binding amendment (#2584), Phase 2.
|
||||
// OPTIONAL top-level field (sibling of hostBehaviors), like hookEvents:
|
||||
// only hosts whose hostIntegration.dispatch.isolation is
|
||||
// 'orchestrator-worktree' need it, so it is not required on every runtime
|
||||
// descriptor. When present it must be a well-formed exec descriptor for
|
||||
// src/host-integration.cts's resolveOrchestratorExec.
|
||||
if (r.orchestratorExec !== undefined) {
|
||||
if (typeof r.orchestratorExec !== 'object' || r.orchestratorExec === null || Array.isArray(r.orchestratorExec)) {
|
||||
errors.push(
|
||||
'runtime.orchestratorExec must be an object (got: ' +
|
||||
(r.orchestratorExec === null ? 'null' : (Array.isArray(r.orchestratorExec) ? 'array' : typeof r.orchestratorExec)) + ')',
|
||||
);
|
||||
} else {
|
||||
const oe = r.orchestratorExec;
|
||||
|
||||
// S2b: reserved-OWN-KEY guard (CodeQL barrier — inline literal comparisons)
|
||||
if (Object.prototype.hasOwnProperty.call(oe, '__proto__')) {
|
||||
errors.push('runtime.orchestratorExec must not contain reserved key "__proto__"');
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(oe, 'constructor')) {
|
||||
errors.push('runtime.orchestratorExec must not contain reserved key "constructor"');
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(oe, 'prototype')) {
|
||||
errors.push('runtime.orchestratorExec must not contain reserved key "prototype"');
|
||||
}
|
||||
|
||||
// command — required non-empty string; reserved-name guard (CodeQL barrier)
|
||||
if (oe.command === '__proto__' || oe.command === 'constructor' || oe.command === 'prototype') {
|
||||
errors.push('runtime.orchestratorExec.command "' + oe.command + '" is a reserved name');
|
||||
} else if (typeof oe.command !== 'string' || oe.command.length === 0) {
|
||||
errors.push(
|
||||
'runtime.orchestratorExec.command must be a non-empty string (got: ' + JSON.stringify(oe.command) + ')',
|
||||
);
|
||||
}
|
||||
|
||||
// args — optional array of strings
|
||||
if (oe.args !== undefined) {
|
||||
if (!Array.isArray(oe.args) || !oe.args.every((a) => typeof a === 'string')) {
|
||||
errors.push(
|
||||
'runtime.orchestratorExec.args must be an array of strings (got: ' + JSON.stringify(oe.args) + ')',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// cwdFlag — optional; string or null
|
||||
if (oe.cwdFlag !== undefined && oe.cwdFlag !== null && typeof oe.cwdFlag !== 'string') {
|
||||
errors.push(
|
||||
'runtime.orchestratorExec.cwdFlag must be a string or null (got: ' + JSON.stringify(oe.cwdFlag) + ')',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GATE A: installSurface ↔ hooksSurface consistency (DEFECT.GENERATIVE-FIX)
|
||||
// Only check if both fields are valid strings (individual field validators above report type errors).
|
||||
if (typeof r.installSurface === 'string' && typeof r.hooksSurface === 'string') {
|
||||
|
||||
Reference in New Issue
Block a user