@codetreker/daynight 0.24.3 → 0.25.0
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 +177 -27
- package/dist/commands/skill/skills/using-daynight/SKILL.md +6 -1
- package/dist/commands/skill/skills/using-daynight/references/autopilot-managed-task.md +205 -0
- package/dist/commands/skill/skills/using-daynight/references/handbook.md +6 -2
- package/dist/commands/skill/skills/using-daynight/references/task-content.md +3 -0
- package/dist/commands/worker/coordinator.js +78 -31
- package/dist/commands/worker/coordinator.js.map +1 -1
- package/dist/commands/worker/definition.js +6 -1
- package/dist/commands/worker/definition.js.map +1 -1
- package/dist/commands/worker/diagnostics.js +2 -1
- package/dist/commands/worker/diagnostics.js.map +1 -1
- package/dist/commands/worker/execution.d.ts +2 -0
- package/dist/commands/worker/execution.js +5 -5
- package/dist/commands/worker/execution.js.map +1 -1
- package/dist/commands/worker/herdr/agents.d.ts +6 -9
- package/dist/commands/worker/herdr/agents.js +78 -37
- package/dist/commands/worker/herdr/agents.js.map +1 -1
- package/dist/commands/worker/herdr/codex-install-safety.d.ts +2 -0
- package/dist/commands/worker/herdr/codex-install-safety.js +104 -0
- package/dist/commands/worker/herdr/codex-install-safety.js.map +1 -0
- package/dist/commands/worker/herdr/instance.d.ts +2 -0
- package/dist/commands/worker/herdr/instance.js +44 -3
- package/dist/commands/worker/herdr/instance.js.map +1 -1
- package/dist/commands/worker/herdr/preflight.d.ts +1 -0
- package/dist/commands/worker/herdr/preflight.js +60 -7
- package/dist/commands/worker/herdr/preflight.js.map +1 -1
- package/dist/commands/worker/herdr.d.ts +2 -1
- package/dist/commands/worker/herdr.js +1 -0
- package/dist/commands/worker/herdr.js.map +1 -1
- package/dist/commands/worker/index.d.ts +5 -0
- package/dist/commands/worker/index.js +5 -0
- package/dist/commands/worker/index.js.map +1 -1
- package/dist/commands/worker/migration-state.d.ts +40 -0
- package/dist/commands/worker/migration-state.js +197 -0
- package/dist/commands/worker/migration-state.js.map +1 -0
- package/dist/commands/worker/migration.d.ts +21 -0
- package/dist/commands/worker/migration.js +406 -0
- package/dist/commands/worker/migration.js.map +1 -0
- package/dist/commands/worker/prompts.js +3 -3
- package/dist/commands/worker/prompts.js.map +1 -1
- package/dist/commands/worker/resource-owner.d.ts +5 -0
- package/dist/commands/worker/resource-owner.js +29 -0
- package/dist/commands/worker/resource-owner.js.map +1 -0
- package/dist/commands/worker/runtime.js +3 -0
- package/dist/commands/worker/runtime.js.map +1 -1
- package/dist/commands/worker/types.d.ts +0 -1
- package/dist/commands/worker/worktrees.js +5 -3
- package/dist/commands/worker/worktrees.js.map +1 -1
- package/package.json +3 -2
- package/dist/commands/skill/skills/using-daynight/references/execute-task-in-managed.md +0 -92
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ GitHub CLI and Copilot CLI on `PATH`.
|
|
|
22
22
|
- [Task deletion](#task-deletion)
|
|
23
23
|
- [Task attachments](#task-attachments)
|
|
24
24
|
- [Worker configuration and startup](#worker-configuration-and-startup)
|
|
25
|
+
- [Worker workspace upgrade](#worker-workspace-upgrade)
|
|
25
26
|
- [Worker manual management](#worker-manual-management)
|
|
26
27
|
- [Review configuration and startup](#review-configuration-and-startup)
|
|
27
28
|
- [Review status listing](#review-status-listing)
|
|
@@ -101,6 +102,7 @@ daynight worker # Show worker help
|
|
|
101
102
|
daynight worker setup # Check prerequisites and choose an agent and Projects
|
|
102
103
|
daynight worker run # Run until interrupted
|
|
103
104
|
daynight worker attach # Open the worker Herdr session
|
|
105
|
+
daynight worker migrate-workspaces [--rollback]
|
|
104
106
|
daynight worker repo list [--json]
|
|
105
107
|
daynight worker repo add [--project <project-id>]
|
|
106
108
|
daynight worker repo remove [--project <project-id>]
|
|
@@ -152,13 +154,24 @@ records module ownership and the preserved data layout.
|
|
|
152
154
|
|
|
153
155
|
The public `using-daynight` skill provides task creation, handoff review and
|
|
154
156
|
execution of one specified task. Ordinary execution reads `run-task.md`.
|
|
155
|
-
Worker-started agents use `
|
|
157
|
+
Worker-started agents use `autopilot-managed-task` only when their startup
|
|
156
158
|
prompt explicitly names the `worker-managed` environment, the `using-daynight`
|
|
157
159
|
skill and that mode, together with their assignment. `SKILL.md` routes to the
|
|
158
160
|
selected instructions; ordinary execution does not load managed task rules.
|
|
159
161
|
Shared task inputs, delivery and acceptance rules retain one owner in the bundle.
|
|
160
162
|
The [foreground worker](#worker-configuration-and-startup) constructs that
|
|
161
163
|
explicit assignment and loads the installed managed entry before launch.
|
|
164
|
+
Managed execution follows one assignment through implementation, validation,
|
|
165
|
+
focused PR delivery, CI and review repair, and merge. A valid worker-managed
|
|
166
|
+
assignment already has sufficient authorization for that delivery and PR merge;
|
|
167
|
+
merge as soon as the checks and review conditions are satisfied without asking
|
|
168
|
+
for additional confirmation. Explicit user restrictions, pauses and revocation
|
|
169
|
+
remain binding. Pending CI or
|
|
170
|
+
review stays in execution; demonstrated external blockers return to the worker
|
|
171
|
+
with a checkpoint. Merge requires current-head approval and required checks,
|
|
172
|
+
and platform confirmation; mainline CI after merge is awaited only on explicit
|
|
173
|
+
request. The mode preserves the assigned scope, the original claim and the
|
|
174
|
+
controller's ownership of worktree, branch and workspace cleanup.
|
|
162
175
|
|
|
163
176
|
Install the skill through an interactive terminal:
|
|
164
177
|
|
|
@@ -830,14 +843,47 @@ worker state or acquire tasks. Unconfirmed probe-process cleanup is a failure,
|
|
|
830
843
|
including during cancellation.
|
|
831
844
|
|
|
832
845
|
Install Git, Herdr 0.9.5 or newer with protocol 22 capabilities, and the selected
|
|
833
|
-
native agent on PATH
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
846
|
+
native agent on PATH and configure native/provider credentials. Before each
|
|
847
|
+
fresh or resumed native launch, runtime preflight reads the selected agent's
|
|
848
|
+
official integration through the private daemon. A `current` integration causes
|
|
849
|
+
no installation write. Only `not_installed` or `outdated` triggers the official
|
|
850
|
+
`integration.install` RPC with `{target: agent}`; preflight then reads the state
|
|
851
|
+
again and requires `current`. Missing, duplicate, malformed or unknown integration
|
|
852
|
+
metadata fails without repair. Each launch makes its own integration requests to
|
|
853
|
+
the private daemon, whose official handler performs the installation.
|
|
854
|
+
|
|
855
|
+
The official installer can update native configuration and hook assets in the
|
|
856
|
+
provider home used by the private daemon. Codex repair requires a live private
|
|
857
|
+
daemon started by the current worker, so its native environment matches the
|
|
858
|
+
configuration being checked. An adopted daemon's environment cannot be verified
|
|
859
|
+
through the API; stop and restart the worker normally before attempting Codex
|
|
860
|
+
repair in that case. Repair also requires the audited Herdr 0.9.5 installer and
|
|
861
|
+
checks its projected TOML edit without writing files.
|
|
862
|
+
The original and projected configurations must parse and differ only by enabling
|
|
863
|
+
`features.hooks` and removing the deprecated integration key
|
|
864
|
+
`features.codex_hooks`. Configurations containing date/time values or parser
|
|
865
|
+
constructs whose exact semantics cannot be compared are refused. Inline, dotted
|
|
866
|
+
or quoted feature layouts and multiline strings that this installer would damage
|
|
867
|
+
fail before `integration.install`;
|
|
868
|
+
reformat the affected configuration or use an integration installed safely by
|
|
869
|
+
its owner before retrying. Unknown installer versions also fail before repair;
|
|
870
|
+
already-current integrations keep their ordinary verification path. The check
|
|
871
|
+
compares configuration values; it does not preserve comments or lock out external
|
|
872
|
+
configuration edits between inspection and installation.
|
|
873
|
+
|
|
874
|
+
Preflight still verifies effective hooks and the SessionStart command in the
|
|
875
|
+
actual task directory before launch; installation success alone is insufficient. Installation, verification and
|
|
876
|
+
cancellation failures remain visible and prevent that native launch. An uncertain
|
|
877
|
+
installation outcome is not automatically replayed; a later attempt first reads
|
|
878
|
+
current state. Setup retains its read-only inspection and repair instructions.
|
|
879
|
+
Inspect shell-side integration with `herdr integration status`; its environment
|
|
880
|
+
can differ from the running private daemon's.
|
|
881
|
+
|
|
882
|
+
Codex must be 0.135 or newer and support hooks, `--no-daemon` and the fixed
|
|
883
|
+
full-access/hook-trust flags. Unix hooks need bash and python3, while Windows
|
|
884
|
+
hooks need PowerShell. Native capability and launch failures remain visible.
|
|
885
|
+
Git transport and task tools, such as authenticated GitHub CLI for PR delivery,
|
|
886
|
+
must be ready.
|
|
841
887
|
|
|
842
888
|
Manage individual Project registrations with:
|
|
843
889
|
|
|
@@ -956,6 +1002,31 @@ private Herdr. Each task uses branch `daynight/<task-id>` and directory
|
|
|
956
1002
|
`<repository>/.worktrees/daynight/<task-id>`. Valid claims retain their dirty
|
|
957
1003
|
worktree; task branches and commits remain after terminal cleanup.
|
|
958
1004
|
|
|
1005
|
+
A workspace label starts with the task title and ends with its full stable owner:
|
|
1006
|
+
|
|
1007
|
+
```text
|
|
1008
|
+
Fix worker startup | daynight:{"projectId":"…","taskId":"…","claimId":"…","worktreeId":"…"}
|
|
1009
|
+
```
|
|
1010
|
+
|
|
1011
|
+
The title is display text. Ownership checks and the managed agent name use only
|
|
1012
|
+
those four canonical UUIDs; renaming a task does not change its claim, worktree,
|
|
1013
|
+
agent name or native conversation. Herdr and Git ownership markers share that
|
|
1014
|
+
four-field identity. The configured service address remains available to API
|
|
1015
|
+
requests and the managed assignment, outside resource identity. One retained
|
|
1016
|
+
worker state directory belongs to one configured service.
|
|
1017
|
+
|
|
1018
|
+
The next successful complete claim inventory supplies the latest task title.
|
|
1019
|
+
Changed names are synchronized through Herdr in the task's existing serialized
|
|
1020
|
+
operation, including when execution recovery has reached its limit. An unchanged
|
|
1021
|
+
name sends no rename request. A naming RPC failure reports `workspace-name-error`
|
|
1022
|
+
without spending execution recovery budget or restarting a healthy agent; an
|
|
1023
|
+
unknown result is observed again before a later decision. Ownership, binding and
|
|
1024
|
+
cancellation failures retain their lifecycle semantics. Titles may contain the
|
|
1025
|
+
label delimiter because parsing uses the final owner suffix. Control characters,
|
|
1026
|
+
line separators and bidirectional display controls are escaped as visible text;
|
|
1027
|
+
Unicode titles and emoji remain readable. Full titles and owner IDs are retained,
|
|
1028
|
+
with Herdr responsible for fitting the label into its current terminal width.
|
|
1029
|
+
|
|
959
1030
|
The local database has exactly these business fields:
|
|
960
1031
|
|
|
961
1032
|
```text
|
|
@@ -1009,7 +1080,7 @@ Native recovery uses current resources and the recorded session ID:
|
|
|
1009
1080
|
|---|---|
|
|
1010
1081
|
| Matching agent is alive | Reconnect and observe without resending the startup prompt. |
|
|
1011
1082
|
| Agent needs starting, session_id is present | Resume that native session using the recorded agent type. |
|
|
1012
|
-
| Agent needs starting, session_id is NULL | Emit
|
|
1083
|
+
| Agent needs starting, session_id is NULL | Emit `info`, start a fresh native conversation, and save its ID in the same row. |
|
|
1013
1084
|
|
|
1014
1085
|
When a native process must restart, the worker stops/closes an existing
|
|
1015
1086
|
inactive workspace and creates a new one with the current native environment
|
|
@@ -1085,10 +1156,10 @@ integration failures and launch errors stay visible. Use attach for business
|
|
|
1085
1156
|
input. Reconnecting an already alive agent does not promise to resend an input
|
|
1086
1157
|
lost across a process interruption.
|
|
1087
1158
|
|
|
1088
|
-
|
|
1089
|
-
worker asks its agent to release attributable
|
|
1090
|
-
processes outside the worktree. It waits at most
|
|
1091
|
-
attempt, stops the agent, closes its workspace, removes the matching worktree
|
|
1159
|
+
During normal reconciliation, when the original claim is absent from a
|
|
1160
|
+
successful complete inventory, the worker asks its agent to release attributable
|
|
1161
|
+
temporary files, services and processes outside the worktree. It waits at most
|
|
1162
|
+
ten minutes for this cleanup attempt, stops the agent, closes its workspace, removes the matching worktree
|
|
1092
1163
|
and marks the local row done. Done, release and force withdrawal have the same terminal
|
|
1093
1164
|
resource rule. Failed stop or deletion retains responsibility and the error.
|
|
1094
1165
|
|
|
@@ -1103,8 +1174,8 @@ close its workspace. Sequence counters and interactive readiness are not
|
|
|
1103
1174
|
required. A pre-notification observation or the submission receipt itself
|
|
1104
1175
|
cannot finish cleanup. Failed or unknown notification results retain their error
|
|
1105
1176
|
and the current bounded wait, without automatic replay. Reaching the deadline
|
|
1106
|
-
still proceeds through actual stop confirmation. Idle in this
|
|
1107
|
-
not complete the business task.
|
|
1177
|
+
still proceeds through actual stop confirmation. Idle in this terminal cleanup
|
|
1178
|
+
phase does not complete the business task.
|
|
1108
1179
|
|
|
1109
1180
|
Cleanup timing and progress are in memory. Polls do not extend the current
|
|
1110
1181
|
attempt's deadline; after a crash, the next successful reconciliation observes
|
|
@@ -1113,15 +1184,32 @@ may repeat. Separate tasks have independent bounded jobs, so one held RPC does
|
|
|
1113
1184
|
not postpone another task's cleanup. A cleanup already selected in the current
|
|
1114
1185
|
process can continue during later service-read failures.
|
|
1115
1186
|
|
|
1116
|
-
Ctrl+C stops acquisition and
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1187
|
+
Ctrl+C stops acquisition and scheduling, cancels all running jobs including
|
|
1188
|
+
terminal cleanup, and joins them before directly stopping agents and closing
|
|
1189
|
+
their workspaces. Process exit sends no cleanup prompt and does not wait for a
|
|
1190
|
+
cleanup turn. It preserves claims, worktrees, native session IDs and all
|
|
1191
|
+
unfinished active/pending rows, including those whose ownership has ended. The
|
|
1192
|
+
next run uses normal inventory reconciliation to re-enter terminal cleanup for
|
|
1193
|
+
ended claims. External temporary resources may remain after direct interruption.
|
|
1194
|
+
Normal completion, release, withdrawal and manual-control cleanup retain their
|
|
1195
|
+
notification and removal sequence. Pending stop confirmations must settle before the private
|
|
1196
|
+
Herdr instance stops; stop errors remain visible, and uncertain stopping retains
|
|
1197
|
+
that instance and the affected resources. Before closing a verified orphan
|
|
1198
|
+
workspace with no local task row, cleanup and exit save its observed native
|
|
1199
|
+
agent and any live session ID in the existing pending claim index. Restart can
|
|
1200
|
+
then remove its retained worktree and unblock a later claim for the same task.
|
|
1201
|
+
An unknown original agent type retains the workspace with a visible error;
|
|
1202
|
+
current configuration does not establish that historical type. Unproven Git-only
|
|
1203
|
+
resources remain untouched.
|
|
1120
1204
|
|
|
1121
1205
|
stderr and JSONL logs identify worker, platform, Project/task/claim, agent and
|
|
1122
|
-
known session ID.
|
|
1123
|
-
|
|
1124
|
-
|
|
1206
|
+
known session ID. After credential redaction, the terminal renderer shortens each
|
|
1207
|
+
full hyphenated GUID in context, messages and error chains to its first eight
|
|
1208
|
+
hexadecimal characters, preserving case. Other text stays unchanged. JSONL keeps
|
|
1209
|
+
complete IDs in fields, messages and errors for precise lookup. Startup prints
|
|
1210
|
+
the log location and attach guidance. Routine observations report the first
|
|
1211
|
+
connection and changes to a claim’s waiting or executing phase, terminal or native
|
|
1212
|
+
session. Unchanged polls stay quiet, including
|
|
1125
1213
|
the first poll after a successful start. Claims are tracked independently.
|
|
1126
1214
|
Resource-preservation warnings appear once while continuously observed and
|
|
1127
1215
|
appear again if they clear and return. Actual starts, recoveries, cleanup, manual
|
|
@@ -1131,6 +1219,68 @@ recovery ledger. The
|
|
|
1131
1219
|
[worker requirements](../../docs/spec/daynight-worker.md) and
|
|
1132
1220
|
[design](../../docs/design/daynight-worker.md) own full behavior and validation.
|
|
1133
1221
|
|
|
1222
|
+
## Worker workspace upgrade
|
|
1223
|
+
|
|
1224
|
+
Stop `daynight worker run` and confirm that its private Herdr and native agents
|
|
1225
|
+
have stopped before changing an existing workspace identity format. Normal
|
|
1226
|
+
execution accepts the current four-ID format and reports old labels or Git
|
|
1227
|
+
markers with a migration instruction. It does not interpret legacy ownership
|
|
1228
|
+
while running tasks.
|
|
1229
|
+
|
|
1230
|
+
```bash
|
|
1231
|
+
daynight worker migrate-workspaces
|
|
1232
|
+
```
|
|
1233
|
+
|
|
1234
|
+
This explicit local operation uses the worker instance lock. It validates the old
|
|
1235
|
+
service identity against the configured service, canonical owner IDs, task and
|
|
1236
|
+
native-session records, actual workspace directories and Git administrative
|
|
1237
|
+
ownership fingerprints. Configured project paths keep their logical spelling;
|
|
1238
|
+
ancestor-directory aliases are accepted when Git registration pointers and saved
|
|
1239
|
+
and restored pane working directories resolve to the same physical task path,
|
|
1240
|
+
while the worktree leaf must remain an ordinary directory with matching physical
|
|
1241
|
+
fingerprints. It preserves the SQLite claim/session index, task
|
|
1242
|
+
branches, dirty worktrees and original native conversations. An unfinished
|
|
1243
|
+
execution with legacy resources must have its recorded native session ID;
|
|
1244
|
+
a fresh pending claim without resources does not block migration. Unknown
|
|
1245
|
+
formats, conflicting identities and missing original resources are errors,
|
|
1246
|
+
with the original resources retained. A current-format or resource-free state
|
|
1247
|
+
needs no conversion, and the command returns without starting a daemon.
|
|
1248
|
+
|
|
1249
|
+
Before mutation, migration backs up its affected files below
|
|
1250
|
+
`~/.daynight/worker/workspace-migration-backups/<UUID>/` and persists
|
|
1251
|
+
`~/.daynight/worker/workspace-migration.json`. Run and manual management refuse
|
|
1252
|
+
to proceed while that blocking manifest remains. The backup retains its original
|
|
1253
|
+
manifest, file hashes, private Herdr tree and completion outcome.
|
|
1254
|
+
A maintenance Herdr keeps automatic native-agent restoration disabled and closes
|
|
1255
|
+
only verified legacy task workspaces. Migration waits for its shutdown and reads
|
|
1256
|
+
back the saved layout before rewriting the Git administration `locked` markers
|
|
1257
|
+
with four IDs and their original physical fingerprints. Old automatic recovery
|
|
1258
|
+
snapshots stay with the migration backup so they cannot restore legacy labels.
|
|
1259
|
+
Herdr owns its snapshot and terminal-history writes; the operation does not edit
|
|
1260
|
+
its history fingerprint.
|
|
1261
|
+
|
|
1262
|
+
After successful migration, start `daynight worker run`. It creates task-title
|
|
1263
|
+
workspaces and resumes the original SQLite native session IDs. Workspace/pane
|
|
1264
|
+
IDs and the closed Herdr terminal scrollback are replaced; the native conversation
|
|
1265
|
+
history and task work remain. The operation changes local resource representation,
|
|
1266
|
+
not remote claims or business task status.
|
|
1267
|
+
|
|
1268
|
+
A failed or interrupted migration keeps normal startup blocked. Restore and verify
|
|
1269
|
+
the complete saved state through the same command before retrying the migration:
|
|
1270
|
+
|
|
1271
|
+
```bash
|
|
1272
|
+
daynight worker migrate-workspaces --rollback
|
|
1273
|
+
```
|
|
1274
|
+
|
|
1275
|
+
Rollback requires an incomplete blocking manifest; it cannot revert a completed
|
|
1276
|
+
migration or later execution state. It restores the backed-up Herdr state,
|
|
1277
|
+
database and Git markers as one verified old-format set. It leaves an error and
|
|
1278
|
+
the startup block when restoration cannot be verified. A normal migration request
|
|
1279
|
+
with an incomplete manifest directs the operator to rollback before retrying.
|
|
1280
|
+
Resume an old-format runner only after a successful rollback;
|
|
1281
|
+
use the new runner after migration completes. The [workspace naming decision](../../.agents/notes/implemented/architecture/2026-10-28-worker-workspace-names.md)
|
|
1282
|
+
records the format and the costs of rebuilding the Herdr workspace.
|
|
1283
|
+
|
|
1134
1284
|
## Worker manual management
|
|
1135
1285
|
|
|
1136
1286
|
Stop `daynight worker run` before retry, release or resume. Each command
|
|
@@ -1144,10 +1294,10 @@ Retry performs one attempt for an active claim still owned by this worker:
|
|
|
1144
1294
|
daynight worker retry <task-id> --claim-id <claim-id> --project <project-id>
|
|
1145
1295
|
```
|
|
1146
1296
|
|
|
1147
|
-
It connects the live agent or resumes its recorded native session. NULL
|
|
1148
|
-
|
|
1149
|
-
and agent type remain; pending rows are started through normal run
|
|
1150
|
-
After the attempt, run connects to the actual surviving resource. Retry does not
|
|
1297
|
+
It connects the live agent or resumes its recorded native session. A NULL ID
|
|
1298
|
+
starts a fresh conversation in the same task worktree with an `info` event. The
|
|
1299
|
+
claim and agent type remain; pending rows are started through normal run
|
|
1300
|
+
scheduling. After the attempt, run connects to the actual surviving resource. Retry does not
|
|
1151
1301
|
persist a permit or a cumulative cross-restart budget.
|
|
1152
1302
|
|
|
1153
1303
|
Release validates current Project access, source owner/admin, original claim
|
|
@@ -73,12 +73,17 @@ operations it requires. Do not load every mode by default.
|
|
|
73
73
|
| `create-task <request>` | Preparing or registering persistent work explicitly requested by the user | [Create task](references/create-task.md) |
|
|
74
74
|
| `run-task <task-id>` | Executing one specified ordinary task | [Run task](references/run-task.md) |
|
|
75
75
|
| `handoff <task-id>` | Reviewing an explicitly requested task for handoff and enabling permission after it passes | [Handoff](references/handoff.md) |
|
|
76
|
-
| `
|
|
76
|
+
| `autopilot-managed-task <task-id>` | The worker startup prompt explicitly declares the `worker-managed` environment, this skill, and this mode | [Managed autopilot](references/autopilot-managed-task.md) |
|
|
77
77
|
|
|
78
78
|
The managed execution reference is loaded only for that explicit worker launch;
|
|
79
79
|
ordinary calls do not read it. Task properties, the working directory, and
|
|
80
80
|
environment variables do not select the managed mode. An invocation presented
|
|
81
81
|
as managed with an incomplete launch declaration waits for the missing context.
|
|
82
|
+
A valid worker-managed assignment already carries sufficient authorization for
|
|
83
|
+
its in-scope delivery, including PR merge; deliver it without additional permission
|
|
84
|
+
requests once the required conditions are met. Explicit user restrictions, pause,
|
|
85
|
+
and revocation still apply. The mode executes only that original assignment;
|
|
86
|
+
reading its name does not authorize work or successor selection.
|
|
82
87
|
|
|
83
88
|
For ordinary calls, honor the explicitly selected mode. For `using-daynight`
|
|
84
89
|
without further input, infer the ordinary mode and target from the current
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Autopilot one managed task
|
|
2
|
+
|
|
3
|
+
Use this mode only when the worker's startup prompt explicitly declares the
|
|
4
|
+
`worker-managed` environment, the `using-daynight` skill, and the
|
|
5
|
+
`autopilot-managed-task` mode. It delivers one already-claimed assignment through
|
|
6
|
+
its authorized implementation, validation, PR review, merge, and acceptance.
|
|
7
|
+
Read [the handbook](handbook.md) for CLI operations and failure semantics.
|
|
8
|
+
|
|
9
|
+
## Establish the assignment
|
|
10
|
+
|
|
11
|
+
The startup prompt supplies `projectId`, `taskId`, the original `claimId`,
|
|
12
|
+
`worktreeId`, the actual worktree path and branch, and the configuration selected
|
|
13
|
+
for this invocation. Use that explicit assignment throughout execution and recovery.
|
|
14
|
+
Task properties, the working directory, environment variables, and an ordinary
|
|
15
|
+
conversation request do not establish this managed context.
|
|
16
|
+
|
|
17
|
+
If a call is presented as managed but its launch declaration or assignment is
|
|
18
|
+
missing, incomplete, or mismatched, return waiting without task or business
|
|
19
|
+
writes. Do not infer replacement values or fall back to ordinary execution,
|
|
20
|
+
claiming, starting, or selecting another task.
|
|
21
|
+
|
|
22
|
+
A valid worker-managed assignment already carries sufficient authorization for
|
|
23
|
+
its in-scope delivery, including PR merge. Do not request additional permission
|
|
24
|
+
for those steps. Honor explicit user restrictions, pause requests, and
|
|
25
|
+
revocation. The assignment does not authorize unrelated backlog work, production
|
|
26
|
+
deployment, destructive data operations, or changes to permissions or protections.
|
|
27
|
+
Reading, editing, or mentioning this mode does not establish a managed assignment
|
|
28
|
+
or activate the separately installed `autopilot` skill, which is not a runtime
|
|
29
|
+
dependency.
|
|
30
|
+
|
|
31
|
+
The worker produces the launch prompt and decides subsequent scheduling. A new
|
|
32
|
+
agent started to recover the same claim receives the original mode and
|
|
33
|
+
assignment again. Reconnecting an existing live agent does not imply that the
|
|
34
|
+
startup prompt should be submitted again.
|
|
35
|
+
|
|
36
|
+
## Verify the existing execution
|
|
37
|
+
|
|
38
|
+
Read the latest complete task using the supplied project and task IDs:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
daynight task show <task-id> --project <project-id> --json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Verify its `projectId` and `id`, `status=in_progress`, and
|
|
45
|
+
`properties.worker.state=active` with the supplied `claimId` and `worktreeId`.
|
|
46
|
+
Verify the actual working directory and Git branch match the supplied worktree.
|
|
47
|
+
Use the configuration supplied for this invocation. The controller selects the
|
|
48
|
+
current settings appropriate to the recorded agent when it launches or resumes
|
|
49
|
+
a native process; an executor does not independently replace that assignment.
|
|
50
|
+
If the same claim is already `completed` and the task is `done`, report the
|
|
51
|
+
existing completion and return without reexecuting it. Any other state or
|
|
52
|
+
identity mismatch leaves execution waiting; an observed claim change stops
|
|
53
|
+
business writes immediately.
|
|
54
|
+
|
|
55
|
+
The worker has already claimed and started this task. Do not claim it, set it
|
|
56
|
+
to `in_progress`, select candidates, or rerun automatic candidate qualification.
|
|
57
|
+
Read and apply [shared task execution](task-execution.md) for the complete task
|
|
58
|
+
and stage inputs, current prerequisites, authorized work, evidence, and
|
|
59
|
+
acceptance. A missing required input or unmet prerequisite keeps this assignment
|
|
60
|
+
waiting in `in_progress`; it does not authorize another task.
|
|
61
|
+
|
|
62
|
+
Before resuming interrupted work or making task writes, refresh the complete
|
|
63
|
+
task using the supplied project and task IDs and verify the same active claim.
|
|
64
|
+
Retain the original claim ID through recovery and uncertain-write
|
|
65
|
+
reconciliation; never substitute a claim read from the task.
|
|
66
|
+
|
|
67
|
+
## Execute within controller-owned resources
|
|
68
|
+
|
|
69
|
+
Use the supplied worktree and branch for authorized edits, commits, pushes, and
|
|
70
|
+
merges. Do not create, switch, or remove the system-managed worktree or branch.
|
|
71
|
+
Avoid merge options such as `gh pr merge --delete-branch` that may switch the
|
|
72
|
+
checkout or delete its branch. The worker owns resource cleanup after execution;
|
|
73
|
+
do not delete its worktree or close its workspace. Follow a cleanup request for
|
|
74
|
+
attributable temporary resources outside the worktree within its stated scope.
|
|
75
|
+
|
|
76
|
+
Use the Goal protocol for this task's required inputs and stage acceptance.
|
|
77
|
+
This mode never advances a Goal stage or executes a successor. The shared
|
|
78
|
+
execution and acceptance rules do not change that boundary.
|
|
79
|
+
|
|
80
|
+
## Preserve execution continuity
|
|
81
|
+
|
|
82
|
+
Keep a compact checkpoint in the host's session state or the project's existing
|
|
83
|
+
local planning mechanism. Retain the original assignment identities, supplied
|
|
84
|
+
worktree and branch, existing authorization, confirmed scope and acceptance,
|
|
85
|
+
PR URLs and head SHA, validation and review state, blockers, attributable
|
|
86
|
+
resources, and next action. Identify the invocation configuration without
|
|
87
|
+
copying credentials or secrets into checkpoints, task evidence, or logs.
|
|
88
|
+
|
|
89
|
+
Refresh the checkpoint before a long wait or session compaction. On recovery,
|
|
90
|
+
restore it, verify the original active claim, and refresh remote PR state before
|
|
91
|
+
resuming mutations. Reconcile interrupted business work and uncertain writes
|
|
92
|
+
before deciding the next action. A status question does not cancel the assignment;
|
|
93
|
+
honor explicit pause, stop, and authorization changes without discarding its work.
|
|
94
|
+
|
|
95
|
+
## Deliver the assigned task
|
|
96
|
+
|
|
97
|
+
1. **Implement and verify.** Read applicable repository instructions and existing
|
|
98
|
+
mechanisms. Reuse the confirmed task plan and acceptance criteria. Implement
|
|
99
|
+
the complete agreed behavior in the supplied worktree, synchronize affected
|
|
100
|
+
documents, and run relevant checks and behavioral verification. Collaborating
|
|
101
|
+
agents share this assignment and worktree. Use research and independent review
|
|
102
|
+
agents when available and authorized. Reassess the design when repeated
|
|
103
|
+
failures expose a structural problem.
|
|
104
|
+
|
|
105
|
+
2. **Publish the focused change.** For a PR delivery, commit and push authorized
|
|
106
|
+
work promptly using repository conventions, default Git identity, and no AI
|
|
107
|
+
co-author attribution. Create or update the task's focused PR and preserve its
|
|
108
|
+
complete PR list as required by shared execution. Integrate necessary mainline
|
|
109
|
+
updates according to the repository's work-branch rules, resolve conflicts in
|
|
110
|
+
the supplied worktree, and revalidate.
|
|
111
|
+
|
|
112
|
+
3. **Follow CI and review through repair.** Inspect the actual remote PR head,
|
|
113
|
+
checks, review requests, comments, and approvals. Request review through the
|
|
114
|
+
repository's established mechanism. Diagnose failed checks from their logs
|
|
115
|
+
and repair the cause without weakening acceptance. Rerun an
|
|
116
|
+
unchanged failure only after confirming a transient infrastructure cause.
|
|
117
|
+
Each push requires refreshed checks and review for the resulting head.
|
|
118
|
+
|
|
119
|
+
Assess findings against the original scope. Fix introduced Critical/Major
|
|
120
|
+
issues and defects that would make the agreed delivery incorrect. Defer smaller
|
|
121
|
+
or unrelated improvements under the project's tracking rules without executing
|
|
122
|
+
them or creating unauthorized tasks. Use fix, defer, and reject dispositions.
|
|
123
|
+
Reply in each finding's own thread, identify the agent, and resolve handled
|
|
124
|
+
threads according to repository rules. Repeat review and repair until the
|
|
125
|
+
final round has no new Critical/Major findings and remote review requirements
|
|
126
|
+
are satisfied.
|
|
127
|
+
|
|
128
|
+
4. **Merge and confirm.** The assignment already authorizes its in-scope PR
|
|
129
|
+
merge. Immediately before merging, refresh the head SHA, required checks,
|
|
130
|
+
review threads, mergeability, and approvals. Require successful required
|
|
131
|
+
checks, handled blocking review threads, and actual reviewer approval for the
|
|
132
|
+
current head. When required checks, current-head approvals, blocking-thread
|
|
133
|
+
resolution, and mergeability all satisfy the repository's rules, merge
|
|
134
|
+
immediately without requesting additional permission. Never infer approval
|
|
135
|
+
from silence, approve your own PR, weaken checks or protections, or use an
|
|
136
|
+
administrative override. Use the repository's
|
|
137
|
+
permitted linear-history method and bind the merge to the verified head when
|
|
138
|
+
the platform supports it. A changed head or failed precondition requires a
|
|
139
|
+
fresh decision from current state.
|
|
140
|
+
|
|
141
|
+
Confirm the platform reports every necessary delivery PR as merged and record
|
|
142
|
+
each resulting merge commit. An accepted auto-merge request or merge-queue
|
|
143
|
+
entry is not completion. Do not wait for post-merge mainline CI unless the user
|
|
144
|
+
explicitly requires that verification. Continue with required task acceptance
|
|
145
|
+
and evidence after the platform confirms the merge.
|
|
146
|
+
|
|
147
|
+
5. **Record acceptance and close this claim.** Complete the task's confirmed
|
|
148
|
+
acceptance and save readable evidence at its identified owner, including actual
|
|
149
|
+
validation and remaining limitations. Release attributable temporary services,
|
|
150
|
+
probes, and monitoring resources, including those left by failed collaborators,
|
|
151
|
+
while preserving controller-owned resources. Finish that cleanup before
|
|
152
|
+
[original-claim completion](#complete-the-original-claim), because confirmed
|
|
153
|
+
completion allows the worker to stop the agent and remove its workspace.
|
|
154
|
+
|
|
155
|
+
For tasks without a PR delivery path, verify the actual artifact against their
|
|
156
|
+
confirmed acceptance criteria. Do not invent a PR or reviewer gate for those
|
|
157
|
+
tasks. Goal discussion confirmation gates remain mandatory; this assignment
|
|
158
|
+
never authorizes execution of a later Goal stage.
|
|
159
|
+
|
|
160
|
+
## Wait for delivery results
|
|
161
|
+
|
|
162
|
+
Pending PR CI or review is ongoing execution, not external intervention. Use
|
|
163
|
+
bounded watches or yielding polls at reasonable intervals, inspect new results,
|
|
164
|
+
and act on failures and feedback. A polling timeout ends only that poll; keep
|
|
165
|
+
waiting and inspecting results. Do not return merely because a required PR
|
|
166
|
+
remains unmerged while its CI or review is pending. Use the worker's existing
|
|
167
|
+
continuation mechanism; do not claim monitoring continues without one or start
|
|
168
|
+
an independent scheduling service.
|
|
169
|
+
|
|
170
|
+
Continue while useful authorized actions remain. A demonstrated blocker such as
|
|
171
|
+
missing credentials, an unavailable required reviewer, a material unresolved
|
|
172
|
+
decision, an unmet human confirmation gate, or an explicit user restriction or
|
|
173
|
+
revocation that prevents delivery requires external intervention. This is a
|
|
174
|
+
background task: do not ask the user questions. Preserve the concrete blocker, actual task and PR state,
|
|
175
|
+
completed work, minimum needed intervention, and next action in the checkpoint,
|
|
176
|
+
then return waiting to the controller. Preserve the assignment in `in_progress`;
|
|
177
|
+
never treat a blocker or ordinary waiting as completion.
|
|
178
|
+
|
|
179
|
+
## Complete the original claim
|
|
180
|
+
|
|
181
|
+
When [shared acceptance readiness](task-execution.md#confirm-acceptance-readiness)
|
|
182
|
+
is satisfied, all required evidence is readable, and attributable temporary
|
|
183
|
+
resources have been released, reread the complete task, verify the same active
|
|
184
|
+
claim, and finish with the original claim ID and the version observed for that
|
|
185
|
+
decision:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
daynight task set-status <task-id> done --project <project-id> --claim-id <claim-id> --if-version <observed-version>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
This is the final task mutation. Confirm `done`,
|
|
192
|
+
`properties.worker.state=completed`, and the original claim ID in the service
|
|
193
|
+
result. A refused or unconfirmed write never falls back to ordinary completion
|
|
194
|
+
or automatic replay: read the actual task using the supplied project and task
|
|
195
|
+
IDs and reconcile only the original claim. An unreadable result remains
|
|
196
|
+
unconfirmed; an observed claim change stops further business writes.
|
|
197
|
+
|
|
198
|
+
## Return to the controller
|
|
199
|
+
|
|
200
|
+
Return after this task completes or requires demonstrated external intervention.
|
|
201
|
+
Preserve the assignment and waiting checkpoint when a human gate, an explicit
|
|
202
|
+
user restriction or revocation, or unmet acceptance requires that intervention.
|
|
203
|
+
A required PR with pending CI or review follows the ongoing wait above. The worker decides subsequent work
|
|
204
|
+
and owns system-resource cleanup; this mode does not select a successor or advance
|
|
205
|
+
a Goal stage.
|
|
@@ -89,9 +89,13 @@ completion operation: a real completion requires the current owner, active
|
|
|
89
89
|
claim, in-progress task, and exact version, and retains worker history with
|
|
90
90
|
`state=completed`. Omit `--claim-id` for ordinary status setting; refusal never
|
|
91
91
|
causes fallback between these operations. Read the
|
|
92
|
-
[managed
|
|
92
|
+
[managed autopilot reference](autopilot-managed-task.md) only when the worker
|
|
93
93
|
startup prompt explicitly selects that mode; ordinary status operations do not
|
|
94
|
-
load its execution rules.
|
|
94
|
+
load its execution rules. A valid worker-managed assignment already has sufficient
|
|
95
|
+
authorization for its in-scope delivery and PR merge. Its executor merges once the
|
|
96
|
+
required checks, current-head approvals, blocking-thread resolution, and
|
|
97
|
+
mergeability conditions are met without requesting additional permission, while
|
|
98
|
+
honoring explicit user restrictions, pause, and revocation.
|
|
95
99
|
|
|
96
100
|
The service checks the exact version
|
|
97
101
|
before a same-status no-op; it preserves all fields for a current-version no-op
|
|
@@ -6,6 +6,9 @@ private worktree, temporary files, or session-only authorization. The descriptio
|
|
|
6
6
|
and its readable references must together explain the current task completely.
|
|
7
7
|
Use the target repository's document and language rules.
|
|
8
8
|
|
|
9
|
+
Distinguish task requirements from session-only constraints, and record only
|
|
10
|
+
task-specific information in the task.
|
|
11
|
+
|
|
9
12
|
## Six content requirements
|
|
10
13
|
|
|
11
14
|
These are content requirements, not six mandatory headings. Provide each item
|