docs(roadmap): add #455 — missing_credentials JSON hint appended as prose to error field; structured hint stays null#3068
Open
Yeachan-Heo wants to merge 1 commit into
Conversation
…rose to error field; structured hint stays null
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.
ROADMAP pinpoint #455 — structured hint field is dead; hint duplicated into error prose
Dogfooded for the 2026-05-24 07:00 Clawhip pinpoint nudge (message 1508001633416777778).
Repro (clean isolated env, ANTHROPIC_* unset, OPENAI_API_KEY set)
{ "error": "missing Anthropic credentials; export ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY before calling the Anthropic API — hint: I see OPENAI_API_KEY is set — if you meant to use the OpenAI-compat provider, prefix your model name with `openai/` (e.g. `--model openai/gpt-4.1-mini`) so prefix routing selects the OpenAI-compatible provider, and set `OPENAI_BASE_URL` if you are pointing at OpenRouter/Ollama/a local server.", "hint": null, "kind": "missing_credentials", "type": "error" }hintis always null. The actual hint payload is appended as a literal— hint: …prose suffix into theerrorfield.Root cause
rust/crates/api/src/error.rs:243-275(Display for ApiError::MissingCredentials):The unit test at
error.rs:572-599(missing_credentials_with_hint_appends_the_hint_after_base_message) even asserts:So the prose suffix is intentional — but the JSON serializer reads
Displayfor theerrorfield, while the structuredhintfield gets wired to a different (null) source. End result:hint:nullin JSON despitemissing_credentials_with_hint("…", "…", "I see OPENAI_API_KEY is set")carrying a real hint.Why distinct from existing items
/session helptypevskindmismatchpromptmissing_credentials on stderrerrorprose; structuredhintalways nullEven when transport and vocabulary are correct, the
hintfield is structurally dead.Why it matters
Automation should branch on
code/hint/kindwithout scraping prose. Today, detecting "Anthropic missing but OpenAI key present → switch to--model openai/..." requires regexing theerrorstring for— hint: I see OPENAI_API_KEYinstead of reading a typedhint:{adjacent_provider:"openai", suggested_model_prefix:"openai/", suggested_base_url_env:"OPENAI_BASE_URL"}. The regex is brittle; any future hint wording change silently breaks consumers.Required fix shape (full detail in ROADMAP entry)
(a) Keep
Displayrendering for text mode (humans need the prose hint), but stop usingDisplayas the JSONerrorfield source. (b) Serialize a baseerrorline + structuredhintobject such as{kind:"adjacent_provider_detected", provider, suggested_model_prefix, suggested_env_vars[], suggested_base_url_env}. (c) Regression coverage proving JSON envelope has both baseerrorand non-null structuredhintwhen constructed viamissing_credentials_with_hint, and the prose— hint: …does NOT appear in the JSONerrorfield. (d) Parity test for every adjacent-provider hint path.Acceptance check (one-liner)
claw -p 'hi' --output-format json 2>&1 | jq -e '.hint != null and (.error | test(" — hint: ") | not)'should pass when an adjacent provider env var is set.—
[repo owner's gaebal-gajae (clawdbot) 🦞]