Repository navigation
feat(app-conversation): read files, diffs, skills and hooks of every repository in a multi-repository conversation - #1073
Conversation
…repository in a multi-repository conversation
Review posted for
|
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
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
ac76552pass: 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. |
There was a problem hiding this comment.
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."
|
🚀 Released in 1.83.0. |
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/filesdeliberately rejected sibling folders. Canvas could browse, read and diff nothing but the primary.Summary
conversation_rootsbesideadditional_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.repositoryquery parameter: the folder name fromrepositories[].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./filesand/filevalidate and re-anchor paths against the selected root instead of the primary only./git/changesdefaultspathto the selected root (the parameter is now optional);/git/diffresolves a relative or stalepathunder it. Withoutrepository, an explicit gitpathis still forwarded unchanged./skillsnow 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 isagents:<folder>), andrepositorynarrows the list to that repository's project skills./hooksreads 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>isrepositories[].folderfrom the conversation. Omit it for the primary (or the working folder when the conversation has no primary)./filespaths come back relative to the selected folder;/file,/git/changesand/git/diffaccept 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.repository=<additional folder>,/fileslisted its tree,/fileread its file,/skillsnarrowed toagents:<folder>,/hooksshowed itsstophook, and after the agent appended a line to its README,/git/changesand/git/diffshowed 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/changeswithout a path and 200 for the unknown folder.Video/Screenshots
Not applicable: API behaviour.
Type
Notes
Overlaps with #684 only in
_resolve_workspace_dir/_resolve_file_path: that PR adds the sandbox-wide/workspaceroot as an extra accepted listing path for conversations without a repository; this one makes the accepted root depend onrepository. Both apply to the same two functions and can land in either order with a small merge.