Skip to content

fix(providers): point Perplexity provider at the Agent API - #13627

Merged
jbg merged 9 commits into
aaif-goose:mainfrom
andrewmadson-pplx:pplx-provider-fix
Dec 2, 2026
Merged

jbg merged 9 commits into
aaif-goose:mainfrom
andrewmadson-pplx:pplx-provider-fix

Conversation

@andrewmadson-pplx

@andrewmadson-pplx andrewmadson-pplx commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #12709

Summary

#12709 asked for the endpoint fix first and the Agent API migration later. Perplexity ended Chat Completions support on 2026-09-27 (https://docs.perplexity.ai/docs/agent-api/migrate-from-sonar/overview), so an endpoint-only fix would point goose at a retired endpoint. This PR does the migration directly: the provider definition and its tests, plus a small parser fix so the stream works.

I work at Perplexity, which operates this API.

Root cause: perplexity.json sets a bare base_url and no base_path (diagnosed by @iilish in #12709). For a bare URL the OpenAI engine derives v1/chat/completions (derive_base_path in crates/oi-kit-providers/src/openai.rs), a path the API no longer serves, so every request returns 404.

Nine commits. The first eight were rebased on 2026-11-19 onto main at bf074d6. main renamed the goose-providers and goose-provider-types crates to oi-kit-providers and oi-kit-provider-types (#13447); the paths below use the new names, and the first seven commits were otherwise unchanged in that rebase (range-diff shows path renames only). All nine commits were rebased again on 2026-11-30 onto main at 09f368c.

  1. fix(providers): accept null content on Responses output items (crates/oi-kit-provider-types/src/formats/openai_responses.rs). The Agent API streams response.output_item.added with "content": null on message items where OpenAI sends []. goose's parser rejected the whole stream with invalid type: null, expected a sequence. A null content now deserializes as an empty list on both output item shapes. The new test output_item_added_accepts_null_content parses the event as captured from the live API; it fails on main.

  2. fix(providers): point Perplexity provider at the Agent API.

    • crates/oi-kit-providers/src/declarative/definitions/perplexity.json
      • base_path: "v1/responses". The OpenAI engine already routes any base path containing responses through its Responses API code (should_use_responses_api in openai.rs), so no engine change is needed. v1/agent would not work here: it does not match that check, so goose would keep sending Chat Completions payloads (the 400 "unknown field messages" seen in Provider Perplexity: Fails with Resource not found (404) #11568).
      • Model list replaced with 23 frontier models from the documented Agent API catalog (vendor-prefixed IDs, anthropic/claude-opus-5-5 first as the provider default). Context limits come from the bundled canonical registry where present and from the model family otherwise. dynamic_models is left unset; /v1/models on this host returns the catalog in OpenAI list shape, so discovery works and the static list is the fallback.
      • Description: "Frontier models via the Perplexity Agent API".
      • model_doc_link now points at https://docs.perplexity.ai/docs/agent-api/models.
      • supports_streaming stays on. The parser fix in the first commit is what makes that work.
    • crates/oi-kit-providers/src/openai.rs: two tests. perplexity_requests_agent_api_responses_endpoint asserts the built provider targets https://api.perplexity.ai/v1/responses, selects the Responses API for an Agent API model id, and builds an input payload with no messages field. perplexity_lists_agent_api_model_ids asserts the list is vendor-prefixed with anthropic/claude-opus-5-5 first. Both fail on main.
  3. fix(providers): set Perplexity catalog id for vision resolution. Sets catalog_provider_id: "perplexity-agent" in perplexity.json. normalize_model_config passes it to with_provider_vision_support (provider_registry.rs:83-85), the only path that resolves supports_vision for catalog rows such as perplexity/kimi-k3; the lookup under the provider name perplexity cannot reach that row and name inference has no Kimi branch, so without the key the Responses formatter emits [image omitted: model does not support vision] for it. Adds bundled_perplexity_resolves_vision_from_catalog in crates/goose/src/config/declarative_providers.rs, which registers the bundled definition and checks that the key is present, perplexity/kimi-k3 resolves supports_vision: true, and perplexity/glm-5.3 resolves false. Without the key the test fails at its first assertion (the key check); with that assertion removed, it fails at perplexity/kimi-k3 with left: None, right: Some(true).

  4. fix(providers): send thinking effort for Perplexity Agent API models (crates/oi-kit-providers/src/openai.rs). ACP offers Off, Low, Medium, High, and Max for the default anthropic/claude-opus-5-5, but the selected effort never reached the request. create_responses_request_for_model (openai_responses.rs:781-798) only reads thinking_effort when ModelConfig::openai_reasoning_for_model (model.rs:326-337) is true, which returns false for every non-OpenAI model in perplexity.json, and lines 933-937 strip thinking_effort as an internal param; openai/* entries used OpenAI catalog clamping (openai/gpt-5.5 sent "none" for Off and "xhigh" for Max). The Agent API accepts reasoning.effort (minimal, low, medium, high, xhigh, max) for every model it serves and rejects "off" with 400. stream_for_model now maps Off/Low/Medium/High/Max to minimal/low/medium/high/max for the perplexity provider unless request_params already sets reasoning or reasoning_effort, and omits reasoning when no thinking effort is configured. Other Responses API providers are unchanged. Adds payload tests in crates/oi-kit-providers/src/openai.rs covering the mapping, omission when unset, explicit param precedence, and provider scoping.

  5. fix(providers): resolve reasoning capability from the provider catalog. ACP builds the thinking effort choices from the session ModelConfig, which apply_canonical_limits("perplexity", ...) fills from the canonical table under the provider name, so the bundled Nemotron model resolved reasoning: None and ACP offered only Off (Codex finding). This commit filled model.reasoning from the declarative provider's catalog_provider_id row in crates/goose/src/model_config.rs and added test_build_config_options_resolves_reasoning_from_provider_catalog in crates/goose/src/acp/response_builder.rs, which drives model_config_from_user_config and build_config_options and fails on the previous head (off instead of high). The model_config.rs part is reverted by the next commit; the test stays.

  6. fix(providers): keep catalog reasoning out of the OpenAI request shape. Two Codex findings on the previous commit: setting model.reasoning = Some(true) made ModelConfig::openai_reasoning_for_model classify Nemotron, Kimi and renamed custom providers with non-inferable ids as OpenAI reasoning models, so the Responses and Chat Completions formatters dropped GOOSE_TEMPERATURE and applied the o-series shape (summary: auto, reasoning.encrypted_content, developer role); and ACP still name-matched perplexity/kimi-k3 and perplexity/glm-5.3* as native always-on models, advertising only low/high/max while the request mapper sends minimal and medium. The catalog lookup moves out of model_config.rs (now unchanged from main) into crates/goose/src/acp/response_builder.rs: build_thinking_effort_choices takes the provider selection, resolves reasoning from an explicit model_config.reasoning, then the catalog_provider_id row, then the model-name check, and skips the native Kimi/GLM clamp when OpenAiProvider::maps_all_responses_thinking_efforts(provider) is true. That predicate (crates/oi-kit-providers/src/openai.rs) is the one the request mapper already uses, so the menu and the wire stay in step; native Kimi/GLM providers keep low/high/max. Tests: bundled_perplexity_keeps_temperature_for_catalog_reasoning_models (crates/goose/src/config/declarative_providers.rs, bundled definition against a mock server, asserts temperature kept and reasoning == {"effort": "max"} with no include), catalog_reasoning_keeps_openai_request_shape_for_renamed_provider (crates/goose/tests/catalog_reasoning_registry.rs, custom provider with catalog_provider_id: fireworks-ai on both chat/completions and responses), test_build_config_options_offers_every_effort_the_provider_maps (four cases: kimi-k3 off and medium, glm-5.3 off, glm-5.3-flash medium) and test_build_config_options_prefers_explicit_reasoning_over_provider_catalog. The first three fail on the previous commit.

  7. fix(acp): consult the catalog for reasoning only where effort is sent (crates/goose/src/acp/response_builder.rs). Codex finding on the previous commit: the catalog fallback also fired for renamed custom providers (for example catalog_provider_id: fireworks-ai with a DeepSeek model), offering five efforts that the request never carries. The catalog lookup now runs only when OpenAiProvider::maps_all_responses_thinking_efforts(provider) is true, so every other provider behaves as on main. test_build_config_options_ignores_catalog_reasoning_the_provider_does_not_send creates such a custom provider and asserts the menu offers only off; it fails on the previous commit (high, five options).

  8. fix(providers): take the output limit from the declared catalog identity (crates/oi-kit-provider-types/src/model.rs, crates/goose/src/model_config.rs). Codex finding: perplexity.json declares no max_tokens, and apply_canonical_limits resolved it by provider name, so perplexity/deepseek-v4-pro-0813 inherited 393216 from the native DeepSeek row instead of 384000 from the perplexity-agent row; google/gemini-4-argon (32768 instead of 65536) and perplexity/nemotron-3.5-super-120b-a12b (none instead of 131072) were affected the same way. New ModelConfig::with_canonical_output_limit sets only max_tokens, never reasoning, and apply_canonical_limits applies it with catalog_provider_id before the existing provider-name lookup. declared_catalog_identity_sets_output_limit_without_reasoning fails on the previous commit (393216 and None) and also fails if the catalog row is applied through with_canonical_limits, which would reintroduce the temperature regression from the sixth commit.

  9. fix(providers): add selected effort and keep other reasoning fields (crates/oi-kit-providers/src/openai.rs). Codex found two problems at d695cf7 in code from the fourth commit. First, the mapper did not add the thinking effort when request_params set a reasoning object with no effort, for example {"summary": "detailed"}. Second, the mapper could add the selected effort even if the model config set reasoning: false. insert_responses_reasoning_effort adds nothing if request_params has a string reasoning_effort or a nested reasoning.effort field. It also adds nothing if the model config sets reasoning: false. Without these overrides, it adds the selected thinking effort and keeps the other reasoning fields. No bundled model has reasoning: false by default. The default requests for the bundled models do not change. With the previous implementation, the three new tests fail.

Saved configs that name a model from the old list will need a new model. Pick a model id from perplexity.json or https://docs.perplexity.ai/docs/agent-api/models.

Testing

The checks through the seventh commit ran on 2026-11-17 and 2026-11-18 with main at b83cb47. The initial gate and live items below ran on the head with the first two commits.

  • cargo fmt --all -- --check: passed.

  • cargo test -p goose-provider-types --lib openai_responses: 73 passed, 0 failed, including output_item_added_accepts_null_content. With the test added to main's openai_responses.rs, it fails.

  • cargo test -p goose-providers --lib: 309 passed, 0 failed (includes all_bundled_providers_are_valid and the two new tests). With main's perplexity.json restored, the two new tests fail.

  • cargo clippy -p goose-provider-types -p goose-providers --all-targets -- -D warnings: passed.

  • cargo build -p goose-cli: passed (goose 1.60.0).

  • Live goose sessions on that binary, bundled perplexity definition, empty config dir, real key, goose run -t "Run the shell command: echo agent-api-ok. Then reply with only the command output." --no-session --max-turns 5:

    • GOOSE_MODEL=anthropic/claude-opus-5-5, streaming: tool call, text reply, exit 0. Debug request logs show "stream": true and an input payload on all three requests, no 404, no parse errors.
    • GOOSE_MODEL=openai/gpt-5.6-luna, streaming: same result.
    • Non-streaming: a copy of the bundled definition installed as a custom provider with supports_streaming: false, anthropic/claude-opus-5-5: tool call, text reply, exit 0, logs show "stream": false.
    • GOOSE_MODEL unset: exit 1 with "No model configured. Run 'goose configure' first.", which is goose's normal behavior for a provider with no saved model.
  • Third commit, all three commits in the tree: cargo fmt --all -- --check passed; cargo test -p goose --lib bundled_perplexity_resolves_vision_from_catalog passed and the config::declarative_providers module is 22 passed; the goose-provider-types and goose-providers selections above passed again (73 and 309); cargo clippy -p goose-provider-types -p goose-providers -p goose --all-targets -- -D warnings passed. Base proof: with the key removed from perplexity.json and the test's key assertion removed so the model assertion is reached, the test fails at perplexity/kimi-k3 with left: None, right: Some(true).

  • Fourth commit, all four commits in the tree (2026-11-18): cargo fmt --all -- --check passed; cargo test -p goose-providers --lib passed (314 passed, 0 failed, up from 309 at 53a80647); cargo clippy -p goose-providers --all-targets -- -D warnings passed; cargo build -p goose-cli passed. Removing the insert_responses_reasoning_effort call in stream_for_model fails the two mapping tests (Claude and Kimi payloads have no reasoning; openai/gpt-5.5 gets "none" for Off and "xhigh" for Max), forcing the provider guard false fails the scoping test, removing either the "reasoning" or "reasoning_effort" check fails the explicit-param test, and defaulting an unset effort to Medium fails the omission test. A full live goose run with a real key did not run on the build machine (no live key there); instead, running the built goose binary on the bundled perplexity provider with an empty config dir, GOOSE_MODEL=anthropic/claude-opus-5-5, GOOSE_THINKING_EFFORT=high, and an invalid key (401) captured the two request bodies goose logged before exit: the main turn with "reasoning": {"effort": "high"} and the auxiliary title request (ThinkingEffort::Off) with "reasoning": {"effort": "minimal"}. Replaying both logged request bodies verbatim against https://api.perplexity.ai/v1/responses with a real key returned HTTP 200 and status: "completed" on both, echoed reasoning.effort as "high" and "minimal", and returned a shell function_call on the main turn and the generated title on the second.

  • Fifth commit, all five commits in the tree (2026-11-18): cargo fmt --check passed; cargo clippy --locked --workspace --all-targets -- -D warnings passed; cargo test --locked --no-fail-fast -p goose -p goose-providers -p goose-provider-types: goose-providers 685 passed, goose-provider-types 314 passed, goose 2261 passed with 5 failures that fail the same way on the previous head without this change (shell PATH, GCP token refresh without egress, two extension mutation tests, and the Codex and Claude Code CLI provider tests). Removing the catalog lookup, using the provider name instead of catalog_provider_id, or forcing reasoning to false fails the new test. Live runs through the goose CLI built at dd14d7a, bundled perplexity definition, empty config dir, real key, goose run --no-session --max-turns 5 with a shell tool call: anthropic/claude-opus-5-5 with GOOSE_THINKING_EFFORT=high and perplexity/nemotron-3.5-super-120b-a12b with max. Both exited 0, executed the shell tool, and returned streamed text and usage; the logged requests carry stream: true and reasoning.effort high and max on the main turns and minimal on the auxiliary title request, with model_config.reasoning: true for Nemotron.

  • Sixth commit, all six commits in the tree (2026-11-18): cargo fmt --check passed; cargo clippy --locked --workspace --all-targets -- -D warnings passed; cargo test --locked --no-fail-fast -p goose -p goose-providers -p goose-provider-types: goose-providers 685 passed, goose-provider-types 314 passed, goose 2269 passed plus the new integration test, with the same pre-existing failures as above. Restoring the model_config.rs change fails the two temperature tests; making the clamp ignore the provider fails all four menu cases; forcing the predicate true breaks the databricks_v2 always-on test and the scoping test; ignoring an explicit reasoning fails the override test. Live runs through the goose CLI built at cdcd0a2, bundled perplexity definition, empty config dir, real key, same shell-tool prompt: perplexity/nemotron-3.5-super-120b-a12b with GOOSE_TEMPERATURE=0.3 and GOOSE_THINKING_EFFORT=max logs temperature: 0.3 and reasoning: {"effort": "max"} with no summary or include (the previous head logged summary: auto); perplexity/kimi-k3 with medium logs reasoning: {"effort": "medium"}. Both exited 0 with a shell tool call and a streamed reply.

  • Seventh commit, all seven commits in the tree (2026-11-18): cargo fmt --check passed; cargo clippy --workspace --all-targets -- -D warnings passed; cargo test -p goose: 2270 passed with the same pre-existing failures as above. Removing the gate fails the new test; forcing it on fails test_build_config_options_resolves_reasoning_from_provider_catalog. The change is menu-only; the request path is unchanged from the sixth commit.

  • Eighth commit, all eight commits rebased onto main at bf074d6 (2026-11-19): cargo fmt --check passed; cargo clippy --workspace --all-targets -- -D warnings passed; cargo test --locked --no-fail-fast -p goose -p oi-kit-providers -p oi-kit-provider-types: oi-kit-providers 689 passed, oi-kit-provider-types 314 passed, goose 2189 passed with the same pre-existing failures as above. Removing the catalog call fails both test cases; applying the catalog row through with_canonical_limits fails on reasoning; applying it after the provider-name lookup fails on 393216. Live runs through the goose CLI built at d695cf7, bundled perplexity definition, empty config dir, real key, goose run --no-session --max-turns 5: perplexity/deepseek-v4-pro-0813 at high logs max_output_tokens: 384000 (the previous head logged 393216); perplexity/nemotron-3.5-super-120b-a12b at high with GOOSE_TEMPERATURE=0.3 logs max_output_tokens: 131072, temperature: 0.3 and reasoning.effort: high; google/gemini-4-argon at low logs max_output_tokens: 65536. All exited 0 with a reply.

  • Ninth commit, at e9679e7 (2026-11-25): cargo fmt --all -- --check and cargo clippy --workspace --all-targets -- -D warnings gave exit code 0. cargo test --locked --no-fail-fast -p goose -p oi-kit-providers -p oi-kit-provider-types: 3454 passed and 5 failed. The same 5 tests fail on the previous commit: GCP token refresh, two extension mutation tests, and the Codex and Claude Code CLI provider tests. The removal of each new guard condition causes a test failure.

    • The live runs used the goose CLI from this commit. The runs used the bundled perplexity definition, an empty config dir, and a real key. The prompt was the same shell-tool prompt. The models and effort values were anthropic/claude-opus-5-5 at high, perplexity/nemotron-3.5-super-120b-a12b at max with GOOSE_TEMPERATURE=0.3, perplexity/kimi-k3 at medium, and perplexity/deepseek-v4-pro-0813 at high. Each run made a shell tool call and streamed a reply. Each exit code was 0. The request logs show stream: true and the selected reasoning.effort. The DeepSeek request log shows max_output_tokens: 384000.
    • The two resumed sessions used edited model configs with thinking effort high. The first config set request_params.reasoning to {"summary": "detailed"}. Its request log shows reasoning: {"summary": "detailed", "effort": "high"}. The Nemotron config set reasoning: false. Its request log contains no reasoning field.
    • With goose acp, session/new shows off, low, medium, high, and max for Nemotron and Kimi. session/set_config_option gives the selected value in the response and in the config_option_update notification. A session/prompt after that gives a reply, and the request log shows the selected effort.
  • Rebase onto main at 09f368c (2026-11-30), new head a3294c6: the branch conflicted with fix(providers): send Z.AI thinking levels instead of token budgets #13805 in crates/goose/src/acp/response_builder.rs. Both branches changed the ACP effort menu functions. The sixth commit has the resolution. It keeps the function signatures and Z.AI catalog lookup from main. For reasoning models, the perplexity menu uses all five values that its request mapper accepts. Other providers keep the ACP effort behavior from main. Both branches also added a test at the same position in the test module of that file. The fifth commit now adds its test after the Z.AI test from fix(providers): send Z.AI thinking levels instead of token budgets #13805, and the test text is the same. The branch also conflicted with feat(providers): add OPENAI_DAYBREAK to send access_programs.cyber #13854 in crates/goose/src/model_config.rs. Each branch added a test module at the end of the file. The eighth commit now adds its module after the module from main. The text of the two modules is the same as before. The diff against 09f368c has the same eight files.

    • The checks ran on the tree of the new head (580299f). cargo fmt --all -- --check and cargo clippy --workspace --all-targets -- -D warnings gave exit code 0. cargo test --locked --no-fail-fast -p goose -p oi-kit-providers -p oi-kit-provider-types: 3531 passed and 5 failed. On main at 09f368c, 3508 passed and the same 5 tests failed. The fix(providers): send Z.AI thinking levels instead of token budgets #13805 tests passed: the 6 tests in zai_thinking_effort and the 3 cases of test_build_config_options_offers_catalog_effort_levels_for_zai. The 7 tests in daybreak_tests from feat(providers): add OPENAI_DAYBREAK to send access_programs.cyber #13854 passed.
    • The live runs used a goose CLI built from tree 580299f. The four shell-tool runs used the same setup, models, and prompt as the corresponding runs for the ninth commit. Each of the four CLI runs made a shell tool call, streamed a reply, and gave exit code 0. The main-turn requests show the selected reasoning.effort. The session-name requests show minimal, which is the value that the provider sends for off. The DeepSeek requests show max_output_tokens: 384000.
    • The three resumed sessions gave exit code 0. The first two used the same edited model configs as the resumed sessions for the ninth commit. The request log of the first session shows reasoning: {"summary": "detailed", "effort": "high"}. The request log of the Nemotron session contains no reasoning field. The third config set request_params.reasoning to {"effort": "low"}. Its request log shows reasoning: {"effort": "low"}.
    • With goose acp, session/new shows off, low, medium, high, and max for Nemotron, Kimi, and perplexity/glm-5.3. session/set_config_option gives the selected value in the response and in the config_option_update notification. A session/prompt after that gives a reply. The request logs show reasoning.effort: max for Nemotron and reasoning.effort: medium for Kimi and GLM.

Related Issues

#11568 (same 404; also records a custom provider attempt against v1/agent that returned 400 "unknown field messages").
Discussion: #12709

@andrewmadson-pplx
andrewmadson-pplx requested a review from a team as a code owner November 17, 2026 20:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T22:54:33.067501Z a3294c6 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@andrewmadson-pplx
andrewmadson-pplx marked this pull request as draft November 17, 2026 20:49
@andrewmadson-pplx andrewmadson-pplx changed the title fix(providers): point Perplexity at the documented /v1/sonar endpoint fix(providers): point Perplexity provider at the Agent API Nov 17, 2026
@andrewmadson-pplx
andrewmadson-pplx marked this pull request as ready for review November 17, 2026 22:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38b6676dd6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53a80647d1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee03f26fbc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@jbg jbg left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Confirming that #12709 can cover the Agent API migration. The documented /v1/responses alias, model catalog change, and shared null-content parser fix fit that scope. The endpoint and parser regressions are covered, and Rust CI passed.

Please address the Nemotron thinking-effort finding before merge. ACP shows only Off for the newly bundled reasoning model and can display Off even when Goose sends an inherited higher effort. Resolve its reasoning capability from the Agent API catalog and verify that ACP exposes and reports the selected effort.

Please also confirm one authenticated end-to-end streaming run on the updated PR head. The reported authenticated Goose streams were on the first two commits. The current head had authenticated request replay, and the live-provider CI jobs were skipped.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd14d7a600

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread crates/goose/src/model_config.rs Resolved
Comment thread crates/oi-kit-providers/src/openai.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cdcd0a2e8a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39ec9b05e4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

{ "name": "openai/gpt-5.6-sol", "context_limit": 1050000 },
{ "name": "openai/gpt-5.6-terra", "context_limit": 1050000 },
{ "name": "openai/gpt-5.6-luna", "context_limit": 1050000 },
{ "name": "openai/gpt-5.5", "context_limit": 1050000 },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve supported temperatures for Agent API OpenAI models

With GOOSE_TEMPERATURE configured and this new Perplexity model selected, create_responses_request_for_model() silently drops the setting because openai_reasoning_for_model() returns true and temperature is only emitted for non-OpenAI-reasoning models. The bundled perplexity-agent/openai/gpt-5.5 row explicitly declares temperature: true, so a supported sampling setting never reaches the Agent API. Unlike the fixed Nemotron case, this model takes the genuine OpenAI branch, which the added Nemotron payload test does not cover. Apply the Agent catalog's temperature capability separately from the OpenAI reasoning classification.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This rule was in the code before this PR. The shared OpenAI Responses formatter does not read the temperature flag in the catalog. For gpt-5.5, the formatter does not send the value of GOOSE_TEMPERATURE on the native openai provider or on perplexity. It does send an explicit request_params.temperature. A change to that rule for OpenAI reasoning models is not part of the move of the bundled perplexity definition to the Agent API.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d695cf7cdc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread crates/oi-kit-providers/src/openai.rs Resolved
Comment thread crates/oi-kit-providers/src/openai.rs Resolved
@andrewmadson-pplx

Copy link
Copy Markdown
Contributor Author

@jbg, here are the results for the two checks. The PR head is e9679e7.

  1. ACP menu, with goose acp and perplexity/nemotron-3.5-super-120b-a12b:
    • session/new shows these thinking_effort values: off, low, medium, high, max.
    • session/set_config_option with max gives currentValue: "max" in the response and in the config_option_update notification.
    • A session/prompt after that gives a reply. The request log shows reasoning.effort: max.
    • ACP uses catalog_provider_id to find the catalog row for Nemotron. It reads the reasoning flag from that row. The code has no name check that is only for Nemotron.
  2. Live runs with streaming. The runs used the goose CLI from e9679e7. Each run made a shell tool call and streamed a reply. Each exit code was 0.
    • anthropic/claude-opus-5-5 at high.
    • perplexity/nemotron-3.5-super-120b-a12b at max with GOOSE_TEMPERATURE=0.3. The request has reasoning.effort: max and keeps temperature.
    • perplexity/kimi-k3 at medium.

The eight Codex review threads from November 17 and 18 have replies. Codex found two more problems at d695cf7: effort with a reasoning summary and an explicit non-reasoning override. Commit e9679e7 corrects the two problems. The only production change is in insert_responses_reasoning_effort. With the default configuration, the requests for the bundled models are the same as at d695cf7.

The branch is on top of main after the oi-kit crate rename (#13447).

@jbg jbg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the live streaming and ACP checks. The temperature rule is already in the shared Responses formatter, so I’d treat catalog-aware temperature handling as a follow-up. Could you rebase pplx-provider-fix onto main and rerun the authenticated streaming and ACP checks on the updated head?

Some Responses API backends send "content": null on message items in
response.output_item.added, where OpenAI sends an empty array. The
stream parser rejected the whole stream with "invalid type: null,
expected a sequence".

Deserialize a null content field as an empty list on both output item
shapes. Add a test that parses a captured event.
The bundled Perplexity definition has a bare base_url, so the OpenAI
engine derives v1/chat/completions and every request returns 404.
Perplexity's Chat Completions surface is retired; the supported
surface is the Agent API, which speaks the OpenAI Responses API at
/v1/responses.

Set base_path to v1/responses. The engine already routes a responses
base path through its Responses API code, so no engine change is
needed. Replace the model list with the documented Agent API catalog
(vendor-prefixed IDs; anthropic/claude-opus-5-5 first as the default)
and point model_doc_link at the Agent API models page. Context limits
come from the bundled canonical registry where present, otherwise from
the model family.

Streaming stays on. The Agent API sends "content": null on
response.output_item.added where OpenAI sends []; the parser accepts
that since the previous commit.

Saved configs that name a retired model need to pick a model from the
new list.

Add regression tests for the request URL, the Responses payload shape,
and the model list.
Set catalog_provider_id "perplexity-agent" on the bundled Perplexity
definition. ProviderEntry::normalize_model_config passes it to
with_provider_vision_support (provider_registry.rs:83-85), which is the
only path that resolves supports_vision for catalog rows such as
perplexity/kimi-k3. The lookup under the provider name "perplexity"
cannot reach that row and name inference has no Kimi branch, so without
the key the Responses formatter drops images with "[image omitted:
model does not support vision]".

Add a test that registers the bundled definition and checks that
perplexity/kimi-k3 resolves supports_vision true and perplexity/glm-5.3
resolves false.
The bundled Perplexity provider targets the Agent API (/v1/responses)
with anthropic/claude-opus-5-5 as the default model. ACP advertises Off,
Low, Medium, High, and Max for that model, but the selected effort never
reached the request.

create_responses_request_for_model
(crates/goose-provider-types/src/formats/openai_responses.rs) only sets
reasoning.effort when ModelConfig::openai_reasoning_for_model returns
true, which is false for every non-OpenAI model in perplexity.json, and
then strips thinking_effort as an internal param. Claude, Gemini, Grok,
and perplexity/* models went out with no reasoning field, while openai/*
models used OpenAI catalog clamping (for example openai/gpt-5.5 sent
"none" for Off and "xhigh" for Max).

The Agent API accepts reasoning.effort for every model it serves with
levels minimal, low, medium, high, xhigh, and max, and rejects "off"
with 400. In crates/goose-providers/src/openai.rs, map Off, Low, Medium,
High, and Max to minimal, low, medium, high, and max for the perplexity
provider in stream_for_model unless request_params already sets
reasoning or reasoning_effort, and omit reasoning when no thinking
effort is configured. Other Responses API providers are unchanged. Add
unit tests covering the effort mapping, omission when unset, explicit
param precedence, and provider scoping.
Session configs feed the ACP thinking selector without provider
normalization, so a bundled Perplexity model whose catalog row declares
reasoning, such as Nemotron, showed only off and reported off even when
an inherited effort was sent. Resolve reasoning from the declarative
provider's catalog row during materialization.
Writing the catalog row's reasoning flag onto the session model config
made openai_reasoning_for_model() treat Perplexity Nemotron and Kimi, and
renamed custom providers with a catalog_provider_id, as OpenAI reasoning
models. Responses and Chat Completions then dropped GOOSE_TEMPERATURE and
applied the o-series request changes.

Resolve catalog reasoning in the ACP thinking selector instead, keyed by
the session provider, so the model config stays as it was before.

The selector also clamped perplexity/kimi-k3 and perplexity/glm-5.3* to
low, high and max by model name, while the Agent API mapping sends
minimal and medium. OpenAiProvider::maps_all_responses_thinking_efforts
now backs both the request mapping and the selector, so Perplexity
offers every effort and reports off and medium as set. Native Kimi and
GLM providers keep their three levels.
The provider catalog fallback in is_reasoning_model_for_provider marked a
catalog reasoning model as reasoning for any provider. A renamed custom
provider with catalog_provider_id fireworks-ai was then offered every
thinking effort, but the request mapper sends none of them for that
provider, so the menu changed nothing.

The catalog lookup now runs only for providers that map every effort
(maps_all_responses_thinking_efforts). Every other provider resolves
reasoning as on main: explicit reasoning, then is_reasoning_model().
Bundled perplexity declares catalog_provider_id perplexity-agent but no
max_tokens, and the canonical lookup by provider name has no perplexity
mapping, so it fell back to another service's row:
perplexity/deepseek-v4-pro-0813 got 393216 output tokens instead of the
perplexity-agent 384000, and perplexity/nemotron-3.5-super-120b-a12b got
no limit instead of 131072.

apply_canonical_limits now reads the declared catalog_provider_id and
applies that row's output limit before the provider name lookup. The new
ModelConfig::with_canonical_output_limit sets only max_tokens, so the
catalog row cannot set reasoning and switch the OpenAI request into its
reasoning-model shape.
For perplexity, the previous mapper did not add the selected effort if
request_params contained reasoning or reasoning_effort.

The mapper adds effort only for the perplexity provider. It does not
add an effort if the model configuration sets reasoning to false. It
also keeps explicit request settings: a string in reasoning_effort or a
field named effort in the reasoning object.

Without these overrides, the mapper adds the selected thinking effort
and keeps the other reasoning fields. Without a selected thinking
effort, the mapper adds nothing.

The default requests for the bundled models do not change.
@andrewmadson-pplx

Copy link
Copy Markdown
Contributor Author

@jbg, the branch is rebased on main at 09f368c. The new head is a3294c6. The branch conflicted with #13805 in crates/goose/src/acp/response_builder.rs. The fifth commit now adds its test after the Z.AI test from #13805, and the test text is the same. The sixth commit resolves the conflict in the ACP effort menu functions. The eighth commit now adds its test module after the daybreak_tests module from #13854 in crates/goose/src/model_config.rs. The PR description gives the details and the test results.

The authenticated checks ran again on a goose CLI built from the new head:

  • Streaming: anthropic/claude-opus-5-5 at high, perplexity/nemotron-3.5-super-120b-a12b at max with GOOSE_TEMPERATURE=0.3, perplexity/kimi-k3 at medium, and perplexity/deepseek-v4-pro-0813 at high. Each run made a shell tool call and streamed a reply. Each exit code was 0.
  • ACP: session/new shows off, low, medium, high, and max for Nemotron, Kimi, and perplexity/glm-5.3. session/set_config_option gives the selected value in the response and in the config_option_update notification. A session/prompt after that gives a reply, and the request log shows the selected effort.

Agreed on temperature: catalog-aware handling stays out of this PR.

@jbg jbg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The rebased revision addresses the ACP reasoning-effort finding. Thanks for rerunning authenticated streaming and checking the selected effort in the request log on this head. Catalog-aware temperature handling can follow separately.

@jbg
jbg added this pull request to the merge queue Dec 2, 2026
Merged via the queue into aaif-goose:main with commit 022d2b0 Dec 2, 2026
43 checks passed
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.

Provider Configuration for Perplexity is outdated

2 participants