Skip to content

skills(install-tend): make credential rotation explicit - #1385

Merged
max-sixty merged 10 commits into
mainfrom
consume
Sep 22, 2026
Merged

max-sixty merged 10 commits into
mainfrom
consume

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Make credential rotation discoverable in the install-tend skill description. Rotation identifies the active harness auth mode, creates a replacement, updates the secret, and directs revocation of the superseded credential where supported. The Codex subscription path explicitly reports that the prior login may remain valid. Bot token rotation revokes the old GitHub CLI authorization before device refresh and verifies the new token against GitHub before updating the secret. The frontmatter test covers all installed skills, including both install-tend skills, within the Codex listing budget.

This was written by Codex on behalf of max-sixty

max-sixty and others added 6 commits September 5, 2026 13:41
The description's change-trigger clause listed config, workflows, secrets,
environments, branch protection and bot access, which left the most common
later request — minting a fresh token, or moving a repo's CI onto a different
Claude or OpenAI account — reading as out of scope. Name the credentials
(CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY, TEND_BOT_TOKEN) and the
switch-accounts case explicitly.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_016yUfmSVeTgTKtHWgW3H6MY
# Conflicts:
#	plugins/install-tend/skills/install-tend/SKILL.md

@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 new trigger advertises a path the body doesn't have: both credential steps route on whether a credential is present, not on whether the user asked for a new one, so a rotation request lands on a step that reads as already complete.

  • Step 7a — the pre-check prints SET whenever either Claude secret exists, and the only mint instruction is conditioned on its absence ("If not set, mint per the auth mode chosen at Kickoff"). Step 7's preamble makes that the step's completion test outright: "the step finishes when its pre-check prints SET". On a rotation that holds before the user does anything.
  • Step 8 — "Logged in as <bot-name> with a Token scopes: line listing all six scopes → skip to 8c" sends a still-valid bot token straight to 8c, which re-pushes the token already on disk. 8c's own guard ("verify the Updated timestamp is fresh") passes on a re-push of the same value, so a leaked PAT survives a run that looks successful.

Both want a branch on intent rather than on state: step 7 re-mints regardless of the pre-check, confirming by the environment secret's Updated timestamp moving; step 8 routes a rotation to 8a, whose device flow issues a new token, rather than to 8c. Happy to push that as a commit if you'd like it — it's outside this diff, so I've left it here rather than as a suggestion.

Separately, worth knowing rather than a change to ask for: the added phrase sits at character 360 of the description and Use when at 301, so wherever both plugins are installed under Codex — the configuration DESCRIPTION_BUDGET = 130 in generator/tests/test_repo_pins.py is measured against — the description is cut inside its first sentence and neither this trigger nor the existing tend check one reaches the listing. The change does its job on Claude Code only. That test exempts install-tend because a person invokes it by name, which isn't the model-side matching this PR is for, so if the trigger matters under Codex it needs to move earlier in the sentence rather than onto the end of it.

@max-sixty max-sixty changed the title skills(install-tend): trigger on credential rotation skills(install-tend): make credential rotation explicit Sep 22, 2026

@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 bot-PAT rotation now routes to 8a, but nothing on that path invalidates the credential it rotates away from. gh auth refresh runs the device flow and then writes exactly one thing — authCfg.Login(hostname, authedUser, authedToken, ...) in pkg/cmd/auth/refresh/refresh.go — so the token it replaces stays valid on GitHub's side, and no step in 8 asks anyone to revoke it. On the case that motivates rotating a PAT at all — one that may have leaked — the run ends green with the leaked token still accepted. 8c's new caveat is honest that the timestamp proves only that the secret was written, but the step it defers to doesn't establish the rest either. Revoking the bot's GitHub CLI authorization before 8a settles it, and 8a's existing "(a revoked one yields just the six)" already describes that state, so the scope merge still lands on the right set; inline suggestion on the routing bullet.

The frontmatter test now covers one of install-tend's two skills — see the inline comment on the appended path.

Outside the diff: step 7a's warning about a malformed pasted token still cites "this step's own pre-check above", which is the SET/NOT SET block this commit deleted. The substance survives in the listing that replaced it, so the parenthetical wants to read "(check_secrets, and the listing above)". Happy to push that along with anything else you want from here.

Comment thread generator/tests/test_repo_pins.py Resolved

@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.

Routing a rotation through a revoke gives 8c a state it can't distinguish from success. gh auth token is a storage read with no API call — pkg/cmd/auth/token/token.go resolves authCfg.ActiveToken(hostname) and prints it — so once the user has revoked the GitHub CLI authorization, any path that reaches 8c without a completed 8a (an expired device code, an abandoned browser step, a resumed session) prints the dead token, clears the [ -z "$BOT_GH_TOKEN" ] guard, sets the secret, and advances Updated — which is exactly the verification 8c asks for. TEND_BOT_TOKEN ends up holding a revoked credential while the step reads as complete, and the first sign is every workflow 401ing. The inline suggestion swaps the emptiness guard for an identity check, which also gives 8c a verification of the thing its own new caveat concedes the timestamp doesn't prove.

Step 7 and step 8 now define rotation differently. Step 8 revokes and then mints; step 7 mints a new value, writes it, and checks that Updated moved — nothing invalidates the credential being rotated away from. On a possibly-leaked CLAUDE_CODE_OAUTH_TOKEN, ANTHROPIC_API_KEY, CODEX_AUTH_JSON, or OPENAI_API_KEY, the run ends green with the old value still accepted, which is the failure step 8 was just changed to avoid. Suggestion on the preamble states the rule; I've deliberately left the per-mode surface to you, since I can confirm an API key is deleted where it was minted but haven't verified whether a claude setup-token token has a revocation surface at all — and if one mode has none, saying so is the useful answer.

Smaller: debug-tend-run's new description says the skill works "from its GitHub Actions logs", but the body downloads and parses session-log artifacts, and "session log" is the phrase a user asking for this most often types — it was in the old description and is what the compression dropped. There's headroom to keep it under the budget; suggestion inline.

Happy to push any of these if you'd rather not take them as suggestions.

@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 Codex subscription note closes off the user's options on a claim about a vendor UI. Of its three reasons, two — the temporary auth.json being removed, and GitHub secrets not being readable back — establish only that the provisioner can't reach the old token. The third, that ChatGPT's active-session controls don't cover Codex CLI sessions, is what turns that into "nothing you can do", and it's a claim about a third party's product that nothing here pins and that stops holding the moment OpenAI ships such a control. When it stops holding, a consumer rotating a subscription login they think leaked is told to accept that it stays valid — the outcome this step was just changed to prevent. Sending them to check their account's security settings asserts nothing and doesn't rot; suggestion inline.

Smaller: 8c's guard now fires on missing as well as no longer valid, but the message names 8a for both. gh auth refresh operates on the dir's active account, so an operator with an empty bot dir — a delegated 8b that never completed, or a resumed session — is sent to a command that errors on them. Suggestion inline; the three sibling blocks below still read "fix step 8 first", if you'd rather match them.

@max-sixty
max-sixty merged commit f9b2b2a into main Sep 22, 2026
12 checks passed
@max-sixty
max-sixty deleted the consume branch September 22, 2026 23:50
This was referenced Sep 23, 2026
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