Skip to content

[codex] fix: prefer active IntelliJ workspace for relative paths#12090

Open
yzlu0917 wants to merge 4 commits intocontinuedev:mainfrom
yzlu0917:codex/issue-10644-intellij-workspace-bias
Open

[codex] fix: prefer active IntelliJ workspace for relative paths#12090
yzlu0917 wants to merge 4 commits intocontinuedev:mainfrom
yzlu0917:codex/issue-10644-intellij-workspace-bias

Conversation

@yzlu0917
Copy link
Copy Markdown

@yzlu0917 yzlu0917 commented Apr 9, 2026

Summary

  • prefer the active editor's workspace directory when resolving ambiguous relative paths
  • apply the same workspace prioritization to both existing-path lookup and new-file path inference
  • add regression tests covering ambiguous multi-workspace resolution and the no-active-file fallback

Why

In IntelliJ multi-Maven setups, Continue can receive multiple workspace roots for related projects. When the same relative path exists in more than one workspace, the previous behavior effectively fell back to the first workspace root, which could cause ls and create_new_file to operate in a sibling project instead of the one containing the current file.

This change biases relative path resolution toward the workspace that contains the active file, while preserving the existing first-workspace fallback when there is no active file context.

Validation

  • ran npm test -- --runInBand util/ideUtils.test.ts in core
  • ran git diff --check

Closes #10644


Summary by cubic

Prefer the active editor’s workspace when resolving relative paths in IntelliJ multi-workspace projects to keep actions in the current project. Also adds dynamic provider model fetching with a simple UI hook to make model selection easier, and fixes a CLI install banner unmount update.

  • Bug Fixes

    • Prioritize the current file’s workspace in resolveRelativePathInDir and inferResolvedUriFromRelativePath.
    • Fall back to the original first-workspace choice when there’s no active file or getCurrentFile isn’t available.
    • Add regression tests for ambiguous multi-workspace resolution, the no-active-file fallback, and the legacy-stub fallback.
    • GUI: prevent CliInstallBanner state updates after unmount during CLI detection.
  • New Features

    • Add models/fetch core protocol and provider adapters to list models (Ollama, OpenRouter, Anthropic, Gemini, or generic via listModels).
    • Map model capabilities into config/types (tools, image); broaden tool/image support detection (Gemma 4, GPT-5+), and update OpenAI o-series checks.
    • UI: fetch provider models using the entered API key in Add Model; dynamic Ollama/OpenRouter lists; minor ModelSelectionListbox label tweak.
    • Add GPT-5.4 variants and Gemma 4; update docs; include OpenRouter request headers via @continuedev/openai-adapters.

Written for commit 198d7d8. Summary will update on new commits.

@yzlu0917 yzlu0917 requested a review from a team as a code owner April 9, 2026 08:37
@yzlu0917 yzlu0917 requested review from sestinj and removed request for a team April 9, 2026 08:37
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 9, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

setFetchedModelsList((prev) =>
selectedProvider.provider === providerAtFetchTime ? models : prev,
);

P2 Badge Ignore stale model-fetch responses after provider change

The provider check in setFetchedModelsList uses selectedProvider from the same closure as providerAtFetchTime, so it does not protect against in-flight requests completing after the user switches providers. In that flow, a late response for provider A can populate fetchedModelsList while provider B is selected, which surfaces and can save mismatched model IDs under the wrong provider. Use current provider state (or cancel previous requests) when applying async results.


const base = apiBase || "https://generativelanguage.googleapis.com/v1beta/";
const url = new URL("models", base);

P2 Badge Preserve Gemini API version path in models endpoint URL

Building the endpoint with new URL("models", base) drops the final path segment when apiBase lacks a trailing slash. For example, a valid custom base like https://.../v1beta resolves to /models instead of /v1beta/models, so model discovery fails for those configurations. Normalize apiBase to a directory-style URL (trailing slash) before joining models.

ℹ️ 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".

@yzlu0917 yzlu0917 force-pushed the codex/issue-10644-intellij-workspace-bias branch from 2f98da9 to 0d3ffb5 Compare April 9, 2026 11:28
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Agent can't work with Mutli-Maven-project setup in IntelliJ

1 participant