autonomous-sdlc-harness 0.6.2 → 0.6.4

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.
@@ -18,7 +18,7 @@
18
18
  * `LEGACY_TRIGGER_LABEL`)
19
19
  * and the run-control names (`WORKFLOW_CONTROL_*`, `COMMAND_*`, `COMMENT_MARKER`,
20
20
  * `REVIEW_ROUND_STATE`, `STATE_LABEL_PREFIX`, `RUN_STATES`, `STATE_LABELS`, `PR_CREATE_SETTING`,
21
- * `PR_CREATE_SETTING_PATH`) are gated tighter
21
+ * `PR_CREATE_SETTING_PATH`, `MENTION_*`) are gated tighter
22
22
  * still: they are consulted only where `forgeTriggerApplies(config)` is true.
23
23
  *
24
24
  * **Shell and YAML mirrors that must agree byte for byte.** The compiler cannot reach them, so each
@@ -41,6 +41,7 @@
41
41
  * It reads no configuration and writes nothing.
42
42
  */
43
43
  import { spawnSync } from 'node:child_process';
44
+ import { PLUGIN_NAME } from '../core/pluginIdentity.js';
44
45
  import { unquoteYamlScalar } from '../core/yamlScalar.js';
45
46
  /** The adopter-side directory GitHub reads workflows from. */
46
47
  export const WORKFLOWS_DIR = '.github/workflows';
@@ -61,10 +62,43 @@ export const COMMAND_HANDLE = '@sdlc-harness';
61
62
  * replies with the run's state and changes no label and dispatches nothing.
62
63
  */
63
64
  export const COMMAND_VERBS = ['answer', 'pause', 'resume', 'stop', 'clear', 'status'];
65
+ /**
66
+ * The `action` values a mention's decision may carry: `command` names one of {@link COMMAND_VERBS};
67
+ * `reply` and `clarify` carry the agent's text; `fixes` is a request for fixes, answered with the
68
+ * script's own text; `none` means the mention was not addressed to the harness.
69
+ */
70
+ export const MENTION_ACTIONS = ['command', 'reply', 'clarify', 'fixes', 'none'];
71
+ /**
72
+ * How a mention's `command` decision treats each verb; total, so a new verb fails to compile until it
73
+ * is classified. `act` is carried out through that verb's own arm. `confirm` is answered with a
74
+ * request to comment the command itself: `stop` because it is destructive, `clear` because on GitHub
75
+ * typing it is the confirmation `branch-resume` asks for.
76
+ */
77
+ export const MENTION_VERB_HANDLING = {
78
+ answer: 'act',
79
+ pause: 'act',
80
+ resume: 'act',
81
+ stop: 'confirm',
82
+ clear: 'confirm',
83
+ status: 'act',
84
+ };
85
+ /** The verbs {@link MENTION_VERB_HANDLING} marks `act`, in {@link COMMAND_VERBS} order. */
86
+ export const MENTION_ACT_VERBS = COMMAND_VERBS.filter((verb) => MENTION_VERB_HANDLING[verb] === 'act');
87
+ /** The verbs {@link MENTION_VERB_HANDLING} marks `confirm`, in {@link COMMAND_VERBS} order. */
88
+ export const MENTION_CONFIRM_VERBS = COMMAND_VERBS.filter((verb) => MENTION_VERB_HANDLING[verb] === 'confirm');
89
+ /** The basename of the plugin slash command `plugin/commands/harness-read-mention.md`, the slash-command name verbatim. */
90
+ export const MENTION_COMMAND_NAME = 'harness-read-mention';
91
+ /**
92
+ * The plugin-qualified slash command `remote-run.sh control` passes as the session's `-p` prompt, the
93
+ * way `autonomous-watcher.sh` launches the plugin's commands as a session's first message. Built from
94
+ * {@link PLUGIN_NAME} rather than spelled; the CLI never prints it.
95
+ */
96
+ export const MENTION_COMMAND = `/${PLUGIN_NAME}:${MENTION_COMMAND_NAME}`;
64
97
  /**
65
98
  * The prefix of the hidden line every harness comment carries; the whole line is
66
- * `<!-- sdlc-harness event=<event> branch=<branch>[ question=<n>] -->`. A comment containing the
67
- * prefix anywhere is never a command.
99
+ * `<!-- sdlc-harness event=<event> branch=<branch>[ question=<n>][ engine=<engine>] -->`, where
100
+ * `engine=` is carried only by a `reply` posted after a successful dispatch. A comment containing
101
+ * the prefix anywhere is never a command.
68
102
  */
69
103
  export const COMMENT_MARKER = '<!-- sdlc-harness';
70
104
  /** The `review.state` that starts a review round, lowercase as the webhook payload carries it. */
@@ -172,6 +206,14 @@ export function runActorAdmitted(actors, login) {
172
206
  export function carriesRunActors(workflowText) {
173
207
  return workflowText.includes(`vars.${RUN_ACTORS_VARIABLE}`);
174
208
  }
209
+ /**
210
+ * Whether a workflow's text reads `secrets.CLAUDE_CODE_OAUTH_TOKEN` or `secrets.ANTHROPIC_API_KEY`;
211
+ * `false` marks a `harness-control.yml` written before a mention could be read. Pure — the caller
212
+ * reads the file.
213
+ */
214
+ export function carriesMentionCredential(workflowText) {
215
+ return workflowText.includes(`secrets.${OAUTH_TOKEN_SECRET}`) || workflowText.includes(`secrets.${API_KEY_SECRET}`);
216
+ }
175
217
  /** The `repository_dispatch` `event_type` the trigger workflow listens to. */
176
218
  export const TRIGGER_DISPATCH_EVENT_TYPE = 'harness-task';
177
219
  /** Repository secret for subscription billing. */
@@ -1 +1 @@
1
- {"version":3,"file":"githubActions.js","sourceRoot":"","sources":["../../src/remote/githubActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,8DAA8D;AAC9D,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,aAAa,IAAI,iBAAiB,EAAE,CAAC;AAEzE,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,aAAa,IAAI,oBAAoB,EAAE,CAAC;AAE/E,mGAAmG;AACnG,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAC3D,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,aAAa,IAAI,qBAAqB,EAAE,CAAC;AAEjF,mFAAmF;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAC3D,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,aAAa,I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,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAM,aAAa,GAAG,MAAM,CAAC;AAS7B,2FAA2F;AAC3F,MAAM,UAAU,KAAK;IACnB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAChD,OAAO,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC;AACrF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,IAAuB,EAAE,GAAW;IACxD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE;QACtC,GAAG;QACH,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;QACjC,OAAO,EAAE,aAAa;QACtB,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IACH,gGAAgG;IAChG,kFAAkF;IAClF,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrG,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;AAC7F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autonomous-sdlc-harness",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "The outer loop of the autonomous SDLC harness: init, doctor, config and daemon management for the harness Claude Code plugin, plus opt-in local docs retrieval.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "firu-daniel",
@@ -19,9 +19,13 @@
19
19
  # WHAT IT DOES. One job runs `remote-run.sh control`, which does everything
20
20
  # else: it authorises the actor — their write access, then the allow-list
21
21
  # HARNESS_RUN_ACTORS — finds the run's branch, carries out the
22
- # command or places the review round, and replies. Every decision lives in that
23
- # script; this file carries only the events, the permissions, a prefilter and
24
- # the concurrency group.
22
+ # command or places the review round, and replies. A comment that mentions
23
+ # `@sdlc-harness` anywhere, not in the exact command form, is read by one
24
+ # read-only agent session running the plugin's mention-reading slash command,
25
+ # which `remote-run.sh control` launches and whose decision it validates.
26
+ # Every decision lives in that script; this file carries only the events, the
27
+ # permissions, a prefilter, the concurrency group, and on a comment job the
28
+ # credential, the agent CLI and the pinned plugin that session needs.
25
29
  # The `run-name` below is not harness-run.yml's `harness <action> <branch>`
26
30
  # title, so no run lookup `remote-run.sh` makes by that title can match it.
27
31
  #
@@ -73,8 +77,18 @@
73
77
  # issues: write reply on the issue or pull request, and label it
74
78
  # pull-requests: write read the pull request, its reviews and comments,
75
79
  # and label it
76
- # The job reads no repository secret: it needs only its own token, so the
77
- # credential secrets never reach the job that reads untrusted comment text.
80
+ # Only an `issue_comment` event's act step receives a credential: its `env:`
81
+ # passes CLAUDE_CODE_OAUTH_TOKEN and ANTHROPIC_API_KEY as IN_OAUTH and IN_API,
82
+ # each through an expression that is the empty string unless the event is
83
+ # `issue_comment`, and nothing at job level reads a secret. A
84
+ # `pull_request_review`, `issues`, `pull_request` or `delete` event gets empty
85
+ # strings. A `pull_request_review` job runs the pull request's merge-commit
86
+ # copy of this file, which a same-repository head can edit to read the secret;
87
+ # that writer could already read it through any workflow of their own
88
+ # (docs/remote-execution.md, section 9, Credentials and billing), and a fork's
89
+ # review job gets no secret (C2). The decision of record, its exposure and why
90
+ # a comment's text cannot steer the session outside its closed set of actions:
91
+ # docs/github-run-control.md, section 6.
78
92
  # Every reply is posted as github-actions[bot] and starts no workflow (S3).
79
93
  #
80
94
  # FORK PULL REQUESTS. Never `pull_request_target`, which would run with this
@@ -113,6 +127,20 @@
113
127
  # harness-run.yml's `collect` job is the one such job today (DECLARED
114
128
  # MIRRORS below).
115
129
  #
130
+ # THE PLUGIN. This file carries no pin of its own. A comment job reads the
131
+ # first HARNESS_CLI_VERSION in the checkout's harness-run.yml, clones the
132
+ # release tag `autonomous-sdlc-harness--v<that version>` outside the checkout
133
+ # as harness-run.yml's `Install the pinned plugin` step does, checks the
134
+ # plugin manifest's version against it, and hands the plugin's directory to
135
+ # the act step as HARNESS_MENTION_PLUGIN_DIR; the session loads it with
136
+ # `--plugin-dir`, so nothing is installed. The plugin a mention runs under is
137
+ # therefore the release the run job installs. A pinned release older than
138
+ # mentions carries no mention-reading command and gets `control`'s no-plugin
139
+ # reply; the route is `init --upgrade-workflows` (docs/remote-execution.md,
140
+ # `### Upgrading`). The three comment-only steps are `continue-on-error`, so a
141
+ # failed install never blocks an exact-form command: `control` then finds no
142
+ # agent binary or plugin and answers a mention with its exit-3 reply.
143
+ #
116
144
  # A REFUSAL IS A SUCCESS. `remote-run.sh control` exits 2 for a refusal it has
117
145
  # already replied to; that exit code is the script's contract with every other
118
146
  # caller, so the step, not the script, maps it: `|| [ $? -eq 2 ]` turns a
@@ -141,23 +169,38 @@
141
169
  # (`changes_requested`), HARNESS_RUNNER,
142
170
  # HARNESS_REMOTE_STOP,
143
171
  # HARNESS_TRIGGER_ALLOWED_BOTS,
144
- # HARNESS_RUN_ACTORS
172
+ # HARNESS_RUN_ACTORS,
173
+ # OAUTH_TOKEN_SECRET
174
+ # (`CLAUDE_CODE_OAUTH_TOKEN`),
175
+ # API_KEY_SECRET (`ANTHROPIC_API_KEY`),
176
+ # CLI_VERSION_VARIABLE
177
+ # (`HARNESS_CLI_VERSION`, read from
178
+ # harness-run.yml)
179
+ # cli/src/generators/projectSettings.ts MARKETPLACE_NAME
180
+ # (`autonomous-sdlc-harness`)
145
181
  # cli/src/config/model.ts DEFAULTS.scriptsDir
146
182
  # harness-run.yml the concurrency group
147
183
  # `harness-review-<branch>`, held by its
148
- # `collect` job
184
+ # `collect` job; the release-tag shape
185
+ # `autonomous-sdlc-harness--v<version>`
186
+ # of its `Install the pinned plugin` step
187
+ # remote-run.sh (the scriptsDir copy) IN_OAUTH, IN_API and
188
+ # HARNESS_MENTION_PLUGIN_DIR, the env
189
+ # interface `control` reads (its MENTION
190
+ # paragraph)
149
191
  #
150
192
  # ACTION PINS.
151
193
  # actions/checkout@v5
152
- # The lowest major whose own action.yml declares `runs.using: node24`, per a
153
- # maintainer's lookups of its action.yml and release notes on
154
- # 2026-09-29T08:21Z (UTC). That major's release notes require Actions Runner
155
- # 2.327.1 or newer; a GitHub-hosted runner already has it, and a self-hosted
156
- # one must run it (docs/remote-execution.md, section 8). A major tag, not a
157
- # commit sha: it is GitHub's own `actions/` organisation, the owner of the
158
- # runner and GITHUB_TOKEN this job already trusts, and a major tag takes the
159
- # action's own patch and security releases where a sha would freeze your copy.
160
- # Pin a sha in your copy if you want one.
194
+ # actions/setup-node@v5
195
+ # Each is the lowest major whose own action.yml declares `runs.using: node24`,
196
+ # per a maintainer's lookups of each action's action.yml and release notes on
197
+ # 2026-09-29T08:21Z (UTC). Each of those majors' release notes requires
198
+ # Actions Runner 2.327.1 or newer; a GitHub-hosted runner already has it, and
199
+ # a self-hosted one must run it (docs/remote-execution.md, section 8). A major
200
+ # tag, not a commit sha: every action here is GitHub's own `actions/`
201
+ # organisation, the owner of the runner and GITHUB_TOKEN this job already
202
+ # trusts, and a major tag takes the action's own patch and security releases
203
+ # where a sha would freeze your copy. Pin shas in your copy if you want them.
161
204
 
162
205
  name: harness-control
163
206
  run-name: harness control ${{ github.event.issue.number || github.event.pull_request.number || github.event.ref }}
@@ -226,5 +269,60 @@ jobs:
226
269
  git config user.name "github-actions[bot]"
227
270
  git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
228
271
 
272
+ - name: Set up Node
273
+ if: github.event_name == 'issue_comment'
274
+ continue-on-error: true
275
+ uses: actions/setup-node@v5
276
+ with:
277
+ node-version: '22'
278
+ # As in harness-run.yml: no npm cache is used, and a lockfile-less repository must not fail this step.
279
+ package-manager-cache: false
280
+
281
+ - name: Install the claude CLI when absent
282
+ if: github.event_name == 'issue_comment'
283
+ continue-on-error: true
284
+ run: |
285
+ if ! command -v claude >/dev/null 2>&1; then
286
+ npm install -g @anthropic-ai/claude-code
287
+ fi
288
+ claude --version
289
+
290
+ - name: Fetch the pinned plugin
291
+ if: github.event_name == 'issue_comment'
292
+ continue-on-error: true
293
+ run: |
294
+ pin=$(awk '/^[[:space:]]*HARNESS_CLI_VERSION:/ { sub(/^[[:space:]]*HARNESS_CLI_VERSION:[[:space:]]*/, ""); sub(/[[:space:]]+#.*$/, ""); sub(/[[:space:]]+$/, ""); gsub(/["\047]/, ""); print; exit }' .github/workflows/harness-run.yml 2>/dev/null || true)
295
+ if [ -z "$pin" ]; then
296
+ echo "::warning::.github/workflows/harness-run.yml carries no HARNESS_CLI_VERSION, so no plugin was fetched and a mention gets the no-plugin reply."
297
+ exit 1
298
+ fi
299
+ source_repo=$(jq -r '.extraKnownMarketplaces["autonomous-sdlc-harness"].source.repo // empty' .claude/settings.json 2>/dev/null || true)
300
+ if [ -z "$source_repo" ]; then
301
+ echo "::warning::.claude/settings.json names no marketplace source for autonomous-sdlc-harness, so the plugin at $pin was not fetched."
302
+ exit 1
303
+ fi
304
+ tag="autonomous-sdlc-harness--v$pin"
305
+ marketplace_dir="$RUNNER_TEMP/harness-marketplace"
306
+ # --quiet does not cover the detached-HEAD advice a tag checkout prints; only advice.detachedHead gates it.
307
+ if ! git -c advice.detachedHead=false clone --quiet --depth 1 --branch "$tag" "https://github.com/$source_repo.git" "$marketplace_dir"; then
308
+ echo "::warning::$source_repo has no release tag $tag, so the plugin at $pin was not fetched."
309
+ exit 1
310
+ fi
311
+ plugin_source=$(jq -r '[.plugins[]? | select(.name == "autonomous-sdlc-harness") | .source | strings][0] // empty' "$marketplace_dir/.claude-plugin/marketplace.json" 2>/dev/null || true)
312
+ if [ -z "$plugin_source" ]; then
313
+ echo "::warning::$tag's .claude-plugin/marketplace.json has no readable autonomous-sdlc-harness entry, so the plugin at $pin was not handed to the mention session."
314
+ exit 1
315
+ fi
316
+ plugin_dir="$marketplace_dir/${plugin_source#./}"
317
+ version=$(jq -r '.version // empty' "$plugin_dir/.claude-plugin/plugin.json" 2>/dev/null || true)
318
+ if [ "$version" != "$pin" ]; then
319
+ echo "::warning::the plugin cloned at $tag is version '${version:-none}', not $pin, so it was not handed to the mention session."
320
+ exit 1
321
+ fi
322
+ echo "HARNESS_MENTION_PLUGIN_DIR=$plugin_dir" >> "$GITHUB_ENV"
323
+
229
324
  - name: Act on the comment, review, close or deletion
325
+ env:
326
+ IN_OAUTH: ${{ github.event_name == 'issue_comment' && secrets.CLAUDE_CODE_OAUTH_TOKEN || '' }}
327
+ IN_API: ${{ github.event_name == 'issue_comment' && secrets.ANTHROPIC_API_KEY || '' }}
230
328
  run: bash "$SCRIPTS_DIR/remote-run.sh" control || [ $? -eq 2 ]
@@ -34,12 +34,13 @@
34
34
  # cost nothing.
35
35
  #
36
36
  # WHAT IT READS.
37
- # Secrets: HARNESS_PUSH_URL (optional notifications: the poller's own failed
38
- # notice when it cannot resume a run).
37
+ # Secrets: HARNESS_PUSH_URL (optional notifications: the poller's own notice
38
+ # when it cannot resume a run or cannot download its bundle).
39
39
  # Variables: HARNESS_RUNNER, HARNESS_REMOTE_STOP (any value: the tick
40
40
  # dispatches nothing), HARNESS_MAX_CHAIN (the automatic-dispatch limit),
41
41
  # HARNESS_POLL_MAX_DISPATCH_FAILURES (failed re-dispatches of one paused
42
- # run before the poller gives up on it; 3 when unset) and
42
+ # run, or consecutive failed downloads of one run's listed bundle, before
43
+ # the poller gives up on it; 3 when unset) and
43
44
  # HARNESS_POLL_GIVE_UP_AFTER_MINUTES (minutes after the usage reset past
44
45
  # which it gives up; 360 when unset).
45
46
  # harness.config.json, at run time: `scriptsDir` and `stateDir`. No
@@ -53,8 +54,8 @@
53
54
  # workflow-level `permissions:` block sets every permission it does not list to
54
55
  # `none`.
55
56
  #
56
- # WHAT IT WRITES. The `harness-poll-state` artifact: the failed-dispatch count
57
- # `poll` carries to the next tick, kept 7 days.
57
+ # WHAT IT WRITES. The `harness-poll-state` artifact: the failed-dispatch and
58
+ # failed-download counts `poll` carries to the next tick, kept 7 days.
58
59
  #
59
60
  # THE RULE EVERY EDIT KEEPS. Every GitHub expression has a space after its
60
61
  # opening braces, and every value reaches a shell line through `env:`. `init`
@@ -49,7 +49,13 @@
49
49
  # job's status by that name
50
50
  # harness-control.yml the concurrency group
51
51
  # `harness-review-<branch>`, shared by its
52
- # review jobs and the `collect` job here
52
+ # review jobs and the `collect` job here;
53
+ # and, read by its `Fetch the pinned
54
+ # plugin` step, the first
55
+ # `HARNESS_CLI_VERSION:` env line (key, then
56
+ # the quoted version) and the release-tag
57
+ # shape `autonomous-sdlc-harness--v<version>`
58
+ # of the `Install the pinned plugin` step
53
59
  #
54
60
  # THE COLLECT JOB. When a run ends, `remote-run.sh collect` starts the next
55
61
  # user-review round from every review requesting changes that `control`
@@ -60,8 +66,11 @@
60
66
  # the two never place a round at once; and the settledness test reads "the
61
67
  # `run` job is completed", which no step inside that job could see. Under
62
68
  # `!cancelled()` a failed `run` job still reaches it, and the run's state bundle
63
- # decides whether the run ended or only paused or parked; a cancelled or
64
- # stopped run skips it. The group name mirrors harness-control.yml's, and
69
+ # decides whether the run ended or only paused or parked. A `run` job GitHub
70
+ # cancelled before any step ran, for example one no runner acquired, reaches it
71
+ # too, and `collect` reports that run once (remote-run.sh's header, its
72
+ # `collect` paragraph), because the job itself could report nothing; a workflow
73
+ # run cancelled or stopped as a whole skips it. The group name mirrors harness-control.yml's, and
65
74
  # RUN_JOB_NAME in remote-run.sh mirrors the `run` job's key (DECLARED MIRRORS
66
75
  # above). It reads no secret: its own token pushes the round, dispatches it and
67
76
  # comments. It checks out the default branch, as harness-control.yml's review
@@ -123,8 +132,9 @@
123
132
  # Secrets: CLAUDE_CODE_OAUTH_TOKEN and/or ANTHROPIC_API_KEY (one is required;
124
133
  # billing follows the API key when both are set), HARNESS_GIT_TOKEN (optional:
125
134
  # a personal or App token, so the job's pushes trigger your own CI, which
126
- # GITHUB_TOKEN pushes never do; it also opens the run's draft pull request,
127
- # so your CI runs on it without an approval click), HARNESS_PUSH_URL
135
+ # GITHUB_TOKEN pushes never do; it also opens the run's draft pull request
136
+ # when the run starts, and `deliver` opens one only when none is open at
137
+ # completion, so your CI runs on it without an approval click), HARNESS_PUSH_URL
128
138
  # (optional notifications).
129
139
  # Variables: HARNESS_RUNNER, HARNESS_REMOTE_STOP (any value stops every job
130
140
  # before it launches anything), HARNESS_RUN_ACTORS (THE RUN-ACTOR GATE),
@@ -141,7 +151,7 @@
141
151
  # actions to dispatch, poll and enable the poller
142
152
  # issues to comment and set labels on the issue and the pull request,
143
153
  # which both use the issues API
144
- # pull-requests to open the draft pull request and label it
154
+ # pull-requests to open the run's pull request, update it and label it
145
155
  #
146
156
  # WHY THE REPORT STEP MAY FAIL. `Open the pull request and report` runs
147
157
  # `remote-run.sh deliver` after the push, so the pull request's head carries the
@@ -149,6 +159,17 @@
149
159
  # this file without `init --force` still runs scripts with no `deliver` verb,
150
160
  # and a finished run must not be marked failed for its report.
151
161
  #
162
+ # WHY THE OPEN STEP RUNS ONLY WHEN chain IS 0. `Open the draft pull request`
163
+ # runs `remote-run.sh open` before the harness, so the run's draft pull request
164
+ # exists from its first job. `chain` counts automatic dispatches since the last
165
+ # user action, so 0 is a job a person's action started: the first job, a
166
+ # resume, an answer, a round. An automatic continuation therefore never retries
167
+ # a create that failed, and the attempts per run stay bounded by people's
168
+ # actions; `deliver`'s fallback at completion is the last attempt, and its
169
+ # `completed` comment names the error. It is `continue-on-error` for the report
170
+ # step's reason above: scripts older than this file carry no `open` verb, and a
171
+ # run must not fail for its pull request.
172
+ #
152
173
  # THE SELF-PAUSE POINT, MEASURED. On a hosted runner the job drops its own PAUSE
153
174
  # REMOTE_SELF_PAUSE_AFTER_SECS after it started, the run yields at its next
154
175
  # dispatch boundary, and `remote-run.sh continue` chains a new job.
@@ -364,7 +385,7 @@ jobs:
364
385
  else
365
386
  why="it is unset, and this repository has no single owner to admit (its owner type is ${IN_OWNER_TYPE:-unreadable}), so it admits nobody."
366
387
  fi
367
- echo "::error::@${actor:-(no actor)} dispatched or re-ran this run, and the repository variable HARNESS_RUN_ACTORS does not admit them: $why Nothing was launched and no credential was read. Add the login to the comma-separated repository variable HARNESS_RUN_ACTORS, or set it to * for every writer (docs/remote-execution.md, section 9)."
388
+ echo "::error::@${actor:-(no actor)} dispatched or re-ran this run, and the repository variable HARNESS_RUN_ACTORS does not admit them: $why Nothing was launched and no credential was read. Add the login to the comma-separated repository variable HARNESS_RUN_ACTORS, or set it to * for every writer (docs/remote-execution.md, section 7 step 4, and section 11)."
368
389
  exit 1
369
390
 
370
391
  - name: Compute the time budget
@@ -529,6 +550,13 @@ jobs:
529
550
  if: env.HARNESS_STOPPED != '1'
530
551
  run: bash "$SCRIPTS_DIR/remote-run.sh" restore "$HARNESS_INPUT_BRANCH" --resume "$HARNESS_INPUT_RESUME"
531
552
 
553
+ - name: Open the draft pull request
554
+ if: env.HARNESS_STOPPED != '1' && inputs.chain == 0
555
+ continue-on-error: true
556
+ env:
557
+ HARNESS_PR_TOKEN: ${{ secrets.HARNESS_GIT_TOKEN }}
558
+ run: bash "$SCRIPTS_DIR/remote-run.sh" open "$HARNESS_INPUT_BRANCH"
559
+
532
560
  - name: Run the harness
533
561
  if: env.HARNESS_STOPPED != '1'
534
562
  timeout-minutes: ${{ fromJSON(env.HARNESS_STEP_TIMEOUT_MINUTES || env.HARNESS_HOSTED_JOB_LIMIT_MINUTES) }}
@@ -541,6 +569,9 @@ jobs:
541
569
  unset IN_OAUTH IN_API
542
570
  bash "$SCRIPTS_DIR/autonomous-watcher.sh" job "$HARNESS_INPUT_BRANCH" "$HARNESS_INPUT_ENGINE" "$HARNESS_INPUT_RESUME"
543
571
 
572
+ # Runs under always(), so a cancelled or failed job still pushes its commits. push-branch.sh
573
+ # pushes nothing back for a branch origin no longer has, so a run stopped by its branch's
574
+ # deletion does not re-create it (Gate 12 round 9, finding 1).
544
575
  - name: Push the branch
545
576
  if: always() && env.SCRIPTS_DIR != ''
546
577
  run: bash "$SCRIPTS_DIR/push-branch.sh"
@@ -634,7 +665,7 @@ jobs:
634
665
  else
635
666
  why="it is unset, and this repository has no single owner to admit (its owner type is ${IN_OWNER_TYPE:-unreadable}), so it admits nobody."
636
667
  fi
637
- echo "::error::@${actor:-(no actor)} dispatched or re-ran this run, and the repository variable HARNESS_RUN_ACTORS does not admit them: $why Nothing was launched and no credential was read. Add the login to the comma-separated repository variable HARNESS_RUN_ACTORS, or set it to * for every writer (docs/remote-execution.md, section 9)."
668
+ echo "::error::@${actor:-(no actor)} dispatched or re-ran this run, and the repository variable HARNESS_RUN_ACTORS does not admit them: $why Nothing was launched and no credential was read. Add the login to the comma-separated repository variable HARNESS_RUN_ACTORS, or set it to * for every writer (docs/remote-execution.md, section 7 step 4, and section 11)."
638
669
  exit 1
639
670
 
640
671
  - name: Check out the default branch for collecting