Skip to content

fix(server): tell multi-repo agents which repos are in the project - #313

Open
dotrahat wants to merge 1 commit into
LoganRupe:multi-repo-workspacesfrom
dotrahat:fix/multi-repo-list-repo-roots
Open

dotrahat wants to merge 1 commit into
LoganRupe:multi-repo-workspacesfrom
dotrahat:fix/multi-repo-list-repo-roots

Conversation

@dotrahat

@dotrahat dotrahat commented Sep 26, 2026 •

Copy link
Copy Markdown

In a multi-repo project, the agent often isn't told which repos are in the project, so it searches the workspace folder for them. Details are in #309.

Fix

This is option A from #309. The runtime instructions now list the project's repos. In an isolated worktree run, they list the worktrees. The list is added in the same sessions that get #307's path block. For a project whose .code-workspace is in the home folder, the model sees:

<project_repositories>
This project's repositories are:
- /home/<user>/<repo-1>
- /home/<user>/<repo-2>
- /home/<user>/Downloads/<repo-3>
- /home/<user>/<repo-4>
- /home/<user>/<repo-5>
The working directory, /home/<user>, is the project's workspace folder, not a repository. Other repositories under it are not part of this project, so there is no need to search it for more.
</project_repositories>

The last sentence is left out when the working directory is one of the repos. To tell these cases apart, multi-repo sessions now also receive the full repo list, in a new optional repoRoots field on ProviderSessionStartInput.

Codex gets the same block through additionalContext. Codex caps each entry at 1,000 tokens, which it counts as 4 bytes per token. In the #309 project, the entry Codex received was 3,086 bytes.

Testing

  • Unit tests pass, including a new reactor test for worktree runs. The full suite passes too, except for 24 git tests. Those fail the same way on multi-repo-workspaces without this change.
  • I asked "Give me list of repos that are part of this project" in the Multi-repo sessions don't tell the agent which repos are in the project when the repos are inside the workspace root #309 project. Claude Opus 5.5, Codex (GPT-6 Luna) and Gemini 3.8 Flash (Antigravity) each listed the five repos without using any tools. I didn't test Cursor, Grok or OpenCode.
  • In a new-worktree run of a two-repo project, Claude, Codex and Gemini each listed the two worktrees without using any tools. The logs for Claude and Codex show the "workspace folder" sentence was left out. Antigravity doesn't log the prompt.
  • I also tried a project with a non-git docs/ folder listed in its .code-workspace. Asked whether docs is part of the project, Claude checked the workspace file and said docs is in the workspace but isn't a repo.

Fixes #309

Model: Claude Opus 5.5, harness: Claude Code.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L labels Sep 26, 2026
@LoganRupe

Copy link
Copy Markdown
Owner

Thanks for picking this up so quickly, and for testing it across providers. The Codex write-up is a good catch too. I wouldn't have spotted that newer models were skipping our instructions on this branch.

I checked out the branch: the tests pass and the server typecheck is clean. Two things before I merge:

  1. Non-git folders. WorkspaceFile.ts only keeps folders that have a .git in repoRoots. So if a .code-workspace lists a plain folder like docs/, the last sentence tells the model it isn't part of the project. "Folders under it that are not listed above" can also read as covering api/src inside a listed repo. Could you narrow it to something like "Other repositories under it are not part of this project, so there is no need to search it for more"?

  2. Codex. Rather than leave the merge steps in the PR body, I'm rebasing multi-repo-workspaces onto main now, so fix(server): newer Codex models get T3 Code's instructions again pingdotgg/t3code#13547 will be on the branch. Once that's pushed, could you rebase onto it and make the two Codex changes you described (multiRepo into buildCodexAdditionalContext, and the test reading additionalContext.t3_code_runtime.value)? That way the PR carries its own fix, and a test catches it if Codex ever loses the block.

I'll comment here once the branch is updated.

@LoganRupe
LoganRupe force-pushed the multi-repo-workspaces branch from 44b00df to 3f17cf7 Compare September 26, 2026 20:40
@LoganRupe

Copy link
Copy Markdown
Owner

multi-repo-workspaces is now rebased onto main, so pingdotgg#13547 is on the branch. This PR will need a rebase onto it, and GitHub shows it as conflicting until then.

One change from what I asked earlier: I had to resolve the #307 commit against pingdotgg#13547 during the rebase. Both Codex changes you described are already on the branch. multiRepo goes into buildCodexAdditionalContext, and the multi-repo test reads additionalContext.t3_code_runtime.value. So for Codex you only need to carry your MultiRepoWorkspace type through that call instead of the boolean. The narrower "not part of the project" wording is still the one open item.

When a project's repos sit inside its workspace folder, Claude Code leaves
them out of the environment block it shows the model, and Cursor, Grok,
OpenCode and Antigravity get no repo list at all. The model then treats the
workspace folder as the project and searches it for repos.

The multi-repo instructions now list every repo root, and say that the
working directory is the workspace folder, not a repo, when it is not one of
the roots. The session start input carries the full root list so adapters
can tell whether the working directory is a repo root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dotrahat
dotrahat force-pushed the fix/multi-repo-list-repo-roots branch from 7d77c68 to ba234a6 Compare September 27, 2026 09:08
@dotrahat

Copy link
Copy Markdown
Author

Thanks, Logan. Both are done in ba234a6:

  1. The sentence now reads: "Other repositories under it are not part of this project, so there is no need to search it for more." It no longer rules out plain folders like docs/.
  2. I rebased onto the updated multi-repo-workspaces. The Codex path now carries the MultiRepoWorkspace through buildCodexAdditionalContext, and the Codex test checks that the repo list reaches additionalContext.t3_code_runtime.value.

I also added a reactor test for worktree runs, fixed a few code comments so they match when the block is added, and updated the PR description to take out the merge steps.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants