Repository navigation
install-tend: unify on the chain model (admin-gated refs + env policy pin) - #535
Conversation
…ance
The install-tend skill ships from the marketplace into adopter repos, so it
can't reference tend-repo-internal paths (docs/, .github/). Make it
self-contained and correct the security guidance it carries.
- security-model.md: restructure "What we do" as two load-bearing
boundaries (merge restriction for the merge path; environment-protected
secrets for the no-merge path), resolving the spine contradiction where
the Environment gate was both load-bearing and dismissed as defense in
depth. Rewrite "Environment-protected secrets" as a scannable section:
the merge-free trigger class as a list, the gate invariant (the
triggering actor can't approve; Prevent self-review) stated once, the
admin and tag caveats separated. Name the tag-push escalation the merge
restriction doesn't cover.
- install-tend SKILL.md: rebuild the release-secrets step with executable,
verifiable gh api recipes (required reviewers + prevent_self_review, the
deployment "Deployment branches and tags" tag pattern for tag deploys,
verify-last). Repoint every docs/ and tend-repo path at shipped
references; unbacktick the ${CLAUDE_SKILL_DIR} path refs.
- references/: ship security-model.md (authored install-scoped
distillation) and tend.example.yaml (mirror of the canonical doc).
- .pre-commit-config.yaml: sync-install-tend-references hook keeps the
mirror byte-identical to docs/tend.example.yaml and fails on drift or a
missing source.
GitHub mechanics (deployment branch policy decoupled from tags Aug-2023,
prevent_self_review API surface, gh api array-of-objects encoding) verified
against primary sources.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The regex matches `pull_request_target` (not `pull_request:`), so the
over-match is `pull_request_target` substring hits in expressions like
`${{ github.event.pull_request_target.head.sha }}` and step inputs, not
`pull_request:` trigger declarations. Caught by tend-agent's review on
PR #535.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Collapse the two parallel mechanisms (merge restriction + required- reviewers on environments) into one: every privileged code path chains to an admin-controlled operation. Two ref classes are admin-gated (default branch via merge; release tags via creation/update/deletion), and environments pin their deployment policy to those refs. The bot has write, not admin, so it cannot reach either ref or any environment pinned to them. - §3 (Branch protection -> Ref protection): adds a single tag ruleset (creation+update+deletion, admin bypass) parallel to the existing merge-restriction ruleset. Asks the user once for the release tag pattern. - Release-secrets bullet: drops the required_reviewers/prevent_self_review PUT and reviewer-selection prose. Now configures the environment's deployment_branch_policy to list the admin-gated refs from §3, with a simple list-policies verify. Shorter and structurally flatter. - references/security-model.md: replaces "Two boundaries" with "The chain"; the merge and tag bullets are parallel in shape. Drops the Prevent-self-review and Aug-2023 branch-policy-decoupling explanations (no longer load-bearing). Publisher-side immutability advice removed entirely (canonical home is docs/security-model.md "Action distribution integrity", which is for tend's maintainers, not install-tend's adopter audience). - Summary checklist: ruleset and secrets lines restated as chain-model assertions. The chain model also matches what max-sixty/tend itself runs for its branch-triggered deploys (env branch_policy pinned to main); now its tag-triggered case (the release env) has a coherent prescription too. Adopters who want per-deploy human approval on top of the chain can add required-reviewers themselves; the skill no longer prescribes it. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
CI is also failing because plugins/install-tend/skills/install-tend/references/tend.example.yaml is stale relative to docs/tend.example.yaml; the inline suggestion below matches the pre-commit diff.
The install-tend skill now prescribes the chain model (admin-gated refs + environment deployment policies pinned to those refs). The canonical threat model still described "required reviewers + Prevent self-review" as the primary gate for the no-merge path, which contradicts what the skill installs. Rewrite the "Environment-protected secrets" section around the chain mechanism: two admin-gated refs (default branch via merge ruleset; release tag pattern via tag ruleset), environments pin their deployment_branch_policy to those refs, the bot reaches neither. Drop the "Compromised environment reviewer" Remaining-risk entry: under the chain there is no reviewer in the trust path to compromise. Drop the Aug-2023 "deployment branch policies stopped matching tags" caveat: no longer load-bearing, since the chain uses the unified deployment-branch-policies endpoint with type:branch and type:tag. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Superseded by review comments on the current head.
tend-agent
left a comment
There was a problem hiding this comment.
Not approving this revision yet; the existing bot threads still apply on the current head.
The release-triggered deploy path is still open in the chain model: publishing a release for an already admin-created matching tag does not create, update, or delete the tag, but GitHub runs release: published workflows with GITHUB_REF set to that tag ref. A write-scoped bot token can create releases via the Releases API, so an environment policy that allows the release tag pattern would admit that run. The install guidance needs an extra gate for release-triggered secret jobs, or it needs to exclude/narrow that trigger class.
CI is also still failing because plugins/install-tend/skills/install-tend/references/tend.example.yaml is stale relative to docs/tend.example.yaml; the existing inline suggestion matches the pre-commit diff.
## Summary Flips tend's own CI from the Claude harness to the Codex harness by setting `harness: codex` in `.config/tend.yaml` and regenerating the eight `tend-*.yaml` workflows. Each now invokes `max-sixty/tend/[email protected]` with `CODEX_AUTH_JSON` instead of `max-sixty/tend@<v>` with `CLAUDE_CODE_OAUTH_TOKEN`. Motivation is cost: API billing scales per token; a flat-rate ChatGPT subscription funds unlimited runs. tend dogfoods its own setup, so it should run the harness we recommend for cost-sensitive adopters. The net diff is small — config (+ `harness: codex`, + `secrets.allowed: [CODEX_AUTH_JSON]`) and the regenerated workflow files (action ref, auth secret, model, skill-invocation syntax). Supporting infrastructure landed separately on main: - `codex-auth-refresh.yaml` + env-scoped `CODEX_REFRESH_PAT` rotation (#500, #510) - `CODEX_AUTH_JSON` as a repo secret, refresher writes it back at repo scope (#514) - Codex-on-GHA fixes, all in release 0.0.22: sandbox `danger-full-access` (#519), npm prebuilt install (#522), base64 `final_message` capture (#525) ## Validation The original "do not merge until…" prerequisite is **satisfied**: - `tend-review-runs` `workflow_dispatch` on this branch (pinned `[email protected]`) ran **green end-to-end** — codex authenticated, installed via npm, ran without the `bwrap` block, executed the full agent (real review-runs work: posted evidence to the tracking issue, commented on the outage issue), and the action exited 0. - Deterministic CI (`test`, `test-worker`, `lint`) green; `tend-review` (Claude harness via `pull_request_target`) approved. Each codex blocker found during stabilization was fixed and released: auth scoping → sandbox → install → output framing. The smoke test going green on 0.0.22 confirms convergence. ## Post-merge follow-up Watch the first unattended nightly `codex-auth-refresh` cron (`17 3 * * *`) succeed. Manual dispatches (incl. the post-#514 recovery) have all succeeded; this just confirms the scheduled path runs without a human. Failure degrades gracefully over the ~8-day refresh window, with manual rotation as fallback. --------- Co-authored-by: Claude <[email protected]>
…subscribers (#536) ## Summary The install skill and README claimed Claude Code OAuth tokens stop funding CI runs after Anthropic's "2026-06-16" policy change, leaving the API key as the only viable Claude path. Reading Anthropic's authentication page and the Agent SDK support article shows that framing is wrong on two counts: 1. The date is **June 15, 2026**, not June 16. 2. OAuth tokens continue authenticating after the cutover. Subscription Agent SDK / `claude -p` usage just shifts to a separate monthly Agent SDK credit (Pro $20 / Max 5x $100 / Max 20x $200 / Team Standard $20 / Team Premium $100 / Enterprise usage-based $20 / Enterprise seat-based Premium $200; seat-based Enterprise Standard seats are not eligible). Credit exhaustion overflows to API rates only when the user has enabled "extra usage" in the Console; otherwise CI hard-stops until the credit refreshes. The Kickoff text said "the OAuth path no longer funds CI runs" while step 7a said "Anthropic bills these CI runs at API rates regardless" — both wrong, in different directions. This PR reconciles them with the actual policy. It also flips the recommendation: for adopters with an eligible Claude subscription, OAuth puts the bundled Agent SDK credit to work instead of billing tend runs separately via API. API key remains the right choice when the user is on an ineligible plan (e.g. seat-based Enterprise Standard), when there's no subscription, when the bot should bill against a dedicated Console org, or when per-key revocation matters. Sources: - [`code.claude.com/docs/en/authentication`](https://code.claude.com/docs/en/authentication) — "Starting June 15, 2026, Agent SDK and `claude -p` usage on subscription plans will draw from a new monthly Agent SDK credit, separate from your interactive usage limits." - [Support article 15036540](https://support.claude.com/en/articles/15036540-use-the-claude-agent-sdk-with-your-claude-plan) — per-plan allowances, credit-exhaustion behavior, "one-time opt-in" claim mechanism. ## What changes - `plugins/install-tend/skills/install-tend/SKILL.md` Kickoff and step 7a rewritten with correct date, correct policy framing, OAuth listed first as the recommended path for eligible subscribers. - `README.md` Claude harness section corrected the same way; both Anthropic primary-source links land here. "Reasons not to use Tend" gets a refreshed credit-allowance summary in place of a stale "OAuth in grey zone" paragraph. No action code, workflow YAML, or runtime behavior touched — docs and skill text only. ## Test plan - [x] Pre-commit clean (verified locally) - [x] CI green on this branch --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
## Summary - Rename the generator's default `bot_token_secret` from `BOT_TOKEN` to `TEND_BOT_TOKEN`. It was the only default without a vendor/product prefix, easy to collide with an existing repo secret. - Adopters with an explicit `secrets.bot_token` override (e.g. `WORKTRUNK_BOT_TOKEN`, `PRQL_BOT_GITHUB_TOKEN`) are unaffected. - Updates docs (README, `docs/tend.example.yaml`, TODO), the install-tend setup steps + checklist, the review-reviewers skill prose, and the hand-written `.github/workflows/review-reviewers.yaml`. - Tests + regtest fixtures regenerated. - Generated `.github/workflows/tend-*.yaml` are intentionally **not** touched — they pick up the new default at the next release + nightly regen, per the project rule that the action ref pins to the released generator version. ## Adopter migration Repos using the default need to add a `TEND_BOT_TOKEN` repo secret (same value as the existing `BOT_TOKEN`) before the next nightly regen swaps the workflow references. The three affected consumers (`max-sixty/tend`, `max-sixty/cargo-affected`, `numbagg/numbagg`) already have the new secret set; `BOT_TOKEN` can be deleted some days after each regen lands. ## Test plan - [x] `uv run pytest tests/` — 230 passing - [x] `pre-commit run --all-files` — clean - [ ] First nightly run on a consumer after release picks up the new default and the regenerated workflow references `secrets.TEND_BOT_TOKEN` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
…ts (#539) ## Summary Under the Codex harness, skills calling `${CLAUDE_PLUGIN_ROOT}/scripts/...` (review-reviewers, review-runs, nightly) expanded to `/scripts/...` and failed — Claude Code sets `CLAUDE_PLUGIN_ROOT` natively, Codex didn't. `codex plugin add` stages the tend-ci-runner plugin under `$CODEX_HOME/plugins/cache/tend/tend-ci-runner/<version>/` (with `scripts/` and `skills/` adjacent, mirroring the source repo) and prints `Installed plugin root: <path>` on stdout. Parse that line, validate the directory exists, and export `CLAUDE_PLUGIN_ROOT` via `$GITHUB_ENV` so subsequent steps (including `codex exec`) see it. Codex's default `shell_environment_policy.inherit = "all"` then propagates it through to spawned shell tools unchanged. Same variable name across harnesses — skills stay harness-agnostic. No per-skill branching, no parallel `${CODEX_PLUGIN_ROOT}`. Caught as a blocker on #537. ## Why parse the CLI output instead of constructing the path The path includes the plugin version (`0.1.0` today), no `current` symlink. Parsing `codex plugin add`'s own announcement makes the action robust to future schema changes (version bumps, marketplace renames, cache layout) without re-engineering each time. ## Test plan - [x] Verified empirically against pinned `@openai/[email protected]`: `codex plugin add tend-ci-runner@tend` prints the install root, `$CLAUDE_PLUGIN_ROOT/scripts/list-recent-runs.sh` exists at the parsed path, parsing is idempotent on re-add. - [x] `pre-commit run --files codex/action.yaml` passes. - [x] All 230 generator tests pass. - [ ] CI smoke (this PR's tend-review run). Co-authored-by: Claude <[email protected]>
…tion (#540) ## Summary - `tend init --with-install-test` generates a one-shot `tend-install-test.yaml` that fires on the install PR (via `on: pull_request:` with paths filter on `.config/tend.yaml` and `.github/workflows/tend-*.yaml`) and verifies secrets are set + committed workflows match the generator's output. - `init` now removes any `tend-*.yaml` not in the current run's generated set, so the install-test file disappears on the first nightly regen (which runs without the flag). Also cleans up after `enabled: false` workflows and renamed generators. - Install skill passes the flag at step 2 and adds a "wait for `tend-install-test` to pass before merging" check to the checklist. The workflow pins the regen to the version in the committed header (so a tend release mid-PR doesn't fail the drift check), installs `uv` (not on `ubuntu-24.04` by default), and runs `git remote set-head origin --auto` so `master`-default repos match. The tightened `$REPO` canonicality note acknowledges what the skill actually does: every API call uses `--repo "$REPO"` explicitly, so a fork-clone install only needs the variable overridden — no remote surgery. ## Test plan - [x] `uv run pytest` — 240 passing (8 new integration tests + 2 regtest snapshots for Claude/Codex variants) - [x] `pre-commit run --all-files` — clean - [x] `actionlint` against the generated install-test YAML — clean - [ ] CI green on this branch - [ ] First adopter install after release shows green install-test workflow before merging 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <[email protected]>
## Summary Release 0.0.23. 6 commits since 0.0.22: - #520 Cut tend's CI over to the Codex harness — tend now dogfoods Codex - #531 fix(nightly-survey-files): print bucket/count to stderr — keep JSON output uncontaminated - #536 docs(claude-auth): correct June 15 2026 framing; recommend OAuth for subscribers - #538 **breaking:** rename default bot-token secret `BOT_TOKEN` → `TEND_BOT_TOKEN`. Adopters using the default must add a `TEND_BOT_TOKEN` repo secret before their next regen (or set `secrets.bot_token` in `.config/tend.yaml` to keep using the old name) - #539 fix(codex-action): export `CLAUDE_PLUGIN_ROOT` so plugin-bundled scripts resolve under Codex - #533 chore: regenerate workflows with tend 0.0.22 ## Test plan - [ ] CI green (test, test-worker, lint) - [ ] After merge: tag `0.0.23`, PyPI publish, `uvx [email protected] --help` works - [ ] Regenerate tend's own workflows to `@0.0.23` Co-authored-by: Claude <[email protected]> Co-authored-by: Claude <[email protected]>
## Summary Release 0.0.23 — unblocks the review-reviewers Codex migration. Since 0.0.22: - #539 — codex-action exports `CLAUDE_PLUGIN_ROOT` so skills using `${CLAUDE_PLUGIN_ROOT}/scripts/...` work unchanged under Codex (the blocker on PR #537) - #538 — `TEND_BOT_TOKEN` as the default bot-token secret name - #540 — `install-tend --with-install-test` for pre-merge verification - #536 — docs(claude-auth) framing for 2026-06-15 - #531 — nightly-survey-files prints bucket/count to stderr - #520 — tend's own CI flipped to the Codex harness (live; consumer regen moves it forward) ## Test plan - [ ] CI green (test, test-worker, lint) - [ ] After merge: tag `0.0.23`, PyPI publish, `uvx [email protected] --help` works - [ ] Regenerate main's workflows to `@0.0.23` - [ ] Regenerate #537's codex workflows to `@0.0.23` and unblock the review-reviewers migration Co-authored-by: Claude <[email protected]>
Routine post-release regen. Pins the 8 `tend-*.yaml` workflows to `max-sixty/tend/[email protected]` (#539's CLAUDE_PLUGIN_ROOT export) and switches the bot-token reference to `TEND_BOT_TOKEN` (#538). ## Test plan - [ ] CI green (test, test-worker, lint) Co-authored-by: Claude <[email protected]>
…erence docs/security-model.md is the canonical threat model for tend's auditors. It had accreted operational reference content (token-assignment tables, leak posture, Codex auth/rotation walkthroughs, per-workflow capability matrix, workflow-modification rules, PR-comment event types) that belongs with the install-time agent, not the audit-time reader. - Compress "Environment-protected secrets" to a summary of the chain; the full configuration recipe is the install-tend reference's job. - Compress "Config pinning" and "Rate limiting" to one paragraph each; the rate-limit table moves to action.yaml as the source of truth. - Cut the entire Reference section: per-workflow capability matrix, Codex auth/rotation walkthroughs (already in install-tend reference), PR-comment event types (tend-internal runtime plumbing), workflow- modification rules. - Move "Token assignment" and "How tokens flow through workflows" into the install-tend reference where adopters meet them at install time. docs/security-model.md: 377 -> 159 lines. Audit-time content remains (threats, approach summary, action-distribution integrity, remaining risks); install-time content lives where the install agent actually loads it. Pre-commit's sync hook caught the upstream BOT_TOKEN -> TEND_BOT_TOKEN rename (#538) and synced tend.example.yaml's mirror in the plugin. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
Not approving this revision yet; one security issue remains in the new install-test workflow.
| {HEADER} | ||
| name: tend-install-test | ||
| on: | ||
| pull_request: |
There was a problem hiding this comment.
This generated workflow reads TEND_BOT_TOKEN and the harness secret from a pull_request run. Once tend-install-test.yaml lands on the default branch, a leaked write-scoped bot token can push a same-repo branch that changes .github/workflows/tend-install-test.yaml and opens a PR touching .config/tend.yaml; same-repo pull_request runs receive repo secrets, so that branch can exfiltrate exactly the credentials the security model is trying to contain. The fact that nightly later removes the file still leaves an exploitable window after install. Please avoid putting those secrets in a PR-head workflow, for example by making the secret-presence check a maintainer/default-branch workflow_dispatch step or by splitting it from the PR-head generator-drift check.
There was a problem hiding this comment.
There was a problem hiding this comment.
The model already classifies these as leak-acceptable. The leak table in references/security-model.md treats TEND_BOT_TOKEN, CLAUDE_CODE_OAUTH_TOKEN, and CODEX_AUTH_JSON as long-lived, exfiltrable, bounded by merge restriction (and, for harness tokens, dedicated-account scope). The chain isn't trying to contain those; it's containing CLOUDFLARE_API_TOKEN and CODEX_REFRESH_PAT, which sit behind env policies pinned to main and aren't reachable from a feature-branch pull_request run (verified against the live env config on this repo).
Does install-test reach anything the chain promises to contain that isn't already in that leak table? If so, name the specific secret. Otherwise this is the accepted primary-gap class and the fix belongs on the workflow's design (tracked separately as #540/#544), not on this PR.
This was written by Claude Code on behalf of @max-sixty
There was a problem hiding this comment.
You're right. I don't see a specific env-protected secret reached by tend-install-test: it only reads TEND_BOT_TOKEN plus the harness auth secret (CLAUDE_CODE_OAUTH_TOKEN/ANTHROPIC_API_KEY or CODEX_AUTH_JSON/OPENAI_API_KEY), and the updated model explicitly treats those repo-level bot/runtime credentials as leak-acceptable within the merge-restriction boundary.
So this does not break the chain this PR is documenting. The concern is still real for the install-test workflow design, but it belongs with #540/#544 rather than blocking this chain/install-tend change. I withdraw this thread as a blocker.
# Conflicts: # .github/workflows/review-reviewers.yaml # generator/src/tend/workflows.py # generator/tests/test_generate.py
tend-agent
left a comment
There was a problem hiding this comment.
Not approving this revision yet; the existing install-test thread still applies on the current head.
generate_install_test() still emits a same-repo pull_request workflow that reads TEND_BOT_TOKEN and the harness secret from repo secrets. Once this file lands on the default branch, a leaked write-scoped bot token can push a same-repo branch that modifies .github/workflows/tend-install-test.yaml and opens a PR touching .config/tend.yaml; GitHub will run the PR-head workflow with repo secrets, so the branch can exfiltrate the same credentials the security model is trying to contain. The short-lived/nightly-cleanup window still leaves an exploitable period after install. Please split the secret-presence check onto a trusted/default-branch path, or avoid generating a PR-head workflow that reads these secrets.
Tag operations become the same shape as merges to the default branch: a single admin-bypass ruleset, no per-repo pattern question. The chain collapses to "default branch and all tags are admin operations; nothing else is." Environments pin to those two ref classes; bot reaches neither. - §3: drop the AskUserQuestion for tag pattern. The tag-operations ruleset uses `~ALL` (all tags), parallel to `~DEFAULT_BRANCH` on the merge ruleset. Add a "release/deploy workflows trigger only on push: tags or push: branches: [main]" prescription -- a pull_request- triggered workflow runs the YAML at the PR head, which the bot can write, breaking the chain at the workflow file. Note that more complicated approaches are possible (per-pattern rulesets, no-bypass immutability for publishers, required-reviewer env gates) but the packaged recipe is the simpler chain. - Release-secrets bullet: env tag policy becomes `name=*, type=tag`. No $TAG_PATTERN variable. - references/security-model.md "The chain": "Operating on a tag" covers all tags (~ALL), parallel in shape to the merge bullet. - docs/security-model.md "Environment-protected secrets": restated around "default branch + all tags" as the two admin-gated ref classes. Applied parallel rulesets on max-sixty/tend (id 16490366) and max-sixty/worktrunk (id 16490367): tag-target, ~ALL, creation+update+ deletion, admin bypass. max-sixty/tend's release env additionally pinned to `name=*, type=tag` (it previously had no branch policy, leaving its secrets reachable from any ref). max-sixty/tend retains its existing "Release tag immutability" ruleset (refs/tags/[0-9]*, no bypass) as publisher-specific layered defense for downstream consumers pinning release tags. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
Not approving this revision yet; the existing install-test thread still applies, and the new all-tags model left a couple of stale release-tag-pattern references.
The chain needs `creation` + `update`, not `deletion`. `update` is what force-push of an existing tag fires server-side: a write-access bot without the `update` rule could `git push --force origin <evil-sha>: refs/tags/v1.2.3` and silently re-point an admin-pushed tag to a malicious commit, bypassing the chain through the existing tag. `deletion` is not chain-critical: a deleted tag cannot be substituted by the bot because recreation is already blocked by `creation`. The only damage is brief availability of the tag itself (admin can re-push). Repos that publish actions consumed via tag pins still want `update` + `deletion` with `bypass_actors: []` for the supply-chain immutability property; that's the publisher-specific layered uplift, already documented parenthetically. - SKILL.md §3 ruleset body: rules become [creation, update]; the prose explains why `update` is the load-bearing piece (force-push fires `update`, not `creation`) and why `deletion` is omitted. - references/security-model.md "Operating on a tag": same scope, same reasoning. - docs/security-model.md "Environment-protected secrets": "creation and update" rather than "creation, update, deletion." Applied to the live rulesets on max-sixty/tend (16490366) and max-sixty/worktrunk (16490367) via PUT. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
Not approving this revision yet; the existing install-test thread is still unresolved, and the updated all-tags model left a few stale or contradictory install docs.
Three doc-consistency drifts left by the simplification to `~ALL` on the tag-operations ruleset, surfaced by tend-agent's review: - SKILL.md §3 "Release/deploy workflow design": the "Other triggers ... keep the chain" sentence contradicted the recipe's "must trigger on push:tags or push:branches:[main]" rule. Reframed: those triggers are outside the packaged recipe; their workflow files do run from the default branch (so code is admin-vetted), but a write-scoped bot can initiate them, so the env policy alone doesn't gate them. If a repo keeps such a trigger, treat as a custom design and verify trigger-specific containment per workflow. - SKILL.md Summary checklist: was "release tag operations / release tag pattern"; now matches the all-tags ruleset. - references/security-model.md chain section: was "release tag pattern / non-release tag"; now reflects that the bot can push neither the default branch nor any tag. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
Not approving this revision yet; the existing install-test thread still applies, and the shipped security reference needs the same trigger precondition as the install walkthrough.
Reviewer caught that references/security-model.md's chain paragraph still presented the env-pin as a complete gate without the trigger caveat that §3 of SKILL.md now has -- the env policy only filters GITHUB_REF, but `workflow_dispatch` / `release: published` / `deployment` / `schedule` can be fired by a write-scoped bot against an admin-gated ref, so the env admits them. Adds the trigger-specific containment caveat to both docs/security-model.md and references/security -model.md so they describe the same boundary. The two files are intentionally not byte-mirrored (different scopes, different audiences), but a security-claim change has to land in both to avoid the drift this revision is fixing. Surfacing as a follow-up: either lint for paired edits, or invert the canonical direction so docs/ derives from references/. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
Not approving this revision yet; the docs/reference changes now carry the trigger caveat, but the existing install-test thread still applies on the current head.
generate_install_test() still emits a same-repo pull_request workflow that reads TEND_BOT_TOKEN and the harness secret from repo secrets. Once this file lands on the default branch, a leaked write-scoped bot token can push a same-repo branch that modifies .github/workflows/tend-install-test.yaml and opens a PR touching .config/tend.yaml; GitHub will run the PR-head workflow with repo secrets, so the branch can exfiltrate the same credentials the security model is trying to contain. Please split the secret-presence check onto a trusted/default-branch path, or avoid generating a PR-head workflow that reads these secrets.
|
FYI am debugging why Codex seems to be so bad at following the |
…full (#551) ## Summary Two related fixes from investigating why Codex re-posts near-identical reviews on long-lived PRs (e.g. #535). **`debug-tend-run` now supports both harnesses.** The artifact download pattern matches `claude-session-logs*` and `codex-session-logs-*`; per-harness JSONL parsing recipes moved into `references/claude-logs.md` and `references/codex-logs.md`, loaded on demand. `SKILL.md` is now a thin harness router. All Codex jq recipes were validated against real PR #535 session logs. **Codex is told to read skills in full.** Codex has no skill-loading tool: it `sed`s `SKILL.md` files, and its own injected instruction ("read only enough to follow the workflow") makes it stop at a prefix. In all four PR #535 review runs it read only lines 1-220 of the 602-line `running-in-ci`, missing the dedup rule at line 310 that prevents the repetitive "prior thread still applies" preface. The truncation was verified to be the model's own choice, not a hard context or output cap (no skills-budget event fired; the read ended cleanly under the token cap). `codex/agents-tail.md` now carries an explicit directive to `cat` each tend `SKILL.md` in full, overriding the generic "read only enough" guidance. This is a mitigation, not a structural fix: `running-in-ci` stays a single 602-line file. The directive is a soft override of OpenAI's built-in behavior. If repetition persists, the next lever is shortening `running-in-ci` or moving the dedup rule earlier in the file. ## Test plan - [ ] `debug-tend-run` Codex recipes produce correct output against a real `codex-session-logs-*` artifact - [ ] A Codex CI run reads `running-in-ci` in full (`cat`, not `sed -n '1,Np'`) after this lands - [ ] Repetitive-review behavior on long-lived PRs no longer recurs Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
) ## Summary Fixes the root cause of tend re-posting near-identical "Not approving; the prior thread still applies" reviews on every push to a long-lived PR (observed on #535). `review/SKILL.md` contained two instructions that contradicted each other on a non-trivial push with no new findings: - The dedup rule (sibling-workflow dedup from `running-in-ci`): omit already-covered points, stick to diff-grounded findings. - The posting rule: "Post exactly one review per run. Always give a verdict." So when a push was non-trivial (skipping the trivial-diff early-exit) but introduced no new finding, the reviewer still posted a fresh review whose entire content restated an already-blocking unresolved thread. Both rules are now reconciled into one decision: after dedup, if there is no new diff-grounded finding on the incremental changes and the only outstanding concern is a still-unresolved prior bot thread, post nothing. That thread already blocks the PR; the earlier review stays the active verdict. A fresh review is warranted only when the incremental diff adds a finding or resolves the last open one (then approve with an empty body). This is harness-independent. It complements #551 (which stopped Codex truncating long skills) by removing the ambiguity that produced the behavior in the first place, so it holds even when the full skill is read. ## Test plan - [ ] On a long-lived PR with an unresolved bot thread and a non-trivial push that adds no new finding, the reviewer posts no new review and the prior thread still blocks - [ ] A push that introduces a new finding still produces a COMMENT review - [ ] A push that resolves the last open concern still produces an empty-body APPROVE Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
## Summary Release 0.0.24. 11 PRs since 0.0.23: - #545 Rewrite the workflow generator on Jinja2 templates - #546 generator: switch build backend to uv_build - #544 generator: route install-test through `_apply_extras` - #535 install-tend: unify on the chain model (admin-gated refs + env policy pin) - #537 review-reviewers: migrate to the Codex harness - #551 debug-tend-run: support Codex session logs; instruct Codex to read skills in full - #552 review: stop re-posting "prior thread still applies" on every push - #547 fix(stats): stop blacking out the section on transient worker outage - #548 site: simplify "currently tending" to a prose repo list - #549 site: refresh "currently tending" on a 30s timer - #550 site: refresh Stats and Activity on a timer #551 and #552 are the reason for cutting now: together they stop the Codex harness re-posting near-identical "the prior thread still applies" reviews on every push. The behavior is release-gated, so it only reaches tend's own dogfooded workflows once 0.0.24 is published and the nightly regen repins the action ref. No new breaking changes since 0.0.23 (the `TEND_BOT_TOKEN` rename shipped in 0.0.23). ## Test plan - [ ] CI green (test, test-worker, lint) - [ ] After merge: tag `0.0.24`, PyPI publish (`pypi-release.yaml` on the tag push), `uvx [email protected] --help` works - [ ] Regenerate tend's own workflows to `@0.0.24` (separate `chore: regenerate` PR, after the tag exists) Co-authored-by: Claude <[email protected]>
Why
Two related problems, converged into one PR through iteration:
install-tendreferenced tend-repo-internal paths (docs/security-model.md,docs/tend.example.yaml,.github/workflows/codex-auth-refresh.yaml). The plugin ships only./plugins/install-tendto adopters, so those refs were dangling for the actual audience.required_reviewers+prevent_self_reviewas the gate for the no-merge path. That worked, but a simpler model exists: gate the refs every privileged workflow runs on, instead of gating each deploy. If both default-branch merges and tag operations are admin-only, every privileged code path chains to an admin operation, and the bot (write, not admin) reaches neither ref or any environment pinned to them. Same threats covered, structurally simpler, matches what tend itself runs.What
install-tendskill self-containmentdocs/…reference repointed to${CLAUDE_SKILL_DIR}/references/…(shipped inside the plugin subtree).references/security-model.md— install-scoped distillation: the chain model, token-leak table, Codexauth.jsondedicated-account rationale, static-secret rotation, token assignment, and how tokens flow through workflows.references/tend.example.yaml— byte-identical mirror of canonicaldocs/tend.example.yaml, kept in sync by a new pre-commit local hook (sync-install-tend-references) that fails the commit on drift or missing canonical source. Mirror behavior empirically verified.Security guidance unified on the chain model
The skill now prescribes two admin-gated ref classes, parallel-shaped rulesets:
Merge accessupdate~ALL)Tag operationscreation,updateupdateis what force-push of an existing tag fires server-side — required alongsidecreationbecause without it a write-access bot could re-point an admin-pushed tag to a malicious commit.deletionis not chain-critical (recreation is already blocked bycreation); it's left out so the rule list stays minimal.Environments pin their
deployment_branch_policyto those refs (name=main, type=branchfor continuous-deploy,name=*, type=tagfor release-on-tag, or both). Release/deploy workflows trigger only onpush: tags:orpush: branches: [<default>]— neverpull_request, because apull_requestworkflow runs the YAML at the PR head, which a bot can write, breaking the chain at the workflow file itself.docs/security-model.mdtrimmed from 377 → ~160 lines (summary + risks only); operational reference content moved intoreferences/security-model.mdwhere the install agent actually meets it. "What we do" reframed as two load-bearing boundaries (merge restriction + environment chain) rather than a single boundary plus disclaimed defense-in-depth.Live application
Applied parallel rulesets on:
max-sixty/tend(Tag operations id 16490366) +releaseenv pinned to*tags (was unguarded, leaving PYPI_TOKEN reachable from any ref).max-sixty/worktrunk(Tag operations id 16490367); itsreleaseenv already had av*policy, so the chain now holds.Tend retains its existing
Release tag immutabilityruleset (refs/tags/[0-9]*, no bypass onupdate+deletion) as the publisher-specific layered defense for downstream consumers pinningmax-sixty/[email protected]. The skill mentions this case parenthetically as the "publisher uplift" option, not in the default recipe.What this changes for adopters
Running
install-tendon a typical adopter repo now sets up:The skill no longer prescribes per-deploy
required_reviewers/prevent_self_review. That mechanism is mentioned as one of the "more complicated approaches available if you need them"; the packaged recipe is the structurally simpler chain.Provenance / verification
The GitHub mechanics this rests on were verified against primary sources across the iteration loop, including the empirical test that force-push of an existing tag fires the
updaterule (a force-push test against0.0.18was rejected withCannot update this protected ref— confirmingupdateis the relevant rule for tag re-pointing).Test plan
generator/tests: 242 pass, 0 snapshot changes (no generator code touched in this PR).pre-commit run --all-filesgreen, including the newsync-install-tend-referenceshook (drift and source-missing failure paths exercised manually).origin/mainmerged twice during the iteration (releases 0.0.21–0.0.23, codex-cutover, BOT_TOKEN→TEND_BOT_TOKEN rename, install-test workflow, install-test refactor). Conflicts resolved with theirs in cases my branch hadn't independently modified the file.Not in this PR
worktrunk'srelease.yamlstill triggers onpull_requestin addition topush: tags:. The chain now blocks the env-secret path (env rejects feature-branch refs), but the workflow design retains the "primary gap" shape — a bot-modified workflow YAML on apull_requestcould read whatever repo-level secrets it declares. Deferred to a separate worktrunk-internal change.🤖 Generated with Claude Code