Repository navigation
Ask for a credential's value directly when the setup agent has no LLM provider - #91
Draft
josephschorr wants to merge 1 commit into
Draft
josephschorr wants to merge 1 commit into
josephschorr wants to merge 1 commit into
Conversation
… provider A credential with no builtin setup flow is handed to the LLM-driven setup agent, which needs a model API key in the environment. With none set, the run failed with "LLM provider unavailable: anthropic: ANTHROPIC_API_KEY not set" and offered no way to type the value, including when the credential being set was that same API key. llmagent.Run now reports a missing provider as ErrNoLLMProvider. On that error the engine asks for the value itself, through the same presenter, format gate, verify-then-store closure and Store chokepoint a builtin flow uses, so the value lands in the secretRef the AgentIdentity already declares. The fallback applies only to a bearer-shaped provider or an inline-prompt requirement; other shapes fail as before, and a run told not to prompt is still refused before the agent is tried.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch has not been deployed
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.
Motivation
oap agent setup-identity <agentclass> --refresh anthropic-api-key, for acredential declared
type: staticwith astatic.secretRef, failed with:A credential with no builtin flow is handed to the LLM-driven setup agent,
which needs a model API key in the environment. Setting that very key
therefore required already having it exported, and no credential without a
builtin flow could simply be typed.
Summary of changes
llmagent.Runreports a failedLLMProviderFactoryasErrNoLLMProvider(error text unchanged).
engine-built
pasteFlow, run through the same presenter, token-shape gate,verify-then-store closure and
Storechokepoint as a builtin flow. Thevalue is written to the secretRef the AgentIdentity already declares.
shape: bearerproviders and inline-promptrequirements. Other shapes fail as before.
--non-interactiveis stillrefused before the agent is tried.
tui.NewSecret, so input is hidden on a terminal. Existingbuiltin flows use
tui.NewText, which echoes as typed; they are unchanged.setupandllmagent, and the comment inproviders/anthropic-api-key.yaml, updated to match.Known limit: with stdout on a terminal and stdin piped, the masked field
reads nothing, so
echo <key> | oap agent setup-identity …from a terminalfails with "no value was supplied" and stores nothing.
Alternatives considered
anthropic-api-keybuiltin: a near copy ofanthropic-oauththat adds nothing the provider YAML does not already declare, and leaves
inline-prompt requirements and future builtin-less providers failing the
same way. Still a reasonable follow-up, so this credential skips the LLM
agent even when a key is present.
by a provider's
builtin:field with one provider per builtin, andinline-prompt requirements have no provider.
Provenance
Ship gate
mage test:unitmage test:integrationmage test:e2eResults:
Not run in full. Run so far:
Not exercised against a cluster or on a real terminal.
Regeneration
config/**: n/amage fmt:all/mage fmt:check: oxfmt run on the two touched READMEsonly; full
mage fmt:checknot runCoverage
tests in
pkg/platform/identity/setuponly)Before requesting review