delegation-layer 0.1.22 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -164,7 +164,10 @@ Dispatching a task requires:
164
164
 
165
165
  The release contains the supervisor client and daemon and starts a private
166
166
  instance under the state root, recovering it when a control command finds it
167
- stopped. An explicit `--pueue-config` or
167
+ stopped. A reachable compatible daemon is adopted across CLI upgrades without
168
+ stopping it or rewriting its launch record. An explicit supervisor repair
169
+ command is available for a real logical/configuration migration; it preserves
170
+ active work and the legacy journal. An explicit `--pueue-config` or
168
171
  `DELEGATE_PUEUE_CONFIG` can still select an existing compatible supervisor for
169
172
  advanced integrations. Node.js 18 or newer is needed only for the npm-based
170
173
  installers; it is not a runtime requirement for the released Go CLI. Provider
@@ -225,6 +228,26 @@ choices. Per-model effort metadata is independent of the harness-wide list.
225
228
  Discovery exits `0` for `available` or `partial`, `2` for `blocked` or
226
229
  `unavailable`, and `1` for `failed`.
227
230
 
231
+ For Codex's native read-only review command, select `codex:review` and make
232
+ the Git state explicit:
233
+
234
+ ```sh
235
+ delegate --root "$HOME/delegation-state" dispatch \
236
+ --provider codex:review \
237
+ --review-target uncommitted \
238
+ --brief "$PWD/review-brief.txt" \
239
+ --cwd "$HOME/delegation-workspace" \
240
+ --permission read-only \
241
+ --budget 30m \
242
+ --json
243
+ ```
244
+
245
+ Use `base:BRANCH` or `commit:SHA` for a different review target. Review tasks
246
+ are persisted as read-only tasks and do not support continuation or active-turn
247
+ interaction. The brief is retained in the task evidence; Codex's explicit
248
+ review target supplies the native review scope because the Codex CLI does not
249
+ accept a prompt together with these target flags.
250
+
228
251
  If a task reports `status: "timed_out"` and
229
252
  `continuation.resumable: true`, continue the exact session:
230
253
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
- "version": "0.1.22",
3
+ "version": "0.1.27",
4
4
  "description": "Multi-provider AI agent delegation CLI and Agent Skill for running bounded coding tasks across provider CLIs.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
3
  "displayName": "Delegation Layer",
4
- "version": "0.1.22",
4
+ "version": "0.1.27",
5
5
  "description": "Consult external AI harnesses and CCR-configured models for reviews, research, implementation, and debate through the resumable Delegate CLI.",
6
6
  "author": {
7
7
  "name": "Hesham Karam",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delegation-layer",
3
- "version": "0.1.22",
3
+ "version": "0.1.27",
4
4
  "description": "Consult external AI harnesses and CCR-configured models for reviews, research, implementation, and debate through the resumable Delegate CLI.",
5
5
  "author": {
6
6
  "name": "Hesham Karam",
@@ -34,14 +34,27 @@ Do not inspect, authenticate, install, or repair provider CLIs to bypass a
34
34
  Delegate blocker.
35
35
 
36
36
  A reported blocker is a valid final response to a delegation request. It does
37
- not turn that request into an environment-repair task. When a response says
38
- `failure.next_action: "stop_and_report"`, that attempt is finished. Include its
39
- failure in your final response without opening a clarification dialog to choose
40
- a fallback. For `task_record: not_created`, identify the requested destination
41
- and include the saved JSON failure response verbatim. A `task_id` can be returned
42
- even when no task record was created. Do not infer that an unavailable provider
43
- is uninstalled or unauthenticated. Do not append inferred state paths or
44
- provider-setup diagnoses, run diagnostic commands, retry it, or use another integration.
37
+ not turn that request into an environment-repair task. The one lifecycle
38
+ exception is `failure.code: "supervisor_upgrade_required"` with
39
+ `next_action: "run_supervisor_migrate"`: run Delegate's own
40
+ `supervisor migrate` command once with the exact same state root, then retry the
41
+ exact original admission command once only when migration succeeds. Preserve
42
+ its argv and intent: `dispatch` remains `dispatch`, and `continue` remains
43
+ `continue`. The migration response field `next_action: "retry_dispatch"` is a
44
+ protocol name for this command-neutral retry; it never authorizes replacing a
45
+ failed `continue` with a fresh dispatch. This is internal Delegate recovery,
46
+ not Pueue administration. Never run `pueue`, `pueued`, socket inspection,
47
+ process searches, root deletion, or a provider CLI during recovery. Executable
48
+ path or hash drift alone is handled by normal adoption and does not require
49
+ this command.
50
+ When a response says `failure.next_action: "stop_and_report"`, that attempt is
51
+ finished. Include its failure in your final response without opening a
52
+ clarification dialog to choose a fallback. For `task_record: not_created`,
53
+ identify the requested destination and include the saved JSON failure response
54
+ verbatim. A `task_id` can be returned even when no task record was created. Do
55
+ not infer that an unavailable provider is uninstalled or unauthenticated. Do
56
+ not append inferred state paths or provider-setup diagnoses, run diagnostic
57
+ commands, or use another integration.
45
58
  Troubleshooting requires a separate user request. Other independently requested
46
59
  tasks may proceed; the failed attempt must remain reported as failed or blocked.
47
60
 
@@ -77,12 +90,16 @@ tasks may proceed; the failed attempt must remain reported as failed or blocked.
77
90
  foreground until all requested tasks reach a terminal result or an explicit
78
91
  blocker. Do not end a headless turn promising a background notification.
79
92
  Pending publication (exit 3) means keep waiting, not success. When the JSON
93
+ reports `pending.kind: "lifetime-finalization"`, the resident guardian still
94
+ owns cleanup; keep observing that same task without supervisor repair,
95
+ process commands, redispatch, or provider fallback. When the JSON
80
96
  includes an outstanding `interaction.pending_requests` batch, follow
81
97
  [active-task interaction](references/interaction.md) before waiting again. Only detach
82
98
  when the user explicitly requests it, retaining the exact task IDs.
83
- Collection may recover the
84
- saved supervisor only to observe an already-requested budget stop; it never
85
- launches a provider or retries a task.
99
+ Collection may reconcile the saved Pueue binding and recover the guardian
100
+ lifetime only for an already-requested stop. A queue-row end alone cannot
101
+ publish terminal facts; collection never launches a provider or retries a
102
+ task.
86
103
  6. If `failure.next_action` is `recheck`, follow
87
104
  [offline recovery](references/result-handling.md#offline-recovery) once for
88
105
  that task. Rechecking saved evidence does not run the provider again.
@@ -96,15 +113,25 @@ tasks may proceed; the failed attempt must remain reported as failed or blocked.
96
113
  9. Never put credentials, tokens, or unrestricted provider output in a brief,
97
114
  option, receipt, or agent message.
98
115
  10. Permission modes select provider-native behavior, not an independent sandbox.
99
- Providers load their own configuration and extensions. If a task is rejected,
100
- report delegate's evidence; do not assume the user's configuration is faulty
101
- or remove MCP servers, plugins, settings, or credentials to make it pass.
116
+ Providers load their own configuration and extensions. If a task is rejected,
117
+ report delegate's evidence; do not assume the user's configuration is faulty
118
+ or remove MCP servers, plugins, settings, or credentials to make it pass.
102
119
  11. The model chooses ordinary-task fan-out by issuing independent `dispatch`
103
120
  commands concurrently. The private supervisor does not impose a task-count
104
121
  or CPU-based limit. Use this for independent investigation, debate, review,
105
122
  or provider comparison. Concurrent write tasks must use separate workspaces
106
123
  or explicit coordination to avoid file conflicts.
107
124
 
125
+ For an explicit Codex code review, use the discoverable `codex:review` profile
126
+ with one persisted target: `--review-target uncommitted`,
127
+ `--review-target base:BRANCH`, or `--review-target commit:SHA`. It is read-only
128
+ and does not support `--interactive`, continuation, or workspace-write. Use
129
+ ordinary `codex:exec` when the request is a general investigation or asks the
130
+ provider to edit files; the review profile is for Codex's native review
131
+ operation and keeps the reviewed Git state explicit. The brief is retained as
132
+ task evidence; the review target supplies Codex's review scope because its
133
+ native command does not accept a prompt with the target flag.
134
+
108
135
  ## Operating procedure
109
136
 
110
137
  ### 1. Verify the control CLI
@@ -139,7 +166,8 @@ normal task. For an explicitly requested readiness check, see
139
166
  The catalog and `capabilities` response expose supported permission modes,
140
167
  request options, continuation, native interaction, and the read-only mechanism. A read-only
141
168
  capability with `containment: "provider-owned"` selects the provider's native
142
- behavior but is not an independent delegate-owned sandbox. Static discovery
169
+ behavior but is not an independent delegate-owned sandbox. This is separate
170
+ from guardian-owned process-lifetime containment. Static discovery
143
171
  does not prove authentication or live acceptance; use the dispatch or live
144
172
  acceptance result for that evidence.
145
173
 
@@ -257,6 +285,7 @@ for **each attempt**, including requests issued together:
257
285
  | Response | Next action |
258
286
  |---|---|
259
287
  | Usage error, no JSON response | Correct the reported syntax using Delegate help or `providers --json`, then invoke that request again. Parsing failed before admission. |
288
+ | `task_record: not_created`, `failure.code: supervisor_upgrade_required`, and `failure.next_action: run_supervisor_migrate` | Run `delegate --root "<the exact absolute state root used by the failed command>" supervisor migrate --json` once. Retry the exact original admission argv once only after `supervisor_control.state: migrated` and `supervisor_control.next_action: retry_dispatch`; otherwise stop and report the migration response. Preserve an explicit custom root exactly. A failed `continue` must be retried as the same `continue`; never replace it with a fresh `dispatch` or a direct provider call. |
260
289
  | `task_record: not_created` and `failure.next_action: correct_request` | Correct that request and retry it. |
261
290
  | `task_record: not_created` with any other next action | Report that attempt's failure and stop it. Do not diagnose provider setup or substitute an integration. |
262
291
  | `task_record: created` | Use `status` before taking any other action. Do not dispatch again. |
@@ -27,6 +27,11 @@
27
27
  "prompt": "The result says status timed_out and continuation.resumable is true.",
28
28
  "expected": ["delegate continue --task", "new task id", "collect successor", "no fresh unrelated dispatch"]
29
29
  },
30
+ {
31
+ "name": "continue-supervisor-migration",
32
+ "prompt": "An exact-session delegate continue command returned task_record not_created with failure.code supervisor_upgrade_required and failure.next_action run_supervisor_migrate. Migration then returned supervisor_control.state migrated and supervisor_control.next_action retry_dispatch.",
33
+ "expected": ["run same-root supervisor migrate exactly once", "retry the argv-equivalent continue exactly once", "one linked successor", "zero fresh dispatch commands", "zero direct provider calls"]
34
+ },
30
35
  {
31
36
  "name": "blocked-auth",
32
37
  "prompt": "Capability output says live_acceptance.status is blocked.",
@@ -5,7 +5,7 @@
5
5
  "name": "codex-review",
6
6
  "prompt": "Ask Codex to review pricing.py for correctness. Return the finding without editing files.",
7
7
  "external": true,
8
- "provider": "codex:exec",
8
+ "provider": "codex:review",
9
9
  "split": "development",
10
10
  "native_alternative_for": "codex"
11
11
  },
@@ -21,18 +21,27 @@ All paths passed to `--root`, `--cwd`, and `--brief` must be absolute. Add
21
21
  | `delegate logs TASK --json` | Return validated output descriptors | No |
22
22
  | `delegate cancel TASK --json` | Record one explicit stop request | Stops, does not relaunch |
23
23
 
24
+ `delegate supervisor migrate --json` is the single command-neutral recovery
25
+ step for a `supervisor_upgrade_required` admission response. Run it once with
26
+ the failed command's exact root. A successful response names its next action
27
+ `retry_dispatch`, but the original command and argv remain authoritative:
28
+ retry `dispatch` as `dispatch` or `continue` as `continue`, exactly once.
29
+
24
30
  The bundled supervisor is managed by the released CLI under the state root.
25
31
  Collection remains observational. Provider authentication remains the
26
32
  provider’s own responsibility and is never performed by this skill.
27
33
 
28
34
  Dispatch flags:
29
35
 
30
- - `--brief FILE`: bounded task instructions;
36
+ - `--brief FILE`: bounded task instructions; for `codex:review`, the brief is
37
+ retained as task evidence and the explicit review target supplies Codex's
38
+ native scope;
31
39
  - `--cwd ABS`: workspace for the delegated turn;
32
40
  - `--permission read-only|workspace-write`: read-only investigation or authorized unattended write execution, including commands (not independent containment);
33
41
  - `--budget DURATION`: finite turn budget;
34
42
  - `--auto`: let the CLI select a ready provider;
35
43
  - `--provider ID`: preserve the caller’s named harness or provider, resolved through the catalog;
44
+ - `--review-target uncommitted|base:BRANCH|commit:SHA`: select the explicit Git state for `codex:review`; it is required for that read-only profile and unsupported by other profiles;
36
45
  - `--model MODEL` and `--effort VALUE`: provider-advertised choices (CCR requires a model alias);
37
46
  Codex maps effort to TOML `model_reasoning_effort` for ordinary turns or a native
38
47
  turn parameter for interactive turns, while Claude and AGY
@@ -102,7 +111,8 @@ delegate preflight --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE \
102
111
  ```
103
112
 
104
113
  Use `read-only` for investigation or `workspace-write` for authorized edits.
105
- Supply any required provider options, including `--model ALIAS` for `ccr:print`.
114
+ Supply any required provider options, including `--model ALIAS` for `ccr:print`
115
+ and `--review-target TARGET` for `codex:review`.
106
116
  Preflight does not create a task, start the supervisor, or launch a provider.
107
117
  Its result is not proof of live authentication or successful execution. Report
108
118
  `blocked` or `unsupported` results; a readiness request does not authorize
@@ -32,8 +32,13 @@ The follow-up brief is optional. If it is omitted, Delegation Layer reuses the
32
32
  validated predecessor brief. A successful continuation returns a new task ID
33
33
  and links it to the predecessor. Observe and collect the new ID separately. Always retain the original state
34
34
  root, even if a returned command hint omits it. Permission is inherited; do not
35
- add `--permission` to `continue`. Apply the dispatch `task_record` error rules
36
- in [result handling](result-handling.md) before retrying or observing.
35
+ add `--permission` to `continue`. If this exact `continue` returns the
36
+ migration-required `not_created` response, run the same-root supervisor
37
+ migration once and then repeat that argv-equivalent `continue` once after the
38
+ successful migration response. The response field is named `retry_dispatch`,
39
+ but it does not authorize a fresh dispatch. Apply the remaining `task_record`
40
+ error rules in [result handling](result-handling.md) before retrying or
41
+ observing.
37
42
 
38
43
  `mode` describes the provider contract:
39
44
 
@@ -44,6 +49,7 @@ in [result handling](result-handling.md) before retrying or observing.
44
49
 
45
50
  Do not use a guessed session ID, a provider-specific resume command, or a new
46
51
  independent dispatch to recover a timeout. The CLI accepts either a validated
47
- terminal outcome or durable supervisor-ended budget-stop evidence for the
52
+ terminal outcome or a durable Pueue-ended observation backed by a guardian
53
+ lifetime-termination record with independently proven empty scope for the
48
54
  session handoff; without one of those proofs it refuses continuation. Inspect
49
55
  the predecessor again rather than bypassing that boundary.
@@ -5,11 +5,20 @@ the same as a successful provider result.
5
5
 
6
6
  1. Save `task_id` immediately after dispatch or continue.
7
7
  2. For a dispatch or continue error, inspect `task_record` first. When it is
8
- `created`, observe the returned ID with `status`. When it is `not_created`,
9
- do not poll; correct the request only if `failure.next_action` is
10
- `correct_request`, otherwise report and stop. When it is `unknown`, stop and
11
- report without polling or retrying. Status and collect can report
12
- `admission: "unknown"` alongside valid terminal evidence for an existing task.
8
+ `created`, observe the returned ID with `status`. Before applying the generic
9
+ `not_created` stop rule, handle the sole migration exception: when
10
+ `failure.code` is `supervisor_upgrade_required` and `failure.next_action` is
11
+ `run_supervisor_migrate`, run `supervisor migrate` once with the same root.
12
+ Only after it reports `supervisor_control.state: "migrated"` and
13
+ `supervisor_control.next_action: "retry_dispatch"`, retry the exact original
14
+ admission argv once. The retry is command-neutral: `dispatch` remains
15
+ `dispatch`, and `continue` remains `continue`; never create a fresh dispatch
16
+ or call a provider directly to replace a failed continuation. For every
17
+ other `not_created` response, do not poll; correct the request only if
18
+ `failure.next_action` is `correct_request`, otherwise report and stop. When
19
+ `task_record` is `unknown`, stop and report without polling or retrying.
20
+ Status and collect can report `admission: "unknown"` alongside valid terminal
21
+ evidence for an existing task.
13
22
  3. If `status` is `timed_out`, follow the continuation procedure before treating
14
23
  pending publication as a reason to wait. `continuation.resumable: true`
15
24
  permits a linked successor even when no outcome has been published.
@@ -19,14 +28,23 @@ the same as a successful provider result.
19
28
  follow [offline recovery](#offline-recovery) once. Otherwise report the
20
29
  terminal rejection with its diagnostic and evidence. Do not redispatch.
21
30
  6. If `pending.kind` is `interaction`, handle the returned questions using
22
- [interaction guidance](interaction.md) before waiting again. Otherwise, if
23
- `liveness` is queued or running or publication is pending, observe the same
24
- task with a finite watch interval.
31
+ [interaction guidance](interaction.md) before waiting again. If
32
+ `pending.kind` is `lifetime-finalization`, the resident guardian still owns
33
+ cleanup; observe the same task with a finite watch interval and do not run
34
+ supervisor or process commands, redispatch, or call the provider directly.
35
+ Otherwise, if `liveness` is queued or running or publication is pending,
36
+ observe the same task with a finite watch interval.
25
37
  7. If authentication is `blocked`, preserve that neutral state and tell the
26
38
  caller what prerequisite is unavailable without inventing a login command.
27
39
  8. Never relaunch an uncertain task by guessing. Observe only a task whose
28
40
  record is known to exist; the `task_record` decision above takes precedence.
29
41
 
42
+ For an `inspect-provider` failure, preserve the optional
43
+ `failure.inspection.class`, `deadline_state`, and `journal_task_id` fields in
44
+ the report. They are bounded diagnostics, not a new recovery instruction.
45
+ Follow `failure.next_action`; do not infer provider authentication or settings
46
+ from an inspection-worker or supervisor-observation failure.
47
+
30
48
  For `delegate models`, validate the complete JSON envelope before using any
31
49
  fact. Treat `available` and `partial` with exit `0` as observations, preserve
32
50
  `blocked` and `unavailable` with exit `2` as unresolved prerequisites, and
@@ -42,6 +60,10 @@ collection watch, and `4` is a validated rejected outcome.
42
60
 
43
61
  Catalog facts (`verification: "catalog"`) are not runtime proof. Preflight
44
62
  checks static readiness; runtime verification requires the supervised probe.
63
+ For managed runtime-only dispatches, admission accepts the static contract and
64
+ the task's runner performs that probe before provider execution. Always collect
65
+ the created task's outcome; `admission: "admitted"` alone does not prove that
66
+ the provider started or completed the work.
45
67
  Versions and help are observations, not semantic-version allowlists.
46
68
  Authentication is a separate live gate (`not_run`, `passed`, or `blocked`).
47
69
  Report a blocked prerequisite without inventing a login command or retrying.
@@ -1 +1 @@
1
- "For work assigned to an external agent, model, or separate harness session, load the installed agent-integration skill before choosing tools and use Delegate. This includes research, implementation, testing, review, consultation, comparison, and debate, including external collaboration you choose. Discover destinations through Delegate. Preserve requested model IDs, effort, and permissions; do not guess ambiguous model identifiers. For task commands, pass --root \"${DELEGATE_ROOT:-$HOME/delegation-state}\" directly in each shell invocation; reuse that root for dispatch, observation, and continuation, never an invented /tmp root. If the user explicitly requests another root, use that exact path consistently. Keep each concurrent request and its response associated separately. Capture each dispatch response and exit status once; after task_record created, observe that task ID. Never dispatch again merely to recover output or inspect its exit status. Naming a CLI identifies the destination, not a request to bypass Delegate. Earlier assistant-generated direct-launch workflows do not override this preference. Native same-harness subagents remain available unless a separate session is requested. Respect an explicit user choice of another integration; otherwise do not substitute provider CLIs, plugins, or APIs after a Delegate blocker. A stop_and_report failure ends that attempt: report it without retrying, diagnosing setup, or offering a fallback. Continue other independent requests. Keep collection in the foreground until completion or a reported blocker unless the user requested detachment. Pending work is observed through Delegate status, collect, or events, not OS process searches or supervisor commands. Merely discussing or configuring a tool is not delegation."
1
+ "For work assigned to an external agent, model, or separate harness session, load the installed agent-integration skill before choosing tools and use Delegate. This includes research, implementation, testing, review, consultation, comparison, and debate, including external collaboration you choose. Discover destinations through Delegate. Preserve requested model IDs, effort, and permissions; do not guess ambiguous model identifiers. For task commands, pass --root \"${DELEGATE_ROOT:-$HOME/delegation-state}\" directly in each shell invocation; reuse that root for dispatch, observation, and continuation, never an invented /tmp root. If the user explicitly requests another root, use that exact path consistently. Keep each concurrent request and its response associated separately. Capture each dispatch response and exit status once; after task_record created, observe that task ID. Never dispatch again merely to recover output or inspect its exit status. Naming a CLI identifies the destination, not a request to bypass Delegate. Earlier assistant-generated direct-launch workflows do not override this preference. Native same-harness subagents remain available unless a separate session is requested. Respect an explicit user choice of another integration; otherwise do not substitute provider CLIs, plugins, or APIs after a Delegate blocker. Before the generic task_record:not_created stop rule, handle only supervisor_upgrade_required with run_supervisor_migrate: migrate the same root once, then retry the exact original admission argv once after migrated/retry_dispatch; dispatch remains dispatch and continue remains continue, with no fresh dispatch or direct provider call replacing a failed continue. A stop_and_report failure ends that attempt: report it without retrying, diagnosing setup, or offering a fallback. Continue other independent requests. Keep collection in the foreground until completion or a reported blocker unless the user requested detachment. Pending work is observed through Delegate status, collect, or events, not OS process searches or supervisor commands. Merely discussing or configuring a tool is not delegation."
@@ -34,14 +34,27 @@ Do not inspect, authenticate, install, or repair provider CLIs to bypass a
34
34
  Delegate blocker.
35
35
 
36
36
  A reported blocker is a valid final response to a delegation request. It does
37
- not turn that request into an environment-repair task. When a response says
38
- `failure.next_action: "stop_and_report"`, that attempt is finished. Include its
39
- failure in your final response without opening a clarification dialog to choose
40
- a fallback. For `task_record: not_created`, identify the requested destination
41
- and include the saved JSON failure response verbatim. A `task_id` can be returned
42
- even when no task record was created. Do not infer that an unavailable provider
43
- is uninstalled or unauthenticated. Do not append inferred state paths or
44
- provider-setup diagnoses, run diagnostic commands, retry it, or use another integration.
37
+ not turn that request into an environment-repair task. The one lifecycle
38
+ exception is `failure.code: "supervisor_upgrade_required"` with
39
+ `next_action: "run_supervisor_migrate"`: run Delegate's own
40
+ `supervisor migrate` command once with the exact same state root, then retry the
41
+ exact original admission command once only when migration succeeds. Preserve
42
+ its argv and intent: `dispatch` remains `dispatch`, and `continue` remains
43
+ `continue`. The migration response field `next_action: "retry_dispatch"` is a
44
+ protocol name for this command-neutral retry; it never authorizes replacing a
45
+ failed `continue` with a fresh dispatch. This is internal Delegate recovery,
46
+ not Pueue administration. Never run `pueue`, `pueued`, socket inspection,
47
+ process searches, root deletion, or a provider CLI during recovery. Executable
48
+ path or hash drift alone is handled by normal adoption and does not require
49
+ this command.
50
+ When a response says `failure.next_action: "stop_and_report"`, that attempt is
51
+ finished. Include its failure in your final response without opening a
52
+ clarification dialog to choose a fallback. For `task_record: not_created`,
53
+ identify the requested destination and include the saved JSON failure response
54
+ verbatim. A `task_id` can be returned even when no task record was created. Do
55
+ not infer that an unavailable provider is uninstalled or unauthenticated. Do
56
+ not append inferred state paths or provider-setup diagnoses, run diagnostic
57
+ commands, or use another integration.
45
58
  Troubleshooting requires a separate user request. Other independently requested
46
59
  tasks may proceed; the failed attempt must remain reported as failed or blocked.
47
60
 
@@ -77,12 +90,16 @@ tasks may proceed; the failed attempt must remain reported as failed or blocked.
77
90
  foreground until all requested tasks reach a terminal result or an explicit
78
91
  blocker. Do not end a headless turn promising a background notification.
79
92
  Pending publication (exit 3) means keep waiting, not success. When the JSON
93
+ reports `pending.kind: "lifetime-finalization"`, the resident guardian still
94
+ owns cleanup; keep observing that same task without supervisor repair,
95
+ process commands, redispatch, or provider fallback. When the JSON
80
96
  includes an outstanding `interaction.pending_requests` batch, follow
81
97
  [active-task interaction](references/interaction.md) before waiting again. Only detach
82
98
  when the user explicitly requests it, retaining the exact task IDs.
83
- Collection may recover the
84
- saved supervisor only to observe an already-requested budget stop; it never
85
- launches a provider or retries a task.
99
+ Collection may reconcile the saved Pueue binding and recover the guardian
100
+ lifetime only for an already-requested stop. A queue-row end alone cannot
101
+ publish terminal facts; collection never launches a provider or retries a
102
+ task.
86
103
  6. If `failure.next_action` is `recheck`, follow
87
104
  [offline recovery](references/result-handling.md#offline-recovery) once for
88
105
  that task. Rechecking saved evidence does not run the provider again.
@@ -96,15 +113,25 @@ tasks may proceed; the failed attempt must remain reported as failed or blocked.
96
113
  9. Never put credentials, tokens, or unrestricted provider output in a brief,
97
114
  option, receipt, or agent message.
98
115
  10. Permission modes select provider-native behavior, not an independent sandbox.
99
- Providers load their own configuration and extensions. If a task is rejected,
100
- report delegate's evidence; do not assume the user's configuration is faulty
101
- or remove MCP servers, plugins, settings, or credentials to make it pass.
116
+ Providers load their own configuration and extensions. If a task is rejected,
117
+ report delegate's evidence; do not assume the user's configuration is faulty
118
+ or remove MCP servers, plugins, settings, or credentials to make it pass.
102
119
  11. The model chooses ordinary-task fan-out by issuing independent `dispatch`
103
120
  commands concurrently. The private supervisor does not impose a task-count
104
121
  or CPU-based limit. Use this for independent investigation, debate, review,
105
122
  or provider comparison. Concurrent write tasks must use separate workspaces
106
123
  or explicit coordination to avoid file conflicts.
107
124
 
125
+ For an explicit Codex code review, use the discoverable `codex:review` profile
126
+ with one persisted target: `--review-target uncommitted`,
127
+ `--review-target base:BRANCH`, or `--review-target commit:SHA`. It is read-only
128
+ and does not support `--interactive`, continuation, or workspace-write. Use
129
+ ordinary `codex:exec` when the request is a general investigation or asks the
130
+ provider to edit files; the review profile is for Codex's native review
131
+ operation and keeps the reviewed Git state explicit. The brief is retained as
132
+ task evidence; the review target supplies Codex's review scope because its
133
+ native command does not accept a prompt with the target flag.
134
+
108
135
  ## Operating procedure
109
136
 
110
137
  ### 1. Verify the control CLI
@@ -139,7 +166,8 @@ normal task. For an explicitly requested readiness check, see
139
166
  The catalog and `capabilities` response expose supported permission modes,
140
167
  request options, continuation, native interaction, and the read-only mechanism. A read-only
141
168
  capability with `containment: "provider-owned"` selects the provider's native
142
- behavior but is not an independent delegate-owned sandbox. Static discovery
169
+ behavior but is not an independent delegate-owned sandbox. This is separate
170
+ from guardian-owned process-lifetime containment. Static discovery
143
171
  does not prove authentication or live acceptance; use the dispatch or live
144
172
  acceptance result for that evidence.
145
173
 
@@ -257,6 +285,7 @@ for **each attempt**, including requests issued together:
257
285
  | Response | Next action |
258
286
  |---|---|
259
287
  | Usage error, no JSON response | Correct the reported syntax using Delegate help or `providers --json`, then invoke that request again. Parsing failed before admission. |
288
+ | `task_record: not_created`, `failure.code: supervisor_upgrade_required`, and `failure.next_action: run_supervisor_migrate` | Run `delegate --root "<the exact absolute state root used by the failed command>" supervisor migrate --json` once. Retry the exact original admission argv once only after `supervisor_control.state: migrated` and `supervisor_control.next_action: retry_dispatch`; otherwise stop and report the migration response. Preserve an explicit custom root exactly. A failed `continue` must be retried as the same `continue`; never replace it with a fresh `dispatch` or a direct provider call. |
260
289
  | `task_record: not_created` and `failure.next_action: correct_request` | Correct that request and retry it. |
261
290
  | `task_record: not_created` with any other next action | Report that attempt's failure and stop it. Do not diagnose provider setup or substitute an integration. |
262
291
  | `task_record: created` | Use `status` before taking any other action. Do not dispatch again. |
@@ -27,6 +27,11 @@
27
27
  "prompt": "The result says status timed_out and continuation.resumable is true.",
28
28
  "expected": ["delegate continue --task", "new task id", "collect successor", "no fresh unrelated dispatch"]
29
29
  },
30
+ {
31
+ "name": "continue-supervisor-migration",
32
+ "prompt": "An exact-session delegate continue command returned task_record not_created with failure.code supervisor_upgrade_required and failure.next_action run_supervisor_migrate. Migration then returned supervisor_control.state migrated and supervisor_control.next_action retry_dispatch.",
33
+ "expected": ["run same-root supervisor migrate exactly once", "retry the argv-equivalent continue exactly once", "one linked successor", "zero fresh dispatch commands", "zero direct provider calls"]
34
+ },
30
35
  {
31
36
  "name": "blocked-auth",
32
37
  "prompt": "Capability output says live_acceptance.status is blocked.",
@@ -5,7 +5,7 @@
5
5
  "name": "codex-review",
6
6
  "prompt": "Ask Codex to review pricing.py for correctness. Return the finding without editing files.",
7
7
  "external": true,
8
- "provider": "codex:exec",
8
+ "provider": "codex:review",
9
9
  "split": "development",
10
10
  "native_alternative_for": "codex"
11
11
  },
@@ -21,18 +21,27 @@ All paths passed to `--root`, `--cwd`, and `--brief` must be absolute. Add
21
21
  | `delegate logs TASK --json` | Return validated output descriptors | No |
22
22
  | `delegate cancel TASK --json` | Record one explicit stop request | Stops, does not relaunch |
23
23
 
24
+ `delegate supervisor migrate --json` is the single command-neutral recovery
25
+ step for a `supervisor_upgrade_required` admission response. Run it once with
26
+ the failed command's exact root. A successful response names its next action
27
+ `retry_dispatch`, but the original command and argv remain authoritative:
28
+ retry `dispatch` as `dispatch` or `continue` as `continue`, exactly once.
29
+
24
30
  The bundled supervisor is managed by the released CLI under the state root.
25
31
  Collection remains observational. Provider authentication remains the
26
32
  provider’s own responsibility and is never performed by this skill.
27
33
 
28
34
  Dispatch flags:
29
35
 
30
- - `--brief FILE`: bounded task instructions;
36
+ - `--brief FILE`: bounded task instructions; for `codex:review`, the brief is
37
+ retained as task evidence and the explicit review target supplies Codex's
38
+ native scope;
31
39
  - `--cwd ABS`: workspace for the delegated turn;
32
40
  - `--permission read-only|workspace-write`: read-only investigation or authorized unattended write execution, including commands (not independent containment);
33
41
  - `--budget DURATION`: finite turn budget;
34
42
  - `--auto`: let the CLI select a ready provider;
35
43
  - `--provider ID`: preserve the caller’s named harness or provider, resolved through the catalog;
44
+ - `--review-target uncommitted|base:BRANCH|commit:SHA`: select the explicit Git state for `codex:review`; it is required for that read-only profile and unsupported by other profiles;
36
45
  - `--model MODEL` and `--effort VALUE`: provider-advertised choices (CCR requires a model alias);
37
46
  Codex maps effort to TOML `model_reasoning_effort` for ordinary turns or a native
38
47
  turn parameter for interactive turns, while Claude and AGY
@@ -102,7 +111,8 @@ delegate preflight --provider PROVIDER_ID --cwd ABSOLUTE_WORKSPACE \
102
111
  ```
103
112
 
104
113
  Use `read-only` for investigation or `workspace-write` for authorized edits.
105
- Supply any required provider options, including `--model ALIAS` for `ccr:print`.
114
+ Supply any required provider options, including `--model ALIAS` for `ccr:print`
115
+ and `--review-target TARGET` for `codex:review`.
106
116
  Preflight does not create a task, start the supervisor, or launch a provider.
107
117
  Its result is not proof of live authentication or successful execution. Report
108
118
  `blocked` or `unsupported` results; a readiness request does not authorize
@@ -32,8 +32,13 @@ The follow-up brief is optional. If it is omitted, Delegation Layer reuses the
32
32
  validated predecessor brief. A successful continuation returns a new task ID
33
33
  and links it to the predecessor. Observe and collect the new ID separately. Always retain the original state
34
34
  root, even if a returned command hint omits it. Permission is inherited; do not
35
- add `--permission` to `continue`. Apply the dispatch `task_record` error rules
36
- in [result handling](result-handling.md) before retrying or observing.
35
+ add `--permission` to `continue`. If this exact `continue` returns the
36
+ migration-required `not_created` response, run the same-root supervisor
37
+ migration once and then repeat that argv-equivalent `continue` once after the
38
+ successful migration response. The response field is named `retry_dispatch`,
39
+ but it does not authorize a fresh dispatch. Apply the remaining `task_record`
40
+ error rules in [result handling](result-handling.md) before retrying or
41
+ observing.
37
42
 
38
43
  `mode` describes the provider contract:
39
44
 
@@ -44,6 +49,7 @@ in [result handling](result-handling.md) before retrying or observing.
44
49
 
45
50
  Do not use a guessed session ID, a provider-specific resume command, or a new
46
51
  independent dispatch to recover a timeout. The CLI accepts either a validated
47
- terminal outcome or durable supervisor-ended budget-stop evidence for the
52
+ terminal outcome or a durable Pueue-ended observation backed by a guardian
53
+ lifetime-termination record with independently proven empty scope for the
48
54
  session handoff; without one of those proofs it refuses continuation. Inspect
49
55
  the predecessor again rather than bypassing that boundary.
@@ -5,11 +5,20 @@ the same as a successful provider result.
5
5
 
6
6
  1. Save `task_id` immediately after dispatch or continue.
7
7
  2. For a dispatch or continue error, inspect `task_record` first. When it is
8
- `created`, observe the returned ID with `status`. When it is `not_created`,
9
- do not poll; correct the request only if `failure.next_action` is
10
- `correct_request`, otherwise report and stop. When it is `unknown`, stop and
11
- report without polling or retrying. Status and collect can report
12
- `admission: "unknown"` alongside valid terminal evidence for an existing task.
8
+ `created`, observe the returned ID with `status`. Before applying the generic
9
+ `not_created` stop rule, handle the sole migration exception: when
10
+ `failure.code` is `supervisor_upgrade_required` and `failure.next_action` is
11
+ `run_supervisor_migrate`, run `supervisor migrate` once with the same root.
12
+ Only after it reports `supervisor_control.state: "migrated"` and
13
+ `supervisor_control.next_action: "retry_dispatch"`, retry the exact original
14
+ admission argv once. The retry is command-neutral: `dispatch` remains
15
+ `dispatch`, and `continue` remains `continue`; never create a fresh dispatch
16
+ or call a provider directly to replace a failed continuation. For every
17
+ other `not_created` response, do not poll; correct the request only if
18
+ `failure.next_action` is `correct_request`, otherwise report and stop. When
19
+ `task_record` is `unknown`, stop and report without polling or retrying.
20
+ Status and collect can report `admission: "unknown"` alongside valid terminal
21
+ evidence for an existing task.
13
22
  3. If `status` is `timed_out`, follow the continuation procedure before treating
14
23
  pending publication as a reason to wait. `continuation.resumable: true`
15
24
  permits a linked successor even when no outcome has been published.
@@ -19,14 +28,23 @@ the same as a successful provider result.
19
28
  follow [offline recovery](#offline-recovery) once. Otherwise report the
20
29
  terminal rejection with its diagnostic and evidence. Do not redispatch.
21
30
  6. If `pending.kind` is `interaction`, handle the returned questions using
22
- [interaction guidance](interaction.md) before waiting again. Otherwise, if
23
- `liveness` is queued or running or publication is pending, observe the same
24
- task with a finite watch interval.
31
+ [interaction guidance](interaction.md) before waiting again. If
32
+ `pending.kind` is `lifetime-finalization`, the resident guardian still owns
33
+ cleanup; observe the same task with a finite watch interval and do not run
34
+ supervisor or process commands, redispatch, or call the provider directly.
35
+ Otherwise, if `liveness` is queued or running or publication is pending,
36
+ observe the same task with a finite watch interval.
25
37
  7. If authentication is `blocked`, preserve that neutral state and tell the
26
38
  caller what prerequisite is unavailable without inventing a login command.
27
39
  8. Never relaunch an uncertain task by guessing. Observe only a task whose
28
40
  record is known to exist; the `task_record` decision above takes precedence.
29
41
 
42
+ For an `inspect-provider` failure, preserve the optional
43
+ `failure.inspection.class`, `deadline_state`, and `journal_task_id` fields in
44
+ the report. They are bounded diagnostics, not a new recovery instruction.
45
+ Follow `failure.next_action`; do not infer provider authentication or settings
46
+ from an inspection-worker or supervisor-observation failure.
47
+
30
48
  For `delegate models`, validate the complete JSON envelope before using any
31
49
  fact. Treat `available` and `partial` with exit `0` as observations, preserve
32
50
  `blocked` and `unavailable` with exit `2` as unresolved prerequisites, and
@@ -42,6 +60,10 @@ collection watch, and `4` is a validated rejected outcome.
42
60
 
43
61
  Catalog facts (`verification: "catalog"`) are not runtime proof. Preflight
44
62
  checks static readiness; runtime verification requires the supervised probe.
63
+ For managed runtime-only dispatches, admission accepts the static contract and
64
+ the task's runner performs that probe before provider execution. Always collect
65
+ the created task's outcome; `admission: "admitted"` alone does not prove that
66
+ the provider started or completed the work.
45
67
  Versions and help are observations, not semantic-version allowlists.
46
68
  Authentication is a separate live gate (`not_run`, `passed`, or `blocked`).
47
69
  Report a blocked prerequisite without inventing a login command or retrying.
@@ -1 +1 @@
1
- "For work assigned to an external agent, model, or separate harness session, load the installed agent-integration skill before choosing tools and use Delegate. This includes research, implementation, testing, review, consultation, comparison, and debate, including external collaboration you choose. Discover destinations through Delegate. Preserve requested model IDs, effort, and permissions; do not guess ambiguous model identifiers. For task commands, pass --root \"${DELEGATE_ROOT:-$HOME/delegation-state}\" directly in each shell invocation; reuse that root for dispatch, observation, and continuation, never an invented /tmp root. If the user explicitly requests another root, use that exact path consistently. Keep each concurrent request and its response associated separately. Capture each dispatch response and exit status once; after task_record created, observe that task ID. Never dispatch again merely to recover output or inspect its exit status. Naming a CLI identifies the destination, not a request to bypass Delegate. Earlier assistant-generated direct-launch workflows do not override this preference. Native same-harness subagents remain available unless a separate session is requested. Respect an explicit user choice of another integration; otherwise do not substitute provider CLIs, plugins, or APIs after a Delegate blocker. A stop_and_report failure ends that attempt: report it without retrying, diagnosing setup, or offering a fallback. Continue other independent requests. Keep collection in the foreground until completion or a reported blocker unless the user requested detachment. Pending work is observed through Delegate status, collect, or events, not OS process searches or supervisor commands. Merely discussing or configuring a tool is not delegation."
1
+ "For work assigned to an external agent, model, or separate harness session, load the installed agent-integration skill before choosing tools and use Delegate. This includes research, implementation, testing, review, consultation, comparison, and debate, including external collaboration you choose. Discover destinations through Delegate. Preserve requested model IDs, effort, and permissions; do not guess ambiguous model identifiers. For task commands, pass --root \"${DELEGATE_ROOT:-$HOME/delegation-state}\" directly in each shell invocation; reuse that root for dispatch, observation, and continuation, never an invented /tmp root. If the user explicitly requests another root, use that exact path consistently. Keep each concurrent request and its response associated separately. Capture each dispatch response and exit status once; after task_record created, observe that task ID. Never dispatch again merely to recover output or inspect its exit status. Naming a CLI identifies the destination, not a request to bypass Delegate. Earlier assistant-generated direct-launch workflows do not override this preference. Native same-harness subagents remain available unless a separate session is requested. Respect an explicit user choice of another integration; otherwise do not substitute provider CLIs, plugins, or APIs after a Delegate blocker. Before the generic task_record:not_created stop rule, handle only supervisor_upgrade_required with run_supervisor_migrate: migrate the same root once, then retry the exact original admission argv once after migrated/retry_dispatch; dispatch remains dispatch and continue remains continue, with no fresh dispatch or direct provider call replacing a failed continue. A stop_and_report failure ends that attempt: report it without retrying, diagnosing setup, or offering a fallback. Continue other independent requests. Keep collection in the foreground until completion or a reported blocker unless the user requested detachment. Pending work is observed through Delegate status, collect, or events, not OS process searches or supervisor commands. Merely discussing or configuring a tool is not delegation."