@codetreker/daynight 0.24.1 → 0.24.5
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 +95 -28
- package/config.example.yml +3 -1
- 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/worker/cleanup.js +6 -10
- package/dist/commands/worker/cleanup.js.map +1 -1
- package/dist/commands/worker/coordinator.js +29 -5
- package/dist/commands/worker/coordinator.js.map +1 -1
- package/dist/commands/worker/execution.js +42 -8
- package/dist/commands/worker/execution.js.map +1 -1
- package/dist/commands/worker/herdr/agents.d.ts +12 -9
- package/dist/commands/worker/herdr/agents.js +6 -4
- package/dist/commands/worker/herdr/agents.js.map +1 -1
- package/dist/commands/worker/herdr/arguments.d.ts +4 -1
- package/dist/commands/worker/herdr/arguments.js +31 -7
- package/dist/commands/worker/herdr/arguments.js.map +1 -1
- package/dist/commands/worker/herdr/preflight.js +25 -15
- package/dist/commands/worker/herdr/preflight.js.map +1 -1
- package/dist/commands/worker/herdr.d.ts +3 -10
- package/dist/commands/worker/herdr.js.map +1 -1
- package/dist/commands/worker/prompts.d.ts +1 -0
- package/dist/commands/worker/prompts.js +12 -3
- package/dist/commands/worker/prompts.js.map +1 -1
- package/dist/commands/worker/setup-environment.js +3 -3
- package/dist/commands/worker/setup-environment.js.map +1 -1
- package/package.json +2 -2
- package/dist/commands/skill/skills/using-daynight/references/execute-task-in-managed.md +0 -92
package/README.md
CHANGED
|
@@ -152,13 +152,24 @@ records module ownership and the preserved data layout.
|
|
|
152
152
|
|
|
153
153
|
The public `using-daynight` skill provides task creation, handoff review and
|
|
154
154
|
execution of one specified task. Ordinary execution reads `run-task.md`.
|
|
155
|
-
Worker-started agents use `
|
|
155
|
+
Worker-started agents use `autopilot-managed-task` only when their startup
|
|
156
156
|
prompt explicitly names the `worker-managed` environment, the `using-daynight`
|
|
157
157
|
skill and that mode, together with their assignment. `SKILL.md` routes to the
|
|
158
158
|
selected instructions; ordinary execution does not load managed task rules.
|
|
159
159
|
Shared task inputs, delivery and acceptance rules retain one owner in the bundle.
|
|
160
160
|
The [foreground worker](#worker-configuration-and-startup) constructs that
|
|
161
161
|
explicit assignment and loads the installed managed entry before launch.
|
|
162
|
+
Managed execution follows one assignment through implementation, validation,
|
|
163
|
+
focused PR delivery, CI and review repair, and merge. A valid worker-managed
|
|
164
|
+
assignment already has sufficient authorization for that delivery and PR merge;
|
|
165
|
+
merge as soon as the checks and review conditions are satisfied without asking
|
|
166
|
+
for additional confirmation. Explicit user restrictions, pauses and revocation
|
|
167
|
+
remain binding. Pending CI or
|
|
168
|
+
review stays in execution; demonstrated external blockers return to the worker
|
|
169
|
+
with a checkpoint. Merge requires current-head approval and required checks,
|
|
170
|
+
and platform confirmation; mainline CI after merge is awaited only on explicit
|
|
171
|
+
request. The mode preserves the assigned scope, the original claim and the
|
|
172
|
+
controller's ownership of worktree, branch and workspace cleanup.
|
|
162
173
|
|
|
163
174
|
Install the skill through an interactive terminal:
|
|
164
175
|
|
|
@@ -821,17 +832,19 @@ unchanged.
|
|
|
821
832
|
Local diagnostics inspect tools and integration settings without starting Herdr
|
|
822
833
|
or native agents. Missing prerequisites are reported together; selected-agent
|
|
823
834
|
checks use effective retained native arguments in the setup launch directory.
|
|
824
|
-
Missing native dependencies allow saving with a repair-needed result. Versions
|
|
825
|
-
and hook configuration do not prove provider
|
|
826
|
-
|
|
835
|
+
Missing native dependencies allow saving with a repair-needed result. Versions,
|
|
836
|
+
fixed launch-argument capabilities and hook configuration do not prove provider
|
|
837
|
+
authentication, hook execution, live Herdr protocol, Git access or completed
|
|
838
|
+
delivery.
|
|
827
839
|
Setup does not install tools, edit provider configuration, sign in, clone, open
|
|
828
840
|
worker state or acquire tasks. Unconfirmed probe-process cleanup is a failure,
|
|
829
841
|
including during cancellation.
|
|
830
842
|
|
|
831
843
|
Install Git, Herdr 0.9.5 or newer with protocol 22 capabilities, and the selected
|
|
832
844
|
native agent on PATH. Configure native/provider credentials and the current
|
|
833
|
-
official Herdr SessionStart integration explicitly. Codex
|
|
834
|
-
`--no-daemon
|
|
845
|
+
official Herdr SessionStart integration explicitly. Codex must be 0.135 or newer
|
|
846
|
+
and support hooks, `--no-daemon` and the fixed full-access/hook-trust flags;
|
|
847
|
+
Unix hooks need bash and python3, while Windows hooks need
|
|
835
848
|
PowerShell. Inspect official integration with `herdr integration status`. Missing
|
|
836
849
|
capabilities and native launch failures remain visible;
|
|
837
850
|
the worker does not install or change global native configuration. Git transport
|
|
@@ -933,9 +946,11 @@ pollIntervalMs is a positive safe integer within the timer range.
|
|
|
933
946
|
Repository agent settings override fields independently for the same type.
|
|
934
947
|
Explicit null model or [] args clears that field; switching type clears omitted
|
|
935
948
|
model/args, and args replaces the list. Worker owns cwd/session/model/mode
|
|
936
|
-
arguments
|
|
937
|
-
|
|
938
|
-
|
|
949
|
+
arguments and the fixed full-access policy; conflicting arguments are rejected
|
|
950
|
+
before launch. Configuration loads at startup without hot reload. Each claim
|
|
951
|
+
retains its recorded agent type and native session ID; a restarted agent uses the
|
|
952
|
+
current settings appropriate to that type. Settings for another type are not
|
|
953
|
+
applied to it.
|
|
939
954
|
|
|
940
955
|
New tasks have automatic execution disabled. Enable it explicitly through the
|
|
941
956
|
normal task update workflow after reading the current task and version. Worker
|
|
@@ -1015,6 +1030,23 @@ The saved SQLite session_id still selects resume or fresh startup; an inactive
|
|
|
1015
1030
|
pane's retained reference is not saved as a newly observed session ID. A live
|
|
1016
1031
|
agent keeps its current connection.
|
|
1017
1032
|
|
|
1033
|
+
Startup and recovery prompts identify the assignment as a background task: the
|
|
1034
|
+
agent asks no questions and makes decisions within the task scope and existing
|
|
1035
|
+
authorization. While waiting for review or CI, it waits, checks for results and
|
|
1036
|
+
continues delivery without ending its execution turn. Fixed native full access
|
|
1037
|
+
and folder trust apply to every fresh/resumed process; task delivery remains
|
|
1038
|
+
within its existing business authorization.
|
|
1039
|
+
|
|
1040
|
+
For a still-owned active claim, each patrol observes the live agent. An
|
|
1041
|
+
interactive-ready agent that is not launching and has no first input pending
|
|
1042
|
+
receives a continuation ping when idle or done. Working, blocked, unknown and
|
|
1043
|
+
not-ready agents remain under observation. The ping preserves the original task,
|
|
1044
|
+
claim, worktree and authorization; idle or done does not complete the business
|
|
1045
|
+
task. The driver retains the last input observation in memory and suppresses
|
|
1046
|
+
repeated input while it is unchanged. Unknown submission results require
|
|
1047
|
+
observation before another decision, without blind replay. Terminal cleanup
|
|
1048
|
+
suppresses business pings.
|
|
1049
|
+
|
|
1018
1050
|
A non-NULL saved session ID remains the recovery identity. A different native
|
|
1019
1051
|
ID reported during startup, live reconnection or before deferred input is an
|
|
1020
1052
|
error: the saved ID is retained and that input is not sent. A genuine live
|
|
@@ -1039,16 +1071,35 @@ and does not start a replacement daemon. Detaching leaves worker and tasks
|
|
|
1039
1071
|
running. Original task panes retain their native XDG and private HISTFILE;
|
|
1040
1072
|
client routing comes from the existing attachment descriptor.
|
|
1041
1073
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1074
|
+
Every fresh or resumed native process uses fixed full access and task-folder
|
|
1075
|
+
trust. Copilot receives `--allow-all --no-ask-user --no-sandbox` and per-workspace
|
|
1076
|
+
`COPILOT_ALLOW_ALL=true`, `COPILOT_ASSISTED_APPROVAL=false`, overriding inherited
|
|
1077
|
+
values. Codex receives `--no-daemon`,
|
|
1078
|
+
`--dangerously-bypass-approvals-and-sandbox`,
|
|
1079
|
+
`--dangerously-bypass-hook-trust` and a final `-c` trusted-project override for
|
|
1080
|
+
the task's canonical path, using Codex's normalized Windows trust keys. These
|
|
1081
|
+
invocation settings require no native tool,
|
|
1082
|
+
folder or hook permission confirmation and are not optional configuration.
|
|
1083
|
+
|
|
1084
|
+
Copilot arguments that enable assisted approval or sandboxing, deny tools/URLs,
|
|
1085
|
+
or restrict available tools are rejected. Codex approval/sandbox controls and
|
|
1086
|
+
duplicate worker-owned bypass flags are rejected. Ordinary model, reasoning,
|
|
1087
|
+
logging and additional configuration arguments remain supported. Setup and
|
|
1088
|
+
runtime use read-only native argument-capability probes; unsupported flags or
|
|
1089
|
+
versions fail explicitly.
|
|
1090
|
+
|
|
1091
|
+
The policy applies only to native invocations and task workspaces. Global native
|
|
1092
|
+
configuration, credentials and organization/OS policies keep their existing
|
|
1093
|
+
owners; task delivery still follows its business authorization. Input-readiness
|
|
1094
|
+
and supported Codex composer checks remain. Unknown layouts, missing credentials,
|
|
1095
|
+
integration failures and launch errors stay visible. Use attach for business
|
|
1096
|
+
input. Reconnecting an already alive agent does not promise to resend an input
|
|
1097
|
+
lost across a process interruption.
|
|
1098
|
+
|
|
1099
|
+
During normal reconciliation, when the original claim is absent from a
|
|
1100
|
+
successful complete inventory, the worker asks its agent to release attributable
|
|
1101
|
+
temporary files, services and processes outside the worktree. It waits at most
|
|
1102
|
+
ten minutes for this cleanup attempt, stops the agent, closes its workspace, removes the matching worktree
|
|
1052
1103
|
and marks the local row done. Done, release and force withdrawal have the same terminal
|
|
1053
1104
|
resource rule. Failed stop or deletion retains responsibility and the error.
|
|
1054
1105
|
|
|
@@ -1057,11 +1108,14 @@ worktree deletion validates only its target Git registration and directory.
|
|
|
1057
1108
|
Unrelated repository or sibling-worktree registration errors are reported
|
|
1058
1109
|
separately and do not prevent a healthy agent from stopping.
|
|
1059
1110
|
|
|
1060
|
-
|
|
1061
|
-
idle
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1111
|
+
After the cleanup message is successfully submitted, a subsequent patrol that
|
|
1112
|
+
observes idle completes the cleanup turn and proceeds to stop the agent and
|
|
1113
|
+
close its workspace. Sequence counters and interactive readiness are not
|
|
1114
|
+
required. A pre-notification observation or the submission receipt itself
|
|
1115
|
+
cannot finish cleanup. Failed or unknown notification results retain their error
|
|
1116
|
+
and the current bounded wait, without automatic replay. Reaching the deadline
|
|
1117
|
+
still proceeds through actual stop confirmation. Idle in this terminal cleanup
|
|
1118
|
+
phase does not complete the business task.
|
|
1065
1119
|
|
|
1066
1120
|
Cleanup timing and progress are in memory. Polls do not extend the current
|
|
1067
1121
|
attempt's deadline; after a crash, the next successful reconciliation observes
|
|
@@ -1070,10 +1124,23 @@ may repeat. Separate tasks have independent bounded jobs, so one held RPC does
|
|
|
1070
1124
|
not postpone another task's cleanup. A cleanup already selected in the current
|
|
1071
1125
|
process can continue during later service-read failures.
|
|
1072
1126
|
|
|
1073
|
-
Ctrl+C stops acquisition and
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1127
|
+
Ctrl+C stops acquisition and scheduling, cancels all running jobs including
|
|
1128
|
+
terminal cleanup, and joins them before directly stopping agents and closing
|
|
1129
|
+
their workspaces. Process exit sends no cleanup prompt and does not wait for a
|
|
1130
|
+
cleanup turn. It preserves claims, worktrees, native session IDs and all
|
|
1131
|
+
unfinished active/pending rows, including those whose ownership has ended. The
|
|
1132
|
+
next run uses normal inventory reconciliation to re-enter terminal cleanup for
|
|
1133
|
+
ended claims. External temporary resources may remain after direct interruption.
|
|
1134
|
+
Normal completion, release, withdrawal and manual-control cleanup retain their
|
|
1135
|
+
notification and removal sequence. Pending stop confirmations must settle before the private
|
|
1136
|
+
Herdr instance stops; stop errors remain visible, and uncertain stopping retains
|
|
1137
|
+
that instance and the affected resources. Before closing a verified orphan
|
|
1138
|
+
workspace with no local task row, cleanup and exit save its observed native
|
|
1139
|
+
agent and any live session ID in the existing pending claim index. Restart can
|
|
1140
|
+
then remove its retained worktree and unblock a later claim for the same task.
|
|
1141
|
+
An unknown original agent type retains the workspace with a visible error;
|
|
1142
|
+
current configuration does not establish that historical type. Unproven Git-only
|
|
1143
|
+
resources remain untouched.
|
|
1077
1144
|
|
|
1078
1145
|
stderr and JSONL logs identify worker, platform, Project/task/claim, agent and
|
|
1079
1146
|
known session ID. Startup prints the log location and attach guidance. Routine
|
package/config.example.yml
CHANGED
|
@@ -36,7 +36,9 @@ review:
|
|
|
36
36
|
# choose a native agent and select existing Projects before worker run.
|
|
37
37
|
# Omitted values use these defaults; an empty selection also makes interactive
|
|
38
38
|
# worker run guide Project registration. Native credentials and the official
|
|
39
|
-
# Herdr integration must be configured explicitly.
|
|
39
|
+
# Herdr integration must be configured explicitly. Every fresh/resumed native
|
|
40
|
+
# agent uses fixed full access and task-folder trust; args cannot lower that
|
|
41
|
+
# policy or re-enable permission prompts. Global native configuration is unchanged.
|
|
40
42
|
worker:
|
|
41
43
|
# Used only for new worker repo registrations; independent of review's root.
|
|
42
44
|
repositoryRoot: ~/daynights
|
|
@@ -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
|
|
@@ -9,7 +9,7 @@ export const createCleanupDriver = (deps) => {
|
|
|
9
9
|
const identity = key(input.owner);
|
|
10
10
|
let attempt = attempts.get(identity);
|
|
11
11
|
if (attempt === undefined) {
|
|
12
|
-
attempt = { deadline: deps.now() + 600_000, notified: false,
|
|
12
|
+
attempt = { deadline: deps.now() + 600_000, notified: false, submitted: false };
|
|
13
13
|
attempts.set(identity, attempt);
|
|
14
14
|
deps.emit({ kind: "cleanup-started", ...(input.task === undefined ? {} : { task: input.task }), message: `Cleaning claim ${input.owner.claimId}; this attempt has a ten-minute deadline.` });
|
|
15
15
|
}
|
|
@@ -26,20 +26,16 @@ export const createCleanupDriver = (deps) => {
|
|
|
26
26
|
if (liveAgent(pane) && !attempt.notified && deps.now() < attempt.deadline) {
|
|
27
27
|
attempt.notified = true;
|
|
28
28
|
try {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
&& observation.stateChangeSeq !== null
|
|
32
|
-
&& observation.completionSeq !== null) {
|
|
33
|
-
attempt.baseline = { stateChangeSeq: observation.stateChangeSeq, completionSeq: observation.completionSeq };
|
|
34
|
-
}
|
|
29
|
+
await workerOperation((operation) => deps.herdr.tasks.submitPrompt(context, pane.binding, workerCleanupPrompt(input.owner, attempt.deadline), operation), signal, Math.max(1, Math.min(30_000, attempt.deadline - deps.now())));
|
|
30
|
+
attempt.submitted = true;
|
|
35
31
|
}
|
|
36
32
|
catch (error) {
|
|
37
33
|
deps.emit({ kind: "cleanup-notification-error", ...(input.task === undefined ? {} : { task: input.task }), message: "Cleanup notification failed; the current bounded cleanup attempt continues.", error });
|
|
38
34
|
}
|
|
35
|
+
if (deps.now() < attempt.deadline)
|
|
36
|
+
return false;
|
|
39
37
|
}
|
|
40
|
-
const completed = attempt.
|
|
41
|
-
&& pane.stateChangeSeq !== null && pane.stateChangeSeq > attempt.baseline.stateChangeSeq
|
|
42
|
-
&& pane.completionSeq !== null && pane.completionSeq > attempt.baseline.completionSeq;
|
|
38
|
+
const completed = attempt.submitted && pane.status === "idle";
|
|
43
39
|
if (liveAgent(pane) && !completed && deps.now() < attempt.deadline)
|
|
44
40
|
return false;
|
|
45
41
|
await workerOperation((operation) => deps.herdr.tasks.stopAndClose(context, pane.binding, operation), signal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../../../src/commands/worker/cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKnD,MAAM,GAAG,GAAG,CAAC,KAAoB,EAAU,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;AAEpG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAA2B,EAAE,EAAE;IACjE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IACnD,OAAO;QACL,OAAO,EAAE,KAAK,EAAE,KAAmB,EAAE,SAAyC,EAAE,cAAuB,EAAE,MAAoB,EAAoB,EAAE;YACjJ,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAClC,IAAI,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACrC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,OAAO,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG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AAE,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;gBAChH,CAAC;YACH,CAAC;YACD,IAAI,cAAc;gBAAE,MAAM,eAAe,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAC1I,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,0EAA0E,CAAC,CAAC,CAAC,wDAAwD,EAAE,CAAC,CAAC;YAC9R,OAAO,IAAI,CAAC;QACd,CAAC;QACD,SAAS,EAAE,CAAC,KAAoB,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;KAC1H,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import { setTimeout as delay } from "node:timers/promises";
|
|
3
4
|
import { createCleanupDriver } from "./cleanup.js";
|
|
4
|
-
import { createExecutionDriver, isWorkerCancellation, sameClaim, workerOperation } from "./execution.js";
|
|
5
|
+
import { actualTaskPane, createExecutionDriver, isWorkerCancellation, liveAgent, sameClaim, settleWorkerStops, workerOperation } from "./execution.js";
|
|
5
6
|
const key = (identity) => `${identity.projectId}/${identity.taskId}/${identity.claimId}`;
|
|
6
7
|
const taskKey = (identity) => `${identity.projectId}/${identity.taskId}`;
|
|
7
8
|
const remoteOwner = (origin, task) => {
|
|
@@ -148,10 +149,22 @@ export const createWorkerCoordinator = (options) => {
|
|
|
148
149
|
} });
|
|
149
150
|
jobs.set(identityKey, job);
|
|
150
151
|
};
|
|
152
|
+
const recordMissingClaim = (owner, pane) => {
|
|
153
|
+
const task = options.store.getTask(owner);
|
|
154
|
+
if (task !== null)
|
|
155
|
+
return task;
|
|
156
|
+
if (pane === undefined && !options.herdr.tasks.pendingStops().some((stop) => sameClaim(stop.context, owner) && stop.context.serverOrigin === owner.serverOrigin))
|
|
157
|
+
return null;
|
|
158
|
+
const agent = pane?.kind ?? pane?.nativeSession?.agent;
|
|
159
|
+
if (agent === undefined)
|
|
160
|
+
throw new Error(`Cannot preserve ownership of ${key(owner)} without an observed native agent type; retain its Herdr resources and private instance.`);
|
|
161
|
+
// Persist ownership before a stop can close the only workspace proving it.
|
|
162
|
+
return options.store.registerPending({ ...owner, agent, sessionId: pane !== undefined && liveAgent(pane) && pane.nativeSession !== null ? pane.nativeSession.sessionId : null });
|
|
163
|
+
};
|
|
151
164
|
const runCleanup = async (owner, deleteWorktree, signal) => {
|
|
152
165
|
while (true) {
|
|
153
166
|
const resources = await workerOperation((operation) => options.herdr.tasks.listResources(operation), signal);
|
|
154
|
-
const task =
|
|
167
|
+
const task = recordMissingClaim(owner, actualTaskPane(owner, resources));
|
|
155
168
|
const completed = await cleanup.advance({ owner, project: projectFor(owner), ...(task === null ? {} : { task }) }, resources, deleteWorktree, signal);
|
|
156
169
|
if (completed) {
|
|
157
170
|
if (deleteWorktree && task !== null && task.status !== "done")
|
|
@@ -344,8 +357,7 @@ export const createWorkerCoordinator = (options) => {
|
|
|
344
357
|
shutdown: async () => {
|
|
345
358
|
shuttingDown = true;
|
|
346
359
|
for (const running of controllers.values())
|
|
347
|
-
|
|
348
|
-
running.controller.abort(new Error("Worker shutdown requested."));
|
|
360
|
+
running.controller.abort(new Error("Worker shutdown requested."));
|
|
349
361
|
await Promise.all(jobs.values());
|
|
350
362
|
let complete = true;
|
|
351
363
|
const owners = new Map(ending);
|
|
@@ -386,7 +398,19 @@ export const createWorkerCoordinator = (options) => {
|
|
|
386
398
|
}));
|
|
387
399
|
await Promise.all([...owners.values()].map(async (owner) => {
|
|
388
400
|
try {
|
|
389
|
-
await serialize(owner, () =>
|
|
401
|
+
await serialize(owner, async () => {
|
|
402
|
+
if (options.store.getTask(owner) === null) {
|
|
403
|
+
const observed = await workerOperation((operation) => options.herdr.tasks.listResources(operation));
|
|
404
|
+
recordMissingClaim(owner, actualTaskPane(owner, observed));
|
|
405
|
+
}
|
|
406
|
+
await settleWorkerStops(deps, owner);
|
|
407
|
+
const resources = await workerOperation((operation) => options.herdr.tasks.listResources(operation));
|
|
408
|
+
const pane = actualTaskPane(owner, resources);
|
|
409
|
+
if (pane === undefined)
|
|
410
|
+
return;
|
|
411
|
+
const context = { ...owner, cwd: path.join(projectFor(owner).localPath, ".worktrees", "daynight", owner.taskId) };
|
|
412
|
+
await workerOperation((operation) => options.herdr.tasks.stopAndClose(context, pane.binding, operation));
|
|
413
|
+
});
|
|
390
414
|
}
|
|
391
415
|
catch (error) {
|
|
392
416
|
complete = false;
|