Repository navigation
Closed
Description
Overview
This issue was written when no hosted provider had ever been used with the OpenAI-compatible (BYO-key) agent path. That is no longer true: the path has since been run against OpenRouter with real keys and real tool calls, for lookup and write turns, on a reasoning and a non-reasoning model (#3704, #3706). What is left is three specific checks from the original scope that nobody has done. The full original description is in this issue's edit history.
Problem Statement
- Nothing has confirmed that an API key entered in Settings stays out of the daemon log and the prompt dumps.
- The routing probe runs one synthetic routed turn per model load and switches off candidate injection for a model that fails it. Against a hosted provider, a rate limit or a transport error at probe time may be indistinguishable from a real "this model cannot route" verdict, which would switch routing off for a model that routes fine.
- A play's Edit chat opens on a message the system writes, so its first turn sends system, assistant, system, user: a conversation whose first non-system message is the assistant's. That shape is verified on the native model only. A server that is strict about role order could reject it.
Documentation
- ADR-034 - the provider modes, including OpenAI-compatible endpoints
- ADR-056 - which models count as evidence
- No docs change expected.
Acceptance Criteria
- With a key entered through Settings and several turns run, the daemon log and a prompt dump are searched for the key and it is absent; if it is present, that is fixed here
- The routing probe's verdict for one hosted model is shown to be earned: a rate-limited or failed probe request is not recorded as "cannot route", or the code is changed so it is not
- Opening Edit on a play with an OpenAI-compatible model selected and sending the first reply works on at least one hosted provider, or the rejection is recorded and fixed
- Anything found that is a separate defect is filed with its reproduction
- Code passes
bun run quality:fix
Technical Specifications
Reference Files
packages/agent/src/local_agent/openai_compat_inference.rs- the engine and its per-request loggingpackages/agent/src/local_agent/openai_compat_prompt_dump.rs- the dumppackages/agent/src/local_agent/routing_probe.rs- the per-model verdictpackages/daemon/src/services/settings_service.rs- config storage and the probe verdict carried forward
Implementation Details
- Use a free hosted OpenAI-compatible provider; a person creates the key and enters it in Settings. Record which provider and model were used.
- A transport that works with weak agent behaviour is a pass for this issue; prompt quality is not in scope.
Related Issues
- Profile AI-Chat turn latency on OpenAI-compatible endpoints and the local engine #3704 (measured this path on hosted models)
- AI-Chat context is neither targeted nor grounded: too much that does not bear on the message, too little on what it is about #3706 (made lookup and assign turns hold on hosted models)
Non-Goals
- The four-request walkthrough of the original description, which later work covered
- Prompt and guidance tuning
Activity
mstomar125 commentedon Aug 21, 2026
Picked this up but it's blocked at step 1: this issue needs a real API key from a free hosted OpenAI-compatible provider (e.g. Google AI Studio), which requires an interactive browser/account signup this environment doesn't have (standing constraint — no browser/Google account access on this remote box, deferred to local-machine sessions in prior work). Checked for an existing stored credential in ~/nodespace/.env and local NodeSpace config — none found. Leaving this on the board as Todo rather than assigning it further autonomous work; needs either a human to provision the key and hand it off, or to be picked up from a machine with browser access.
malibio commentedon Aug 21, 2026
@mstomar125 — clarification on the blocker: create the key yourself. AI Studio keys are free and self-serve, so there is no need to wait for one to be handed over.
No key should be passed around, and none should go into a
.tomlor.env— that is not the flow under test. This issue is specifically about the GUI path a user would take: open Settings, add the provider with your own key, pick that endpoint as the AI Chat model, then run the agentic requests. Entering it through Settings is part of what is being exercised, so checking~/nodespace/.envor the daemon config was looking in the wrong place by design.If browser access on that box is a hard constraint, this one needs to move to a machine that has it rather than be worked around — provisioning is a normal one-time setup step here, not a credential handoff.
Two things worth knowing before you start, both of which will otherwise look like new bugs:
#2198 is on this exact path and is yours. "OpenAI-compat engine drops assistant
tool_callsfrom replayed history" — any multi-turn agentic request replays history, so the model loses the record of what it just did. Worth fixing first; otherwise you will rediscover it by hand here.The routing probe will fire on a new served model. Stage-2 candidate injection suppresses tool-calling outright on some served models — measured on
mistral:7b, where any injected block suppressed, regardless of content (#1828/#1829). A one-time probe per(base_url, model)caches the verdict and setsrouting_disabled, so a Gemini endpoint may silently run with Stage-2 injection off — a different pipeline than the native path. Read the probe verdict out of the daemon log before drawing conclusions about behavior, or a routing difference will read as a model difference.malibio commentedon Aug 21, 2026
@mstomar125 — assigning this to you. To be explicit about scope, since "exercise it end-to-end" can be read narrowly:
This is a test-and-fix task, not just a test task. Drive the BYO-key path through the GUI as a user would, then act on whatever it turns up:
/modelsand/chat/completionsdialect handling, settings persistence, model selection, the agentic turn). Fix it here.Create the AI Studio key yourself — free and self-serve. Enter it through Settings in the running app, not a
.tomlor.env: the settings UI is part of what is under test, so bypassing it skips the surface this issue exists to exercise. No key gets handed over or committed.Two known hazards on this exact path, so they read as expected rather than as new discoveries:
#2198 is yours and sits directly under this. The OpenAI-compat engine drops assistant
tool_callsfrom replayed history, so any multi-turn agentic request loses the record of what it just did. Worth fixing first — otherwise you will rediscover it by hand here, and it will contaminate every multi-turn result you record.The routing probe fires on a new served model. Per #1828/#1829, Stage-2 candidate injection suppresses tool-calling outright on some served models — measured on
mistral:7b, where any injected block suppressed regardless of content. A one-time probe per(base_url, model)caches the verdict and setsrouting_disabled, so a Gemini endpoint may silently run with Stage-2 injection off — a materially different pipeline from the native path. Read the probe verdict out of the daemon log before drawing conclusions, or a routing difference will look like a model difference.One methodological note, learned the hard way in #2188: if something looks wrong, dump the prompt before theorising about it.
NODESPACE_PROMPT_DUMP=<path>captures the exact request at the chokepoint, and the OpenAI-compat path has its own capture point (openai_compat_prompt_dump.rs) writing to the same file with"engine": "openai_compat". Three hypotheses in that PR were refuted by a dump that took seconds to run.malibio commentedon Aug 21, 2026
Starting on this. One blocker: exercising this end-to-end requires a real API key for a free hosted OpenAI-compatible provider (Google AI Studio per the issue, or another free provider). I don't have one and can't generate one myself — I'll need it supplied (e.g. pasted into Settings → Model Manager directly by whoever has an AI Studio account, or handed to me to enter).
Proceeding in the meantime with the startup sequence and static investigation of the two known-shaky areas (routing_probe.rs verdict logic, EXCLUDED_MODEL_FRAGMENTS in live_openai_compat_routing.rs) so I'm ready to move fast once a key is available.
malibio commentedon Aug 21, 2026
Baseline: Frontend 4794 passed (227 test files), Duration 79.23s. Rust baseline requires a warm cargo cache — will run as part of test:all before PR.
malibio commentedon Aug 21, 2026
Correction to my earlier comment: I do have a self-serve path to an AI Studio key — I misread the constraint as 'need a key handed to me' when it's actually 'create one myself, enter it through Settings.' The actual blocker is that key creation needs interactive browser/Google-account access, which I don't have as a CLI agent. I'll flag this to Michael directly rather than block silently.
In the meantime: I'm picking up #2198 first (assistant tool_calls dropped from replayed history), since it directly contaminates any multi-turn agentic test here and per Michael's guidance above should land before the walkthrough. Will return to this issue once that's merged and a key is available.
malibio commentedon Aug 22, 2026
@mstomar125 — OpenRouter is a second option for the free key, if AI Studio proves awkward. Either is fine; the issue only needs a real hosted OpenAI-compatible endpoint reached over the public internet.
Verified against their live API today (2026-08-22): 421 models, 18 with a
:freesuffix, and 17 of those 18 advertisetoolsinsupported_parameters— so tool calling, which is the entire point of this test, is available on the free tier rather than paywalled.A few free ids that list tool support, with their context windows:
z-ai/glm-5.2:freecohere/north-mini-code:freethinkingmachines/inkling:freepoolside/laguna-s-2.1:freenvidia/nemotron-3.5-lightning:freeliquid/lfm-2.5-2.6b:freeRe-check the list at
GET https://openrouter.ai/api/v1/modelsbefore choosing — free-tier availability rotates, andsupported_parametersis the field that tells you whether a given model will accept a tool call at all.Why this may be the better choice than AI Studio here: OpenRouter is a strict OpenAI-compatible implementation, which is precisely the surface this issue exists to exercise. Local Ollama accepts malformed payloads silently — that laxness is why the
tool_callsserialization bug (#2198, fixed in PR #2236) survived unnoticed while every prior measurement ran against it. A strict endpoint fails loudly on a contract violation, which is the signal we want.Being able to swap
modelacross several providers behind one key and onebase_urlis also useful for the routing-probe concern noted above: if one served model comes backrouting_disabledyou can try another without reconfiguring anything, and record the verdict per model.Whichever you pick, record which provider and model you used and why — the result is not portable across endpoints, so the next person needs to know what was actually exercised.
Still applies: create the key yourself, enter it through Settings in the running app, no key in a
.toml,.env, or committed anywhere.mstomar125 commentedon Sep 14, 2026
Moved to Backlog — deprioritized for now, not being worked right now. Still needs a real OpenRouter or Google AI Studio key (account creation isn't something an agent can self-serve) before the end-to-end agentic test can run. Instructions and free model recommendations are already in this thread, ready to go whenever this comes back up.
malibio commentedon Oct 5, 2026
One more case for this pass, from the pinned-chat work (PR #3575): a play's Edit chat opens on a message the system writes, so its first turn sends the model system, assistant, system, user: a conversation whose first non-system message is the assistant's. That shape is verified on the native Gemma 4 E4B template (nlp-engine tests/it/assistant_first_conversation.rs) and has not been tried against an OpenAI-compatible endpoint, where a server strict about role order could reject it. To check: open Edit on a play with an OpenAI-compatible model selected and send the first reply.
[-]Exercise the OpenAI-compatible (BYO-key) agent end-to-end against a free hosted provider, and fix what breaks[/-][+]Three unverified checks on the OpenAI-compatible (BYO-key) path against a hosted provider[/+]malibio commentedon Oct 11, 2026
Trimmed and unassigned. Most of the original scope was overtaken by the hosted-provider runs in #3704 and #3706. Three checks remain and are now the whole issue: the key stays out of logs and dumps, the routing probe's verdict is earned and not a rate-limit artifact, and an assistant-first conversation works on a hosted provider.
malibio commentedon Oct 11, 2026
Closing. Two of the three remaining checks are verified, 2026-10-11:
probe_routing_ok, with the unit testan_engine_error_is_not_a_suppression_verdict). Seen for real on 2026-10-08: the provider answered 429, the probe timed out after 60s, and the daemon logged "routing probe failed to complete; leaving routing enabled for this load".