fix(cli): classify vendor 401s as credential skips in live dogfood - #3831
Open
npwalker wants to merge 1 commit into
Open
fix(cli): classify vendor 401s as credential skips in live dogfood#3831npwalker wants to merge 1 commit into
npwalker wants to merge 1 commit into
Conversation
The live-dogfood runner only converted a 401 into a runner-credentials
skip when the response body matched one of five hardcoded phrases. Vendor
401 bodies are unstandardized, so an API answering
`{"code":124,"message":"Invalid access token."}` fell through to an
http_4xx failure and scored dozens of correct no-credential outcomes as
real regressions.
Trust the printed CLI's own typed auth exit code (4, emitted by authErr)
as the primary signal: exit 4 plus an HTTP 401 in the output is a
credential-unavailable skip regardless of vendor wording. The phrase list
stays as the fallback for runs whose exit code is a generic failure, and
gains the vendor wordings observed in the wild (invalid/expired token,
bare "unauthorized").
Refs mvanhorn#3827
Closes mvanhorn#3827
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BRGzpiy4LuvcAF5QG6dYJc
Contributor
Merge Protections🔴 2 of 2 protections blocking · waiting on 🙋 you
🔴 require-ready-label-and-ciWaiting for any of
This rule is failing.
🔴 🚦 Auto-queueWaiting for
This rule is failing.When all merge protections are satisfied and these conditions match, this pull request will be queued automatically.
|
Contributor
Greptile SummaryThis PR improves live-dogfood credential-failure classification.
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The new classification remains gated on HTTP 401 output, and generated CLIs reserve exit code 4 for auth-classified errors; tests cover both the widened path and its key negative cases.
|
| Filename | Overview |
|---|---|
| internal/pipeline/live_dogfood.go | Uses the generated CLI’s auth-specific exit code alongside the existing HTTP 401 gate and retains phrase matching as a fallback. |
| internal/pipeline/live_dogfood_test.go | Covers recognized and unrecognized 401 bodies, typed and generic exit codes, and negative non-401 cases. |
Reviews (1): Last reviewed commit: "fix(cli): classify vendor 401s as creden..." | Re-trigger Greptile
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
The live-dogfood runner scores a command that failed purely because the runner has no credentials as a
skip(unavailable for runner credentials), not afail. That conversion was gated on the 401 body matching one of five hardcoded phrases. Vendor 401 bodies are unstandardized, so an API answering{"code":124,"message":"Invalid access token."}matched nothing and 44 correct no-credential outcomes were scored ashttp_4xxfailures.Issue: Closes #3827
Approach
Trust the printed CLI's own typed exit code as the primary signal instead of guessing from prose. Printed CLIs return exit
4fromauthErrfor auth failures, soexit 4+ anHTTP 401in the output is a credential-unavailable skip regardless of how the vendor worded the body.The phrase list is kept as the fallback for runs that surface a 401 but exit with a generic failure code, and it gains the wordings observed in the wild (
invalid access token,invalid token,expired token,token expired,unauthorized). It moved to a package-level slice consumed by the existingcontainsAnyOfhelper, matching the shape of the neighbouringliveDogfoodRequiredParamFixturePhrases.Both signals remain gated on
http 401being present, so a 404 whose body happens to contain auth-ish wording is still a genuine failure.Scope
Primary area:
internal/pipeline(live dogfood result classification)Why this belongs in this repo: this is the Printing Press's own dogfood scorer, not a printed CLI. Every printed CLI's live-dogfood matrix is misscored by the phrase gate, and the fix generalizes across APIs by keying on the generator-emitted typed exit code rather than on any one vendor's message.
Risk
Slightly widens what counts as a credential skip. The widening is bounded by the
http 401precondition, so a real 401 that a runner with valid credentials would still hit could now be skipped instead of failed — an acceptable trade against the current behavior of reporting dozens of false regressions. No generated output, MCP surface, auth, publish, or release behavior changes.Output Contract
N/A — no template, generated-file, manifest, MCP-schema, scorecard, or pipeline-artifact shape changes.
scripts/golden.sh verifywas run anyway and passed 32/32 unchanged.Verification
go test ./...— every package green.internal/generator(untouched by this change) needs more than the local default deadline on this machine and was re-run alone:go test ./internal/generator/ -timeout 40m->ok ... 1734s. CI shards that package with its own 12-15m budget.scripts/golden.sh verify— pass, 32 cases, no diffgolangci-lint run ./internal/pipeline/— 0 issuesNew table-driven test
TestLiveDogfoodAuth401TypedExitCodecovers the typed-exit-4 path (recognized and unrecognized wording, 401 present and absent, and the generic-exit-code fallback), asserting bothliveDogfoodAuth401andliveDogfoodUnavailableForRunner.TestLiveDogfoodAuth401OutputMatchesGooglePhrasesextended with the reported vendor shape, a bareUnauthorizedbody, and a negative case proving a 404 carrying auth wording still fails.TestLiveDogfoodUnavailableForRunnerDoesNotHideNotFoundextended with the reported vendor shape.Generator/template change: verified generated output, including emitted-code assertions or compiled generated CLI output
Generator/template change: covered the affected fallback or variant shape, not only happy-path fixtures
Generator/template change: checked emitted definitions and call sites for matching gates
(Not a generator/template change — no emitted Go is affected.)
AI / Automation Disclosure
🤖 Generated with Claude Code
https://claude.ai/code/session_01BRGzpiy4LuvcAF5QG6dYJc