Skip to content

ci(agentry): prime claude-code onboarding to fix headless auth#122

Merged
Oddly merged 4 commits into
mainfrom
fix/agentry-ci-tuning
Apr 11, 2026
Merged

ci(agentry): prime claude-code onboarding to fix headless auth#122
Oddly merged 4 commits into
mainfrom
fix/agentry-ci-tuning

Conversation

@Oddly
Copy link
Copy Markdown
Owner

@Oddly Oddly commented Apr 11, 2026

The agentry code-review workflow has been failing on every run with agent execution failed: Exit code 1, and the triage/planning-pipeline runs have been quietly reporting every node as failed while the job still shows green (composition pipelines don't propagate node failures to the shell exit code).

Root cause is anthropics/claude-code#8938: CLAUDE_CODE_OAUTH_TOKEN on its own is not enough on a fresh runner. Claude Code also checks ~/.claude.json for hasCompletedOnboarding, and when that's missing it tries to render the theme-picker TUI. On a headless runner that aborts immediately with Raw mode is not supported on the current process.stdin, the claude subprocess exits 1, and agentry surfaces it as a generic "agent execution failed".

This adds a one-line prime step to each of the four agentry workflows that writes {"hasCompletedOnboarding": true} to ~/.claude.json before invoking agentry, so claude -p can skip onboarding entirely and go straight to the work.

The Agentry: Code Review job on this PR is the canary — if it lands green and actually emits structured findings, A is the full fix.

Summary by CodeRabbit

  • Chores
    • Updated CI/CD workflows to pre-initialize the Claude Code environment and mark onboarding as completed so tooling no longer triggers interactive onboarding prompts; improves reliability of bug fixes, code reviews, feature runs, and triage jobs.

Setting CLAUDE_CODE_OAUTH_TOKEN is not enough on a fresh runner: claude
also checks ~/.claude.json for hasCompletedOnboarding and, when it's
missing, tries to render the theme picker TUI. That aborts immediately
with "Raw mode is not supported on the current process.stdin", which
agentry surfaces as "agent execution failed: Exit code 1". See
anthropics/claude-code#8938. Writing the flag before agentry runs lets
-p mode skip onboarding entirely.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2226aa45-6d39-41e3-93a9-cfb93d63212e

📥 Commits

Reviewing files that changed from the base of the PR and between 26de0ea and 4d46116.

📒 Files selected for processing (1)
  • .github/workflows/agentry-code-review.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/agentry-code-review.yaml

📝 Walkthrough

Walkthrough

Adds a step to four GitHub Actions workflows that primes Claude Code onboarding by creating ~/.claude/ and writing ~/.claude.json with {"hasCompletedOnboarding": true}; one workflow also adds a diagnostic probe step that sets an OAuth token, probes the Claude CLI, and logs results before the code-review step.

Changes

Cohort / File(s) Summary
GitHub Actions — onboarding priming
.github/workflows/agentry-bug-fix.yaml, .github/workflows/agentry-feature-implement.yaml, .github/workflows/agentry-triage.yaml
Inserted a "Prime Claude Code onboarding" step after installing @anthropic-ai/claude-code that creates ~/.claude/ and writes ~/.claude.json with {"hasCompletedOnboarding": true} to avoid interactive onboarding.
GitHub Actions — onboarding + diagnostic probe
.github/workflows/agentry-code-review.yaml
Added the same "Prime Claude Code onboarding" step and a diagnostic step that exports CLAUDE_CODE_OAUTH_TOKEN from secrets, prints claude --version, lists ~/.claude, runs claude -p (captures JSON output and exit code) before the existing "Run code review" step.

Sequence Diagram(s)

mermaid
sequenceDiagram
rect rgba(220,240,255,0.5)
participant Runner as GitHub Runner
participant Installer as "Install @anthropic-ai/claude-code"
participant FS as "Filesystem (~/.claude)"
participant Secrets as "GitHub Secrets"
participant Claude as "claude CLI"
participant Review as "Run code review"
end
Runner ->> Installer: npm install claude-code
Installer ->> FS: create ~/.claude/ and write ~/.claude.json
Runner ->> Secrets: read CLAUDE_CODE_OAUTH_TOKEN
Runner ->> Claude: set env token; run claude --version and claude -p
Claude -->> Runner: probe JSON output and exit code
Runner ->> Review: invoke code review step

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: adding a priming step to claude-code onboarding across agentry CI workflows to resolve headless authentication issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/agentry-ci-tuning

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/agentry-triage.yaml (1)

23-28: Consider centralizing this onboarding priming step.

The same block is repeated across four workflows; moving it to a composite action or reusable workflow step would reduce drift risk and simplify future changes.

As per coding guidelines, ".github/workflows/**: Check workflow syntax, appropriate use of self-hosted vs ubuntu-latest runners, secret references, and concurrency settings."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/agentry-triage.yaml around lines 23 - 28, Extract the
repeated "Prime Claude Code onboarding" step (the run block that creates
~/.claude and writes '{"hasCompletedOnboarding": true}' to ~/.claude.json) into
a single reusable unit (either a composite action under .github/actions or a
reusable workflow) and replace the duplicated run blocks in each workflow with a
call to that unit; ensure the new composite/reusable step exposes no secrets,
documents that it is safe to run on ubuntu-latest, and updates each workflow to
reference the centralized action name (e.g., uses:
./.github/actions/prime-claude-onboarding or uses:
owner/repo/.github/workflows/prime-claude-onboarding.yml) so future changes are
made in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/agentry-triage.yaml:
- Around line 23-28: Extract the repeated "Prime Claude Code onboarding" step
(the run block that creates ~/.claude and writes '{"hasCompletedOnboarding":
true}' to ~/.claude.json) into a single reusable unit (either a composite action
under .github/actions or a reusable workflow) and replace the duplicated run
blocks in each workflow with a call to that unit; ensure the new
composite/reusable step exposes no secrets, documents that it is safe to run on
ubuntu-latest, and updates each workflow to reference the centralized action
name (e.g., uses: ./.github/actions/prime-claude-onboarding or uses:
owner/repo/.github/workflows/prime-claude-onboarding.yml) so future changes are
made in one place.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8fd88c89-cc1c-4150-a6da-83f15fbcbede

📥 Commits

Reviewing files that changed from the base of the PR and between b9169f7 and 876e9b1.

📒 Files selected for processing (4)
  • .github/workflows/agentry-bug-fix.yaml
  • .github/workflows/agentry-code-review.yaml
  • .github/workflows/agentry-feature-implement.yaml
  • .github/workflows/agentry-triage.yaml

@github-actions
Copy link
Copy Markdown

Agentry Code Review

No structured output was returned by the agent.


Tokens: 11,574 in / 1,314 out

@Oddly Oddly merged commit a6d5f0f into main Apr 11, 2026
12 checks passed
@Oddly Oddly deleted the fix/agentry-ci-tuning branch April 11, 2026 14:50
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