goose doctor#8342
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b600b48a23
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| log.push(format!("Checking {} / {} ...", pname, mname)); | ||
| match try_create_and_test(pname, mname).await { | ||
| Ok(working) => { | ||
| agent.update_provider(working, session_id).await?; |
There was a problem hiding this comment.
Preserve session mode when doctor verifies provider
ensure_working_provider recreates the provider and immediately calls agent.update_provider(...) even when the current provider/model already passed the health check. Replacing the live provider instance drops provider-local session state; for stateful providers (for example, Codex tracks per-session mode internally), this can silently revert a non-default approval mode right after /doctor. Keep using the existing provider on successful checks, or reapply the session mode after swapping.
Useful? React with 👍 / 👎.
| if let Ok(content) = std::fs::read_to_string(&path) { | ||
| prompt.push_str(&format!("\nLast LLM request log:\n```\n{}\n```\n", content)); |
There was a problem hiding this comment.
Truncate LLM request logs before adding them to /doctor prompt
run reads llm_request.0.jsonl with read_to_string and injects the entire file into the prompt. That file contains full request/response payloads and can be very large, so /doctor may exceed model context limits or generate unexpectedly high token usage before diagnostics even begin. Use a bounded tail/size cap (as done for server logs) before appending this content.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1aeb131de8
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| use crate::session::SessionBuilderConfig; | ||
|
|
||
| pub async fn handle_doctor() -> Result<()> { | ||
| let mut session = build_session(SessionBuilderConfig { |
There was a problem hiding this comment.
Let goose doctor run without preconfigured provider/model
handle_doctor builds a full session before sending /doctor, but build_session aborts in resolve_provider_and_model when GOOSE_PROVIDER or GOOSE_MODEL is missing (see crates/goose-cli/src/session/builder.rs around lines 363-376). That means goose doctor exits before the new doctor logic can diagnose or recover the exact setup failures users are likely invoking it for, so the command is ineffective for broken or incomplete configs.
Useful? React with 👍 / 👎.
| let provider_name = config.get_goose_provider().ok(); | ||
| let model_name = config.get_goose_model().ok(); |
There was a problem hiding this comment.
Check the active session provider, not global config
ensure_working_provider reads provider/model only from Config::global(), so /doctor ignores the provider currently loaded in the session (for example when the user started Goose with --provider/--model overrides). In that case a healthy session can be misdiagnosed as broken, and doctor may switch the session/config to a different provider unnecessarily, which is a behavior regression tied to override-based workflows.
Useful? React with 👍 / 👎.
Summary
Introduce /doctor or goose doctor