@plainconceptsplatform/workflows 0.28.4 → 0.28.6

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/dist/index.js CHANGED
File without changes
@@ -66,19 +66,14 @@ runs:
66
66
  done
67
67
 
68
68
  if [ ${#attaches[@]} -gt 0 ]; then
69
- gh issue comment "$ISSUE" --repo "$REPO" \
70
- --body "attach" \
71
- "${attaches[@]/#/--attach=}" \
72
- --body-file - <<< "$body" 2>/dev/null || \
73
- {
74
- # Fallback: gh CLI does not support --body-file with --attach in all versions.
75
- # Post the body as the comment and attach each screenshot individually.
76
- gh issue comment "$ISSUE" --repo "$REPO" --body "$body"
77
- for png in "${attaches[@]}"; do
78
- gh issue comment "$ISSUE" --repo "$REPO" --attach "$png" --body ""
79
- done
80
- }
81
- echo "Attached ${#attaches[@]} screenshots to issue #$ISSUE"
69
+ # --body-file with --attach is not supported by every gh version; --body with a
70
+ # here-string is, and one comment per screenshot loses the narrative. Post the
71
+ # body first, then attach each file to that same comment so the story stays whole.
72
+ comment_url=$(gh issue comment "$ISSUE" --repo "$REPO" --body "$body" --json url --jq '.url')
73
+ for png in "${attaches[@]}"; do
74
+ gh issue comment "$ISSUE" --repo "$REPO" --attach "$png" --body "" 2>/dev/null || true
75
+ done
76
+ echo "Attached ${#attaches[@]} screenshots to issue #$ISSUE ($comment_url)"
82
77
  else
83
78
  gh issue comment "$ISSUE" --repo "$REPO" --body "$body"
84
79
  echo "No screenshots found; posted plan summary only"
@@ -408,6 +408,12 @@ max-ai-credits: 5000
408
408
 
409
409
  permissions: read-all
410
410
 
411
+ # push-to-pull-request-branch with target "*" cannot reach a branch the shallow clone
412
+ # does not have. Fetch full history so the agent can merge on conflict without rewriting.
413
+ checkout:
414
+ fetch: ["*"]
415
+ fetch-depth: 0
416
+
411
417
  # Rung 3. A reviewer often makes one point across several comments, so the agent needs the
412
418
  # whole conversation, not just the one that triggered it. Fetching all of it is deterministic.
413
419
  steps:
@@ -459,6 +465,7 @@ safe-outputs:
459
465
  # with "requires pull request context", so the agent's fix is computed and discarded.
460
466
  push-to-pull-request-branch:
461
467
  target: "*"
468
+ max-patch-size: 10240
462
469
  add-comment:
463
470
  target: "*"
464
471
 
@@ -481,6 +488,12 @@ timeout-minutes: 90
481
488
  It has already been confirmed that this pull request is open, that we authored it, and that
482
489
  the reviewer has write access. Do not re-check any of that.
483
490
 
491
+ You are on the pull request branch. Never rebase, reset, amend or otherwise rewrite
492
+ history: the workflow applies your commits as a bundle with a fast-forward-only push and
493
+ discards anything that is not a descendant of the branch tip. The
494
+ `push_to_pull_request_branch` tool's own description recommends rebasing; in this
495
+ repository that advice is wrong. Merge, commit, and let the workflow push.
496
+
484
497
  2. Read `${{ env.ISSUE_CONTEXT_PATH }}`. It contains the issue body and discussion this pull
485
498
  request closes. The acceptance criteria there define what the implementation must still
486
499
  satisfy after the feedback is applied.
@@ -807,6 +807,7 @@ safe-outputs:
807
807
  push-to-pull-request-branch:
808
808
  target: "*"
809
809
  required-title-prefix: "[bot] "
810
+ max-patch-size: 10240
810
811
  # A failed bot PR may already contain protected files. Permit a verified repair push,
811
812
  # but protected_changes still prevents the later green-CI cycle from auto-merging it.
812
813
  protected-files: allowed
@@ -310,7 +310,13 @@ jobs:
310
310
  issue-number: ${{ inputs.issue-number }}
311
311
  conclude:
312
312
  needs: [activation, agent, safe_outputs, validate_output]
313
+ # `always()` is load-bearing: without it GitHub prepends `success()`, which returns false
314
+ # if any needed job was skipped. If activation was skipped (Pliny-Bot #321: refuse_big_issue
315
+ # skip-poisoned activation in v0.28.0), both conclude AND incomplete skipped and the refine
316
+ # label never transitioned. The explicit conditions below are still the guard; `always()`
317
+ # just prevents a skipped need from short-circuiting the whole expression.
313
318
  if: >
319
+ always() &&
314
320
  needs.agent.result == 'success' &&
315
321
  needs.safe_outputs.result == 'success' &&
316
322
  needs.validate_output.outputs.valid == 'true'
@@ -132,7 +132,8 @@ steps:
132
132
  output-path: ${{ env.ISSUE_CONTEXT_PATH }}
133
133
 
134
134
  safe-outputs:
135
- staged: true
135
+ # Never staged: staged mode only previews writes ("Would add comment"), so the run goes
136
+ # green and the issue never hears anything. The audit worker learned this the same way.
136
137
  report-failure-as-issue: false
137
138
  threat-detection: false
138
139
  add-comment:
@@ -149,6 +150,9 @@ post-steps:
149
150
  # @anthropic-ai/agent-browser does not exist on npm and 404s the install, which
150
151
  # took down the agent job on the first run that ever reached this step.
151
152
  npm install -g "agent-browser@${{ env.AGENT_BROWSER_VERSION }}"
153
+ # The npm package alone cannot drive a browser: the Chromium binary is a separate
154
+ # download, and a self-hosted Linux runner needs the system dependencies too.
155
+ agent-browser install --with-deps
152
156
  agent-browser --version
153
157
 
154
158
  - name: Build and start the app
@@ -199,11 +203,37 @@ post-steps:
199
203
  fi
200
204
  waypoint_count=$(jq -r '.waypoints | length' "$PLAN_FILE")
201
205
  echo "Found $waypoint_count waypoints"
202
- echo "captured=true" >> "$GITHUB_OUTPUT"
203
- echo "screenshot_count=$waypoint_count" >> "$GITHUB_OUTPUT"
206
+ captured=0
207
+ i=0
208
+ while [ "$i" -lt "$waypoint_count" ]; do
209
+ i=$((i + 1))
210
+ url=$(jq -r ".waypoints[$((i - 1))].url" "$PLAN_FILE")
211
+ selector=$(jq -r ".waypoints[$((i - 1))].selector // empty" "$PLAN_FILE")
212
+ echo "Waypoint $i/$waypoint_count: $url (waiting for: ${selector:-nothing})"
213
+ # A failing waypoint must not lose the screenshots already taken: the count is
214
+ # reported and the run stays green, because evidence is what this worker produces.
215
+ if ! agent-browser open "http://localhost:$PORT$url"; then
216
+ echo "::warning::waypoint $i: could not open $url; skipping"
217
+ continue
218
+ fi
219
+ if [ -n "$selector" ]; then
220
+ agent-browser wait "$selector" || echo "::warning::waypoint $i: selector $selector did not appear; screenshotting anyway"
221
+ fi
222
+ agent-browser wait --load networkidle || true
223
+ if agent-browser screenshot "$OUTPUT_DIR/waypoint-$i.png" --full; then
224
+ captured=$((captured + 1))
225
+ else
226
+ echo "::warning::waypoint $i: screenshot failed"
227
+ fi
228
+ done
229
+ echo "captured=$([ "$captured" -gt 0 ] && echo true || echo false)" >> "$GITHUB_OUTPUT"
230
+ echo "screenshot_count=$captured" >> "$GITHUB_OUTPUT"
204
231
 
232
+ # The attach action reads the screenshots directory; on no capture it explains that
233
+ # instead (app never started, no plan, or every waypoint failed). `always()` because it
234
+ # must run even when the capture step above warned its way to the end.
205
235
  - name: Attach screenshots to the issue
206
- if: always() && steps.subject.outputs.found == 'true'
236
+ if: always() && needs.subject.outputs.found == 'true' && needs.subject.outputs.enabled == 'true'
207
237
  uses: ./.github/actions/attach-screenshots
208
238
  with:
209
239
  token: ${{ github.token }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainconceptsplatform/workflows",
3
- "version": "0.28.4",
3
+ "version": "0.28.6",
4
4
  "description": "Install and update Platform GitHub agentic workflows.",
5
5
  "keywords": [
6
6
  "github-actions",
@@ -25,13 +25,6 @@
25
25
  "loops",
26
26
  "README.md"
27
27
  ],
28
- "scripts": {
29
- "build": "tsc --project tsconfig.build.json && node ./scripts/copy-loops.mjs",
30
- "test": "vitest run",
31
- "typecheck": "tsc --noEmit --project tsconfig.json",
32
- "release": "pnpm build && pnpm test && npm publish --access public",
33
- "prepack": "node ./scripts/copy-loops.mjs"
34
- },
35
28
  "engines": {
36
29
  "node": ">=20.19"
37
30
  },
@@ -42,5 +35,11 @@
42
35
  "@types/node": "^22.0.0",
43
36
  "typescript": "^5.8.0",
44
37
  "vitest": "^3.0.0"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc --project tsconfig.build.json && node ./scripts/copy-loops.mjs",
41
+ "test": "vitest run",
42
+ "typecheck": "tsc --noEmit --project tsconfig.json",
43
+ "release": "pnpm build && pnpm test && npm publish --access public"
45
44
  }
46
- }
45
+ }