feat(#2584): Phase 3 — scheduler consumer + isolation adapters (#2635)

Final phase of #2584 (ADR-1239 Codex-binding amendment). execute-phase now negotiates dispatch.isolation and dispatches through the matching adapter, so a wave's independent plans run concurrently on six runtimes instead of one — with no runtime=== branch in the scheduler.

harness-worktree passes the host's declared isolation flag (claude, cursor); orchestrator-worktree creates the worktree via the Phase-2 verb and spawns the executor into it with the resolved argv/cwd (codex, opencode, kimi, kimi-code); none stays sequential. Undeclared/unknown/unresolvable isolation degrades to none — never an unisolated parallel run.

Fixes two shipped Phase-2 descriptors that per-host research found would fail at spawn: kimi lacked its headless flag (would launch the interactive TUI and hang the orchestrator), and kimi-code named a non-existent binary (Kimi Code installs as 'kimi'). Adds the worktree-path root confinement Phase 2 deferred here, and leading-dash guards on the resolver's prompt/cwd matching the existing git-argument guard.

Closes #2627

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-07-25 01:50:20 -04:00
committed by GitHub
parent 461c744c31
commit 6ad30f74b6
62 changed files with 1105 additions and 205 deletions

View File

@@ -517,6 +517,7 @@ const capabilities = {
"runtime": "node",
"effortSurface": "argv"
},
"harnessIsolationFlag": "isolation=\"worktree\"",
"hostBehaviors": {
"attributionSource": "settings-json-commit",
"authorsCanonicalWorkflow": true,
@@ -955,7 +956,8 @@ const capabilities = {
"args": [
"exec"
],
"cwdFlag": "--cd"
"cwdFlag": "--cd",
"promptFlag": null
},
"hostBehaviors": {
"reapplyCommand": "$gsd-update --reapply",
@@ -1165,6 +1167,7 @@ const capabilities = {
"runtime": "node",
"effortSurface": "undocumented"
},
"harnessIsolationFlag": "--worktree",
"hostBehaviors": {
"reapplyCommand": "gsd-update --reapply (mention the skill name)",
"frontmatterDialect": "cursor",
@@ -1762,8 +1765,11 @@ const capabilities = {
},
"orchestratorExec": {
"command": "kimi",
"args": [],
"cwdFlag": "--work-dir"
"args": [
"--print"
],
"cwdFlag": "--work-dir",
"promptFlag": "--prompt"
},
"hostBehaviors": {
"reapplyCommand": "/skill:gsd-update --reapply",
@@ -1851,9 +1857,10 @@ const capabilities = {
"runtime": "node"
},
"orchestratorExec": {
"command": "kimi-code",
"command": "kimi",
"args": [],
"cwdFlag": null
"cwdFlag": null,
"promptFlag": "--prompt"
},
"hostBehaviors": {
"reapplyCommand": "/skill:gsd-update --reapply",
@@ -2184,7 +2191,8 @@ const capabilities = {
"args": [
"run"
],
"cwdFlag": "--dir"
"cwdFlag": "--dir",
"promptFlag": null
},
"hostBehaviors": {
"reapplyCommand": "/gsd-update --reapply",
@@ -4414,6 +4422,7 @@ const runtimes = {
"runtime": "node",
"effortSurface": "argv"
},
"harnessIsolationFlag": "isolation=\"worktree\"",
"hostBehaviors": {
"attributionSource": "settings-json-commit",
"authorsCanonicalWorkflow": true,
@@ -4703,7 +4712,8 @@ const runtimes = {
"args": [
"exec"
],
"cwdFlag": "--cd"
"cwdFlag": "--cd",
"promptFlag": null
},
"hostBehaviors": {
"reapplyCommand": "$gsd-update --reapply",
@@ -4913,6 +4923,7 @@ const runtimes = {
"runtime": "node",
"effortSurface": "undocumented"
},
"harnessIsolationFlag": "--worktree",
"hostBehaviors": {
"reapplyCommand": "gsd-update --reapply (mention the skill name)",
"frontmatterDialect": "cursor",
@@ -5215,8 +5226,11 @@ const runtimes = {
},
"orchestratorExec": {
"command": "kimi",
"args": [],
"cwdFlag": "--work-dir"
"args": [
"--print"
],
"cwdFlag": "--work-dir",
"promptFlag": "--prompt"
},
"hostBehaviors": {
"reapplyCommand": "/skill:gsd-update --reapply",
@@ -5304,9 +5318,10 @@ const runtimes = {
"runtime": "node"
},
"orchestratorExec": {
"command": "kimi-code",
"command": "kimi",
"args": [],
"cwdFlag": null
"cwdFlag": null,
"promptFlag": "--prompt"
},
"hostBehaviors": {
"reapplyCommand": "/skill:gsd-update --reapply",
@@ -5413,7 +5428,8 @@ const runtimes = {
"args": [
"run"
],
"cwdFlag": "--dir"
"cwdFlag": "--dir",
"promptFlag": null
},
"hostBehaviors": {
"reapplyCommand": "/gsd-update --reapply",

View File

@@ -1366,9 +1366,31 @@ function validateRuntimeBody(cap) {
'runtime.orchestratorExec.cwdFlag must be a string or null (got: ' + JSON.stringify(oe.cwdFlag) + ')',
);
}
// promptFlag — optional; string or null (#2627, Phase 3). `null`/absent
// means the host takes the executor prompt positionally (codex, opencode);
// a string names the flag that carries it (kimi/kimi-code: --prompt).
if (oe.promptFlag !== undefined && oe.promptFlag !== null && typeof oe.promptFlag !== 'string') {
errors.push(
'runtime.orchestratorExec.promptFlag must be a string or null (got: ' + JSON.stringify(oe.promptFlag) + ')',
);
}
}
}
// harnessIsolationFlag — ADR-1239 Codex-binding amendment (#2584), Phase 3
// (#2627). OPTIONAL top-level field: the counterpart of orchestratorExec for
// `dispatch.isolation: 'harness-worktree'` hosts, naming the host's OWN
// isolation flag that GSD passes on dispatch (claude: isolation="worktree";
// cursor: --worktree). Descriptor data so the scheduler passes a declared
// token instead of branching on a runtime id (ADR-1239: "the per-host
// dispatch invocation ... is descriptor data, not a scheduler branch").
if (r.harnessIsolationFlag !== undefined && (typeof r.harnessIsolationFlag !== 'string' || r.harnessIsolationFlag.length === 0)) {
errors.push(
'runtime.harnessIsolationFlag must be a non-empty string (got: ' + JSON.stringify(r.harnessIsolationFlag) + ')',
);
}
// 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') {