Skip to content

Remove claude-smoke and the tend-manual environment it required - #820

Merged
max-sixty merged 4 commits into
mainfrom
maintain
Aug 3, 2026
Merged

max-sixty merged 4 commits into
mainfrom
maintain

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Removes the claude-smoke workflow and, once this merges, the tend-manual environment that existed only to feed it secrets.

The smoke was scaffolding for building the headless proxy harness: it ran 4 times ever, all June 17–19 while #704–#712 were under construction, and none of the ~15 harness changes since (sandbox PATH, uv isolation, sandbox levers, removing claude-interactive, the proxy readiness fix) dispatched it. Its deterministic half is covered per-PR by CI's test-proxy job at the production-pinned mitmproxy, and a harness broken in a release surfaces within a day through tend's own scheduled workflows dogfooding it, with a fix-forward release costing about an hour.

tend-manual was the reviewer-gated companion environment claude-smoke needed because its whole point — dispatching on feature branches — is what the tend ref policy exists to refuse. With its only consumer gone, the environment goes too, which also drops one paste from the credential migration in TODO.md. The credential-environments sweep is untouched: it verifies any reviewer-gated environment a repo declares, keyed on the credential rather than the name (its tests assert exactly that), and docs/security-model.md keeps documenting the pattern as the answer for bot-steerable triggers.

Also carried on this branch: two TODO.md corrections from the migration work — dropping the deleted cargo-affected BOT_TOKEN leftover, and replacing the wrong claim that a main-only policy can never admit the worktrunk/prql hand-maintained workflows' refs (probed live: pull_request_target runs at refs/heads/main and is admitted; a tag push is admitted once the policy carries a tag entry).

This was written by Claude Code on behalf of max-sixty

The repo-level secret is deleted; no workflow on any branch referenced it.
Probed against live GitHub: a pull_request_target run is admitted by a
main-only policy, and a tag run is rejected unless the policy carries a tag
entry. So most of these jobs can name the environment as they stand, and
worktrunk's release jobs can too once the policy admits tags.
The smoke ran 4 times ever, all during the harness's construction week in
June; ~15 harness changes since shipped without anyone dispatching it. Its
deterministic half lives in CI's test-proxy job, and a broken release
surfaces within a day through tend's own scheduled workflows dogfooding it.

claude-smoke was tend-manual's only consumer, so the reviewer-gated
environment goes with it. The credential-environments sweep stays: it is
written against any reviewer-gated environment a repo declares, not the
name, and the security model keeps documenting that pattern as the answer
for bot-steerable triggers.

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The removal itself checks out: TEND_MANUAL_ENVIRONMENT had no reader anywhere in the tree (only its definition), .github/claude-smoke-prompt.md had no other consumer, and the credential-environments sweep really is keyed on holding a credential rather than on a name, so docs/security-model.md's rewrite matches check_credential_environments. Generator tests and pre-commit both pass on the merged tree.

I checked the other two repos' workflows against the rewritten TODO item, and the ref accounting holds: worktrunk's benchmark gist append and both create-issue-on-*-failure jobs are if: … github.event_name == 'schedule', prql's update-rust-toolchain is gated on nightly-upstream, which is github.event_name == 'schedule' && github.repository_owner == 'prql', and prql's backport is the pull_request_target case. The remaining TEND_BOT_TOKEN readers in prql are release.yaml's brew-dispatcher, publish-winget, and push-web-branch — all covered by the third paragraph. One conflict with tend's own check, inline.

Comment thread TODO.md Resolved
check_environment pins the tend policy to exactly the admitted branches and
fix_environment deletes anything else, so the tag entry lives on a separate
release environment, the shape check_credential_environments credits.
@max-sixty
max-sixty merged commit 4672f80 into main Aug 3, 2026
14 checks passed
@max-sixty
max-sixty deleted the maintain branch August 3, 2026 18:29
max-sixty pushed a commit that referenced this pull request Aug 5, 2026
…cord guards (#835)

## Problem

`review` derives three separate signals from the bot's own review
records, and all three counted any record the bot owns. GitHub creates
the *same* record shape for something that is not a review: replying to
a review thread via `POST /pulls/{n}/comments/{id}/replies` wraps the
reply in a synthetic zero-body `COMMENTED` review anchored at whatever
HEAD was when the reply posted. So after any `tend-mention` run answers
review threads inline — its normal response path — containers sit on the
current HEAD, and every guard that asks "did the bot review this
commit?" answers yes:

- **`LAST_REVIEW_SHA`** (step 1) advances to a commit nothing reviewed,
so the next `tend-review` run computes its incremental against code it
never read and skips everything before it under the trivial-change
heuristic. This is #828.
- **`ALREADY_POSTED`** (step 5, *Posting mechanics*) becomes a false
positive and the run exits at `Already reviewed — skipping`. Same
lost-review-signal symptom, relocated to the close-out — and it costs
more, because the run has already read the diff and formed the verdict
before throwing it away. Fixing the derivation doesn't cover it: that
routes the run *into* a full review, and this guard then discards the
result.
- **`ORPHAN_ID`** (*Recovering from inline comment 422 errors*) resolves
to the container, so the case-(a) recovery would `PUT` the review body
over an unrelated inline reply.

Nothing goes red in any of the three; the run reports a well-reasoned
decision to stay silent. On a repo where the bot both authors and
reviews its own PRs, that removes the PR's only review signal. It is
deterministic — no decision point — so it recurs on every
reply-then-push flow.

## Solution

Count a review record only when it carries a body, owns at least one
*top-level* (non-reply) inline comment, or is `APPROVED`. Reply
containers have none of the three; an empty-body review carrying real
inline findings still anchors, and so does an empty-body approval.
`LAST_REVIEW_SHA` and `ALREADY_POSTED` use the full predicate (the
latter re-derives `SUBSTANTIVE`, since shell state doesn't carry between
tool calls); `ORPHAN_ID` needs only the body test, because a case-(a)
orphan always persisted a body and a container never has one. The review
and comment calls are `--paginate`d — container churn is exactly what
pushes a PR past one page of reviews — and each reduction runs over the
merged array via `jq -rs 'add | …'`, not inside `--jq`: `gh` applies
`--jq` per page, so a `| last` there yields one record *per page* rather
than one overall.

Where the two shapes are genuinely indistinguishable (a UI review whose
only content is thread replies), the filter skips it — that moves
`LAST_REVIEW_SHA` *earlier*, widening the incremental. The failure
direction is more review, not less.

## Testing

No test file covers skill prompt text, so the reproduction is a live API
comparison rather than a committed test.

**Step 1, against `max-sixty/cargo-affected` PR #54** — the case in
#828:

| review | `commit_id` | body | comments |
|---|---|---|---|
| 4851810736 | `1ffcde2` | 2441 chars | 2 top-level |
| 4851851883 | `551e059` | 0 | 1 reply (`in_reply_to_id` 3710403279) |
| 4851852052 | `551e059` | 0 | 1 reply (`in_reply_to_id` 3710403291) |

The old recipe returns `551e059` — a commit with no review, and the one
whose refactor got skipped. The new recipe returns `1ffcde2`, the real
review.

**Steps 5 and the 422 recovery, against this PR's own records.**
`tend-mention` answered both threads from the first review after the
`8699228` push, so the containers landed on the then-current HEAD:

| record | `commit_id` | body | inline comments |
|---|---|---|---|
| 4860021420 | `b75b165` | 2286 | 2 top-level |
| 4860032792 | `8699228` | 0 | 1 reply (`in_reply_to_id` 3717103568) |
| 4860032847 | `8699228` | 0 | 1 reply (`in_reply_to_id` 3717103574) |
| 4860059883 | `8699228` | 2812 | 0 |

Evaluated against `8699228` as the reviewing run saw it — that is,
before its own record 4860059883 existed — the old `ALREADY_POSTED`
returns `2026-08-05T00:32:19Z` and the old `ORPHAN_ID` returns
`4860032847`. Neither is a review; following the skill literally, that
review would not have been posted at all. The new guards discard both
containers: at `8699228` they return `2026-08-05T00:39:33Z` and
`4860059883`, the one real review at that SHA, and at `7a11332` and
`cdbf065` both return empty, where no review exists yet. The zero-body
`APPROVED` records on #812 (`02f8dce`) and #820 (`3a5621c`, alongside
two containers) both still anchor, which is what the `APPROVED` clause
is for.

Other consumers of the same records were checked and left alone:
`weekly` filters on `state == "APPROVED"` (reply containers are always
`COMMENTED`), and `notifications` counts recent bot reviews for dedup,
where a reply container legitimately means the bot responded.

---

Closes #828 — automated triage

---------

Co-authored-by: tend-agent <270458913+tend-agent@users.noreply.github.com>
max-sixty pushed a commit to max-sixty/worktrunk that referenced this pull request Aug 7, 2026
Automated nightly regeneration of tend's workflow files.

**tend version:** 0.1.13 → 0.1.14

## Notable changes

- **Jobs now name the `tend` environment with `deployment: false`**
(max-sixty/tend#852), so GitHub stops filing a deployment record per run
and posting it on the pull request. This is what the current `tend
check` flags as `environment-deployments` (#3729) — regenerating clears
it, and max-sixty/tend#853 makes `check` refuse the old shape going
forward.
- **`id-token: write` dropped from every tend job** — a side effect of
removing the claude-smoke workflow and its `tend-manual` environment
(max-sixty/tend#820). None of the remaining jobs use OIDC, so the
permission was unused.
- **`tend-mention` counts bot engagement outside `jq`**
(max-sixty/tend#840). `gh api --paginate` applies `--jq` once per page,
so `| length` emitted one count per page; past 100 comments the shell
variable held `100\n7`, the numeric test errored, and the bot fell
through to `should_run=false` — going quiet on exactly its most-engaged
threads.
- **Review and triage skill fixes** — the review-record guards now
ignore synthetic reply containers (max-sixty/tend#835), `/code-review`
is ported into a tend-owned skill (max-sixty/tend#819), and triage
substitutes the real issue number into its PR-body templates instead of
leaving a placeholder (max-sixty/tend#844).
- **Outage reporting is more robust** — a stranded outage row now names
the trigger it points at (max-sixty/tend#823), and marking a
notification read tolerates a transient run-metadata fetch failure
(max-sixty/tend#843).

Full compare: max-sixty/tend@0.1.13...0.1.14

Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
tend — 3a5621c2 Deployed Aug 3, 2026 by max-sixty via review #1044
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.

2 participants