Skip to content

feat(app-conversation): read files, diffs, skills and hooks of every repository in a multi-repository conversation - #1073

Merged
ak684 merged 1 commit into
mainfrom
alona/multi-repo-read-side
Oct 29, 2026
Merged

ak684 merged 1 commit into
mainfrom
alona/multi-repo-read-side

Conversation

@ak684

@ak684 ak684 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Why

A multi-repository conversation (#1046) clones every repository into its own folder, but the read endpoints (/files, /file, /git/changes, /git/diff, /skills, /hooks) only resolved the primary repository's folder, and /files deliberately rejected sibling folders. Canvas could browse, read and diff nothing but the primary.

Summary

  • The conversation's roots are defined once (conversation_roots beside additional_repositories.py): the primary's folder first, then each cloned additional repository's folder; the working folder itself when there is no primary. A failed clone is not a root.
  • The six endpoints take an optional repository query parameter: the folder name from repositories[].folder. Without it they use the first root, as before. A name that is not one of the conversation's cloned repositories is a 404.
  • /files and /file validate and re-anchor paths against the selected root instead of the primary only. /git/changes defaults path to the selected root (the parameter is now optional); /git/diff resolves a relative or stale path under it. Without repository, an explicit git path is still forwarded unchanged.
  • /skills now loads every repository's project skills (the same per-folder scoping as feat(app-conversations): start a conversation with several repositories #1046, so an additional repository's AGENTS.md is agents:<folder>), and repository narrows the list to that repository's project skills.
  • /hooks reads the selected folder's .openhands/hooks.json; the default stays the primary's. Which hooks run is unchanged.

For Canvas

GET /api/v1/app-conversations/{id}/{files|file|git/changes|git/diff|skills|hooks}?repository=<folder>, where <folder> is repositories[].folder from the conversation. Omit it for the primary (or the working folder when the conversation has no primary). /files paths come back relative to the selected folder; /file, /git/changes and /git/diff accept a path relative to it, its absolute path, or the usual /workspace/project/<folder>/... form. 404 means the folder is not one of the conversation's cloned repositories.

Issue Number

FDE-245

How to Test

  • tests/unit/app_server/test_app_conversation_repository_selector.py (25 tests): roots, each endpoint with and without the selector, unknown selector 404, no-primary default, and named single-repository invariants. All 25 fail on main (the parameter does not exist; another repository's folder falls back to the primary) and pass here.
  • tests/unit/app_server: 2,691 passed. Repository pre-commit (ruff, ruff format, mypy) passes.
  • Live, self-hosted (2026-10-29, enterprise-server image of this head merged with fix(app-conversation): keep the started conversation row when the lifecycle webhook read a stub #1075 because that row race hides the repositories these endpoints read): a conversation with a primary and one additional Azure DevOps repository; with repository=<additional folder>, /files listed its tree, /file read its file, /skills narrowed to agents:<folder>, /hooks showed its stop hook, and after the agent appended a line to its README, /git/changes and /git/diff showed the change while the primary reported none; without the selector every response stayed the primary's; an unknown folder was 404. A single-repository conversation gave identical responses with and without the selector. On main without this change the same probes showed the primary's tree, an empty file, 422 for /git/changes without a path and 200 for the unknown folder.

Video/Screenshots

Not applicable: API behaviour.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

Overlaps with #684 only in _resolve_workspace_dir / _resolve_file_path: that PR adds the sandbox-wide /workspace root as an extra accepted listing path for conversations without a repository; this one makes the accepted root depend on repository. Both apply to the same two functions and can land in either order with a small merge.

…repository in a multi-repository conversation
@ak684
ak684 requested a review from all-hands-bot October 29, 2026 09:23
@github-actions github-actions Bot added the type: feat A new feature label Oct 29, 2026
@all-hands-bot

all-hands-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review posted for ac7655254df0

Verdict: ✅ APPROVED. See the review.

This is an automated status.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  openhands/app_server/app_conversation
  additional_repositories.py
  app_conversation_router.py 2075-2076
Project Total  

This report was generated by python-coverage-comment-action

@all-hands-bot all-hands-bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This review was posted by an AI agent (OpenHands).

I found no blocking problems. Every endpoint resolves repository through conversation_roots / select_root, so the selector can only name a folder this conversation actually cloned. A failed clone, an unknown name, or an empty string returns 404. Without the selector, each endpoint resolves to the same folder as before: get_project_dir / get_project_dir_for_hooks for the primary, the working folder when there is no primary, and an explicit git path is forwarded unchanged. On /skills and /hooks, the new except HTTPException: raise makes an unknown selector return 404 instead of falling into the generic 500 handler. On /file, the selector is resolved before the try that swallows errors into "", so it also returns 404. /skills now passes additional_repositories to load_and_merge_all_skills, so the listing matches the merged set the agent receives at start.

Verification on this head:

  • tests/unit/app_server/test_app_conversation_repository_selector.py: 25 passed locally.
  • The existing router, skills, hooks, additional-repository, skill-loader and git-router tests: 194 passed. The one error was a DB-fixture test that needs Docker, which this sandbox does not have.
  • All GitHub Actions checks on ac76552 pass: the 4 Python test shards, lint, and both image builds.

One non-blocking note is inline: the new /hooks docstring says the primary's hooks are loaded, but none are loaded in a multi-repository conversation.

✅ APPROVED

LLM profile: all-hands-bot-reviewer_claude-opus-5-5 · Model: openhands/claude-opus-5-5

This endpoint loads hooks from the conversation's project directory in the
workspace (i.e. `{project_dir}/.openhands/hooks.json`) at request time.
``repository`` reads another repository's `.openhands/hooks.json` instead;
only the primary repository's hooks are loaded when a conversation starts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking: this sentence is wrong for the case this PR is about. When a conversation has additional repositories, loads_repository_hooks() returns False (live_status_app_conversation_service.py ~L2969). So no repository's hooks are loaded at start, the primary's included. FastAPI publishes this docstring as the endpoint description in OpenAPI, so Canvas authors will read it as the runtime contract. Suggested wording: "Hooks are loaded at start only from the primary repository of a single-repository conversation; in a multi-repository conversation none run, so this is a view of each folder's configuration."

@ak684
ak684 marked this pull request as ready for review October 29, 2026 09:54
@ak684
ak684 merged commit 94eac04 into main Oct 29, 2026
24 checks passed
@ak684
ak684 deleted the alona/multi-repo-read-side branch October 29, 2026 17:51
@openhands-release-bot openhands-release-bot Bot added the released: 1.83.0 Shipped in 1.83.0 label Nov 2, 2026
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in 1.83.0.

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

Labels

released: 1.83.0 Shipped in 1.83.0 type: feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants