Skip to content

feat: seed SuperGrok CI secrets from ecr setup-auth - #121

Draft
Kudo wants to merge 1 commit into
feat/grok-oauthfrom
feat/grok-ci-seed
Draft

Kudo wants to merge 1 commit into
feat/grok-oauthfrom
feat/grok-ci-seed

Conversation

@Kudo

@Kudo Kudo commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Why

A SuperGrok access token lasts 6 hours, and a review cannot renew it. CI needs a scheduled workflow that refreshes the token. That workflow needs a refresh token that no other client uses. ecr setup-auth only handed out access tokens, so the first tokens had to come from a separate script.

How

ecr setup-auth --ci-store <owner/repo> --ci-target <owner/repo> starts the chain.

  • It shows the secrets it will overwrite and asks first. --yes skips the question.
  • It checks that gh can reach the secrets of each repo. This runs before the login.
  • It runs the SuperGrok device login in a temporary OpenCode store, then deletes that store. The developer's own OpenCode sign-in is not read or changed.
  • It does not write an access token that a review would refuse.
  • It writes XAI_OAUTH_REFRESH_TOKEN to the store repo first. Then it writes XAI_OAUTH_ACCESS_TOKEN to the store repo and to each target repo.

Each value goes to gh secret set through stdin. So no token is on a command line, in an error message, or on the terminal.

LLP 0007 said the refresh token never leaves OpenCode's store. The CI seed is now the one exception, and it uses a login that no OpenCode store keeps.

The refresh workflow is not part of this PR.

Test Plan

  • bun test: 1194 pass. 12 are new, in ci-secrets.test.ts and setup-auth.test.ts. They use a fake gh and a fake opencode.
  • bun run typecheck, bun run lint, bun run fmt:check, and bun run llp:check.
  • The built CLI on Node 26 with a fake OpenCode and a fake gh: a full seed, a secret write that fails, a login that returns an expired token, a "no" at the question, and bad flags (exit 2).
  • Not run: a real device login in a temporary store, and a real gh secret set.

Stacked on #120.

🤖 Generated with Claude Code

A SuperGrok access token lasts 6 hours, so CI needs a scheduled workflow that refreshes it. That workflow needs a refresh token that no other client uses, and setup-auth only handed out access tokens.

`ecr setup-auth --ci-store <owner/repo> --ci-target <owner/repo>` signs in to SuperGrok in a temporary OpenCode store and writes both tokens to GitHub Actions secrets with `gh`. Each value goes through stdin, so no token is printed. The refresh token goes to the store repo only.
@Kudo
Kudo added this pull request to stack #122 November 27, 2026 17:19
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🤖 AI code review

Decision: Ready for human review

Overall PR risk: Medium. The change is additive, introducing new --ci-store and --ci-target flags. The new code path is isolated: without these flags, the original flow runs unchanged. The affected surface is limited to users running the new flags, and the most plausible issues are wrong --ci-target sending access tokens to an unintended repo or partial write failures leaving secrets out of sync. No code defects were found in review.

🔎 Reviewer summaries (3)
  • consistency: I checked the new CI seed mode of setup-auth and the new ci-secrets module against sibling commands and exec helpers. The code follows the repo conventions, so this pass reports no findings.
  • correctness: Reviewed the new setup-auth CI seed mode and the ci-secrets module. The temporary-store login, the stdin-only secret writes, the error paths, and the argument parsing are correct. I found no defects.
  • security: I reviewed the new SuperGrok CI seed for token handling. Tokens go to gh through stdin and the temporary store is deleted. The error messages hold no token values, and the repo slugs cannot be read as flags. I found no security defect.

🔗 Review setup:

  • This PR changes code the reviewer prompts cite (src/tests, src/cli.ts, templates/config.jsonc). Check that the guidance quoting it is still correct.

No findings.


This review is advisory — it never blocks a merge and never auto-approves.

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