Skip to content

feat(work-items,autonomy): hold work that adds a charge for the owner - #9201

Merged
kyle-sexton merged 3 commits into
mainfrom
feat/intake-cost-gate
Oct 22, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
feat/intake-cost-gate

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: owner decision relayed by GitHub Security & Cost on 2026-10-22 (work that adds or raises a charge stops for the owner unless an owner-recorded decision covers it).

Summary

Holds work that would add or raise a charge for the owner, at both admission points: the intake-triage lane and the no-model rule-admission evaluator.

Fix

  • .github/workflows/intake-triage.yml: a COST instruction escalates such an issue to needs-human with a Cost: line (what bills, where, the owner decision it lacks), unless a **Decision recorded.** comment already covers it.
  • plugins/work-items/scripts/rule-admit.sh: a cost-term check refuses rule admission after the trust-surface check. The term list is narrow (cost, billing, billed, spend, pricing, paid, subscription, SKU, quota, retention, larger/hosted/self-hosted runner, macOS minutes) so ordinary work such as "plan" wording still admits.
  • plugins/autonomy/reference/guardrails/admission-policy.md: documents the new precedence step.

Verification

  • bash plugins/work-items/scripts/rule-admit.test.sh: all checks pass; the two new cost cases fail without the rule-admit.sh change and pass with it; a control case ("plan step wording") still admits.
  • bash scripts/check-affected.sh --uncommitted: 11 passed, 5 skipped, 0 failed.

Related

  • Security & Cost requested this PR for its pass.

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits October 22, 2026 17:19
The owner decided (2026-10-22, relayed by GitHub Security & Cost) that work which
would add or raise a charge stops for the owner unless a recorded decision
already covers it.

- intake-triage escalates such an issue to needs-human with a Cost line.
- rule-admit refuses rule admission on a charge term in the title or body,
  with fixture cases that fail before the change.
- The admission policy documents the new precedence step.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…orded decision

Security & Cost: the COST skip trusted any comment starting with the decision
marker. The reusable already passes only allow-listed authors' comments to the
model; this also excludes [bot] authors, matching the re-entry rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 22, 2026 21:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T21:26:24.646484Z 2f0697e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 6aed779a813c933a832bea77bfb1e0fbd8179e18: 0 finding(s), 0 as inline comments.

No security findings in the incremental change (.github/workflows/intake-triage.yml, since 2f0697e).

The diff rewrites only the COST instruction in the triage lane's instructions: input. Where it used to say "escalate to needs-human", it now says to apply the needs-human label, keep needs_human false so the comment is kept, and add the Cost: line.

  • Instruction-surface lens: the instruction still sends cost-bearing issues to a human, using the same label, and the Cost: line is unchanged. The one line the lane would otherwise skip, a **Decision recorded.** comment from a non-[bot] author, is untouched. I judged this narrowing, not removal, of a guardrail, and no protected class is weakened. I did not open the instruction exception register for this check; I judged by consequence.
  • Label grant: needs-human was already in allowed-labels (line 206) in the version reviewed earlier, so no new write capability is added. It is a restricting label, so injected issue text gains nothing by being able to apply it.
  • Workflow surface: permissions:, triggers, the pinned reusable-workflow SHA and the secrets are unchanged. Nothing for zizmor's lane, and no manifest changes in this increment.

I did not review the reusable workflow's handling of needs_human (it lives in another repository). So I did not confirm that the plain-label path matches the needs_human path downstream. A mismatch would be a behavior question, not a security finding.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f0697efb5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/intake-triage.yml Resolved
Comment thread .github/workflows/intake-triage.yml Resolved
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 6aed779a813c933a832bea77bfb1e0fbd8179e18: 0 finding(s), 0 as inline comments.

No findings. I reviewed only the incremental change to .github/workflows/intake-triage.yml since 2f0697e.

The COST instruction (lines 208-215) used to say "escalate to needs-human". It now says to apply the needs-human label and keep needs_human false, so the run's comment, including the Cost: line, survives.

  • Consistent with the workflow's own mechanism. The comment at lines 189-194 says an escalated run posts only the reusable's fixed note, so a Cost: line written under "escalate" would have been dropped.
  • Label is permitted. needs-human is already in allowed-labels (line 206), so the run can apply it.
  • Same pattern as the existing re-entry rule. Re-entry step d (lines 234-237) already uses "apply the needs-human label and keep needs_human false".
  • Closing-issue criteria. The PR has no closing issue (No related issue:), so there are no acceptance criteria to check.
  • Not run. This is a workflow instruction string, and I did not run the workflow. The claim that the comment survives rests on the workflow's own comment at lines 189-194, not on a run.

…ssue

A run that sets needs_human posts only the reusable's fixed note, which would
drop the Cost line. Apply the needs-human label and keep needs_human false, as
the re-entry rule does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit a108df4 Oct 22, 2026
28 checks passed
@kyle-sexton
kyle-sexton deleted the feat/intake-cost-gate branch October 22, 2026 21:46
github-merge-queue Bot pushed a commit that referenced this pull request Oct 22, 2026
…e PR moves mid-run (#9223)

Closes #9207

## Summary

When the PR head moved while pr-unblock's `fix-docs` ran, its report job
posted **failure** on the new head, and the guardrails merge guard
refused the merge until someone re-dispatched by hand. Example: on
#9201, fix-docs run
[39857913086](https://github.com/melodic-software/claude-code-plugins/actions/runs/39857913086)
gated `2f0697ef`, the head moved to `6aed779a`, and check 120101945136
posted failure on `6aed779a`.

**Root cause.** The fault is in the head the check is posted on, not in
`decide.mjs`. The `fix-docs` and `fix-docs-subscription` calls in
`.github/workflows/pr-unblock.yml` passed no `head-sha`. The run is a
`workflow_dispatch`, so it has no event head either. The read report
job's "Choose the head the check is posted on" step
(`.github/workflows/pr-run-activity-read.yml`) then trusted only the PR
head it read from the API at report time. Any push mid-run made the
run's own head look forged, so the step set `forged=true`, which forces
`run-result: failure` and posts on the API head. `decide.mjs:107-115`
only supplies the message text. The report job log for that run shows:

```
RUN_HEAD: 2f0697e
CALLER_HEAD:
EVENT_HEAD:
API_HEAD: 6aed779
##[error]the run job's head-sha or pr-number is not the gated PR's; failure is posted on the trusted head 6aed779…
report-check-run: posted pr-unblock / fix-docs failure on 6aed779…
```

`fix-ci` is not affected, because both of its calls already pass
`fix-ci-context`'s head.

## Fix

- A new `fix-docs-head` job in `pr-unblock.yml` reads the PR head over
the API. It runs no head code and holds only `pull-requests: read`. Both
`fix-docs` calls pass that head as `head-sha`, the same way fix-ci uses
`fix-ci-context`. When the head moves mid-run, the run's head matches
the gated head, so the check posts the run's real outcome on the head it
ran on. The new head gets no stale check.
- The report step's trust logic is unchanged: a run head that matches no
gated head still posts failure.
- Docs: `pr-run-activity.md` and the `head-sha` input description name
`fix-docs-head`. Changelog fragment under `.changes/pr-pipeline/`.

The fix lives in the caller rather than in `decide.mjs` because the
verdict's `head-sha` is the same value the run job can forge. `decide`
cannot tell a superseded head from a forged one, and turning that
mismatch neutral would also turn real forgery neutral. Posting on the
run's own head is the "posts on its own head only" option in the issue's
direction.

**How this maps to the Done-when items.**
- *Superseded verdict.* It posts its real outcome on its own head rather
than neutral on the new head. The merge guard reads check runs only on
the PR's current head
(`plugins/guardrails/hooks/block-unresolved-pr-merge.sh:675`, `:709`)
and blocks only on a completed failing conclusion (`:759`), so a check
on an older commit, or a missing one, does not block.
- *Genuine mismatch.* A foreign run head still posts failure. The new
test covers this.
- *Tests.* They live in
`.github/actions/resolve-config/callers.test.mjs`, beside the other
pr-unblock caller-contract tests, and not in `report-check-run/`,
because the defect is in the caller and the head step.

**Two limits, both unchanged by this PR.**
- `fix-docs` runs once per PR by design. `fix-docs-dispatch.mjs:186-189`
skips any PR whose earlier commit has a `pr-unblock / fix-docs` check,
so the new head does not get its own fix-docs run, before or after this
change.
- `fix-docs-head` reads the head before `fix-docs` waits in the
`pr-pipeline-write-<pr>` queue. If the head moves in that window, the
run gates a newer head. The step then treats it as forged and posts
failure on the older, gated head, never on the current head, so the
merge is not blocked. `fix-ci-context` has the same window.

## Verification

- New test `pr-unblock.yml: a read activity whose PR head moved mid-run
posts on its own head, never on the new one`. It runs the report job's
head step, lifted from the YAML, with each pr-unblock read-call's
`head-sha` and an API head that moved. It failed before the fix
(`fix-docs passes the head a base job read`: actual `''`) and passes
after. A foreign run head still yields `forged=true`.
- Updated two existing assertions that pinned the old no-`head-sha`
behavior for fix-docs.
- `node --test` in `.github/actions/resolve-config` (callers.test.mjs):
97/97 pass. `.github/actions/report-check-run`: 100/100 pass.
`check-trusted-trigger`, every `.github/scripts/pr-unblock/*.test.mjs`,
and `pr-merge/refire-refused.test.mjs`: 0 failures.
- `scripts/read-runner-dispatcher-gate.test.sh` (9/9),
`scripts/pr-unblock-trusted-base.test.sh` (20/20), and the morning-brief
suites (450 cases plus the view suite): pass.
- `actionlint` is clean on both workflows. `zizmor --offline` on
`pr-unblock.yml` reports no findings. `runner-policy.mjs --root .`
passed.

## Related

- #9201, the PR where the failure was observed
- Report run
[39857913086](https://github.com/melodic-software/claude-code-plugins/actions/runs/39857913086)
- `.github/workflows/pr-run-activity-read.yml`, the "Choose the head the
check is posted on" step

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant