Skip to content

Rotate GitHub tokens round-robin across posts - #154

Draft
leynos wants to merge 3 commits into
comenq-histfrom
comenq-tokens
Draft

Rotate GitHub tokens round-robin across posts#154
leynos wants to merge 3 commits into
comenq-histfrom
comenq-tokens

Conversation

@leynos

@leynos leynos commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Stacked on #151 (→ #149#148). Merge order: #148, #149, #151, then this.

What

  • New daemon config key github_token_files: an array of file paths, each holding one personal access token. When non-empty, posts rotate round-robin through the pool; the single-token keys still work as a pool of one. Every file is validated (present, non-empty) at startup.
  • Every posting-history record now carries token_hash, the hex SHA-256 of the token that made the attempt. Rotation selects the successor (wrapping) of the token whose hash the latest history record carries, falling back to the first token on an empty history or an unrecognized hash — so rotation state survives restarts and token-file renames, and the log never holds a secret.
  • comenq hist shows the first eight hash characters per record so you can see which identity posted.

Testing

  • Unit: SHA-256 hashing pinned to a known vector; rotation successor/wrap/fallback cases; config pool resolution (ordering, filename naming, inline fallback, empty-file and missing-file validation).
  • BDD: two new worker scenarios — posts alternate between two configured tokens (asserting distinct Authorization headers actually reach the mocked GitHub API), and rotation resuming from a seeded history record (wrap from the second token back to the first).
  • Full gates green: fmt, clippy + Whitaker dylint, 198 tests + all cucumber features, markdownlint, nixie.

🤖 Generated with Claude Code

leynos and others added 3 commits July 21, 2026 19:55
The daemon accepts github_token_files, a list of files each holding one
personal access token. Every history record now carries the SHA-256
hash of the token that made the attempt; each post uses the successor
of the token whose hash the latest record carries, so rotation
survives restarts and token file renames without logging any secret.
A single inline token still works as a pool of one, and hist shows the
first eight hash characters per record.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

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

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 33fe1616-b035-40c7-83f4-dcb8e6e61056

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch comenq-tokens

Comment @coderabbitai help to get the list of available commands.

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