Skip to content

fix(app-conversations): run primary repository hooks in multi-repository conversations when the agent-server can - #1063

Merged
ak684 merged 4 commits into
mainfrom
alona/multi-repo-hooks-project-dir
Nov 4, 2026
Merged

ak684 merged 4 commits into
mainfrom
alona/multi-repo-hooks-project-dir

Conversation

@ak684

@ak684 ak684 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Why

With additional repositories the agent works from the parent folder, so #1046 stopped loading the primary repository's .openhands/hooks.json: the agent-server ran hook commands from the parent folder, and a relative path in a hook pointed at the wrong tree. software-agent-sdk#6306 lets a conversation name the directory command hooks run from.

Summary

  • When the pinned SDK declares hook_project_dir on both the start request and ConversationSettings (software-agent-sdk#6306) and the sandbox's agent-server reports (/server_info) an openhands-sdk at least as new as the app server's, a start with additional repositories loads the primary repository's hooks again and sets the primary's folder as hook_project_dir on the conversation settings, which create_request() forwards to the agent-server, so hooks run there and see it as OPENHANDS_PROJECT_DIR. A single-repository start sends its repository folder, which is where its hooks already ran.
  • The sandbox check matters because a sandbox created before an upgrade still hosts new conversations (fix(app-conversation): let ordinary launches start in sandboxes below the SDK floor (OHE-3838) #1083: explicit sandbox_id, a running sandbox reused for the user, Plan sub-conversations). Its older agent-server ignores the field and would run the hooks from the parent folder, so for it the hooks stay skipped and nothing is sent. _ensure_profile_runtime already reads /server_info; it now returns the reported sdk_version beside the browser availability.
  • On the current pin (1.59.0) nothing changes: hooks stay skipped with additional repositories, and the field is not set, so an older agent-server never gets a key it does not know.

Issue Number

FDE-240

How to Test

  • pytest tests/unit/app_server/test_additional_repositories.py tests/unit/app_server/test_live_status_app_conversation_service.py on the pinned SDK (1.59.0): 401 passed, 1 skipped. The skipped test is the new request-building regression test, which only runs when the installed SDK has the field. New: the gate's version table (same or newer sandbox passes; older, missing or unparsable version fails; no field locally fails), the real gate against the locked SDK, /server_info returning the SDK version, and a start with additional repositories in a sandbox one release behind the app server, which loads no hooks and sends no hook_project_dir even though the app server's models have the field.
  • The same two files with the software-agent-sdk#6306 branch (head 27ed684a, plus the litellm it needs) installed in the venv, on the previous head: 393 passed with the regression test running, asserting that the built StartConversationRequest has hook_project_dir == <working_dir>/<repo> and that model_dump() carries it. The venv was restored to the locked 1.59.0 afterwards.
  • Also covered: hooks skipped only on an agent-server without the field, the setting produced only when hooks were loaded on a supporting agent-server, and the single-repository invariants. tests/unit/app_server as a whole: 2,573 passed on the first head; the current head is the same change on main 807e788b, beside the conversation_roots helpers that landed with feat(app-conversation): read files, diffs, skills and hooks of every repository in a multi-repository conversation #1073.
  • Repository pre-commit (ruff, ruff format, mypy) passes.
  • Not yet tested live: that needs an SDK release with software-agent-sdk#6306 and the matching agent-server image. With them, a multi-repository start on a self-hosted install whose primary has a relative-path SessionStart hook should run the hook from the primary's folder; the feat(app-conversations): start a conversation with several repositories #1046 live run showed the hook not running, which stays the behaviour until then.

Video/Screenshots

Not applicable: API behaviour.

Type

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

Notes

Takes effect when openhands-sdk and openhands-agent-server move past 1.59.0 to a release that contains software-agent-sdk#6306, and only in sandboxes running that release or newer; sandboxes created before the upgrade keep today's behaviour (hooks skipped beside additional repositories) until they are replaced. No further change is needed here at that point.


Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-5900e82

@github-actions github-actions Bot added the type: fix A bug fix label Oct 28, 2026
@ak684

ak684 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

@OpenHands /codereview-roasted

Review exactly commit 5d6b47c. If the PR head changes, report that and do not approve another commit. Review only: do not push code, merge, deploy, or change attribution. Check correctness, regression coverage, and whether the PR validation claims match the evidence. Keep code comments short. Post the substantive review and link it in your completion message. End the substantive review with these plain lines (no code fence), choosing one verdict:

REVIEWED_HEAD: 5d6b47c
REVIEW_REQUEST: 952238fbdc9b47168af7fa9d5e220068
VERDICT: APPROVED

Use VERDICT: CHANGES_REQUESTED instead when findings require changes. If unable to review, explain the blocker without an approval verdict.

@openhands-ai

openhands-ai Bot commented Oct 28, 2026

Copy link
Copy Markdown

I'm on it! ak684 can track my progress at all-hands.dev

@github-actions

github-actions Bot commented Oct 28, 2026 •

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 194-197
  live_status_app_conversation_service.py
Project Total  

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

@ak684 ak684 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Taste rating: needs improvement

Material finding: hook_project_dir never reaches the agent-server (the PR's core mechanism is a no-op)

  • File/line: openhands/app_server/app_conversation/live_status_app_conversation_service.py:2944-2956 (conv_settings = user.conversation_settings.model_copy(update={... **hook_project_dir_setting(hook_config, project_dir)})) and :3003-3004 (request = conv_settings.create_request(StartConversationRequest, **create_kwargs)).
  • Root cause: hook_project_dir is injected by stashing it on ConversationSettings via model_copy(update=...). But ConversationSettings.create_request() builds its request through _start_request_kwargs(), which forwards only a fixed allowlist of fields (workspace, conversation_id, initial_message, tool_module_qualnames, agent_definitions, plugins, hook_config, observability_*, ...) and never reads a hook_project_dir attribute. ConversationSettings does not declare a hook_project_dir field on the SDK head of software-agent-sdk#6306 (settings/model.py is not touched by that PR); even the extra value stored via model_copy is invisible to model_dump() and is not forwarded. The request is then serialized with request.model_dump() (live_status_app_conversation_service.py:862) before the POST /api/conversations, so the field never appears on the wire.
  • Effect: Even after an SDK release containing software-agent-sdk#6306, this PR loads the primary repository hooks in a multi-repository start but never tells the agent-server which directory to run them from. Hooks would run from the workspace parent folder with OPENHANDS_PROJECT_DIR unset against an expanded agent-server — exactly the wrong-tree bug the PR was written to fix. On the current pin (1.59.0) behavior is unchanged as documented, so only the future path is broken, but that path is the entire point of the change.
  • Evidence (reproduced in the workspace venv with the pinned SDK): ConversationSettings.model_copy(update={'hook_project_dir': '/workspace/project/app'}) stores the value in __dict__, but a subsequent create_request(StartConversationRequest, ...) produces a request whose hook_project_dir attribute is absent, and model_dump(keys) shows no hook_project_dir key. Passing hook_project_dir= as an explicit kwarg to create_request is likewise dropped by _start_request_kwargs unless it is added to the forwarded allowlist.
  • Smallest correction: add hook_project_dir to the forwarded set. Two viable paths:
    1. In this repo, pass it as a create_kwargs entry and add it to ConversationSettings._start_request_kwargs (e.g. forward if 'hook_project_dir' in self.model_fields or getattr(self, 'hook_project_dir', None)), or
    2. In software-agent-sdk#6306, declare hook_project_dir on ConversationSettings so _start_request_kwargs forwards it like hook_config.
      Because the SDK PR does not add the field, option 1 here is required regardless; without it the wire payload never carries the key.

Secondary: the new unit tests do not reach the request-building path

  • tests/unit/app_server/test_additional_repositories.py:859-870 verifies only that hook_project_dir_setting() returns the right dict literal. No test exercises _build_start_conversation_request_for_user with a real StartConversationRequest + hook_config, so the drop at create_request/serialization is uncaught. A regression test should assert result.hook_project_dir == project_dir (and its presence in model_dump()) on the built request when loading hooks on a supporting agent-server.

Assessment of PR claims

  • The 358 passed unit suite and pre-commit are credible claims (CI on head 5d6b47c is green for Python, lint, and builds).
  • The "not tested live" caveat is accurate, but it understates the issue: the mechanism is broken, not merely untested. When the pins move past 1.59.0, this change will load hooks without any working directory, which is more harmful than today's skip.

Acceptance-criteria checklist (FDE-240)

  • Hooks load for multi-repo starts on a supporting agent-server (loading gate works — loads_repository_hooks).
  • The primary folder is actually communicated to the agent-server as hook_project_dir — fails, field is dropped.
  • Hooks run from the primary's folder — not achievable given the drop; relative-path hooks would still run from the parent folder.
  • Single-repository invariants preserved.

[RISK ASSESSMENT] MEDIUM This is a backend API/request-wiring change. No credentials or security boundaries are touched, and the default (1.59.0) path is a documented no-op, so the blast radius on current production is minimal. The materiality is correctness: the feature the PR exists to deliver silently does nothing once the SDK/agent-server support lands, and the broken state is worse than the status quo it replaces (hooks loaded but run from the wrong directory). The fix is small and localized to the request-forwarding path shown above; no human SME sign-off is required beyond normal review, but the author must prove the field reaches the wire (unit test asserting StartConversationRequest.hook_project_dir and its model_dump, or a live run against a supporting agent-server) before merge. A HIGH rating is not warranted because there is no data loss, privilege escalation, or reachable failure on the current deployment; the risk is deferred to the future pin.

Verdict: changes requested — the PR's central mechanism does not propagate hook_project_dir to the agent-server, so once the SDK support lands it would load hooks without telling the agent-server where to run them. Please (1) forward hook_project_dir through ConversationSettings.create_request() (e.g. add it to _start_request_kwargs), and (2) add a regression test that asserts the built StartConversationRequest carries hook_project_dir (and serializes it) when hooks are loaded.

Improve this review? If feedback seems incorrect or irrelevant, update the repository's .agents/skills/custom-codereview-guide.md (with the /codereview trigger), then re-request review. The reviewer reads the guide from the PR head.

Resolve with AI? Install the iterate skill and run /iterate.

Was this review helpful? React with 👍 or 👎.

ak684 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Substantive review posted at #1063 (review)

REVIEWED_HEAD: 5d6b47c
REVIEW_REQUEST: 952238fbdc9b47168af7fa9d5e220068
VERDICT: CHANGES_REQUESTED

@openhands-ai

openhands-ai Bot commented Oct 28, 2026

Copy link
Copy Markdown

Reviewed PR #1063 at commit 5d6b47c.

Review posted

REVIEWED_HEAD: 5d6b47c
REVIEW_REQUEST: 952238fbdc9b47168af7fa9d5e220068
VERDICT: CHANGES_REQUESTED

Findings

Material (blocking): The PR's core mechanism is a no-op. hook_project_dir_setting() returns a dict that is stashed on ConversationSettings via model_copy(update=...) (live_status_app_conversation_service.py:2944-2956), but ConversationSettings.create_request() → _start_request_kwargs() forwards only a fixed allowlist of fields and never reads hook_project_dir. The SDK PR software-agent-sdk#6306 does not touch settings/model.py, so the field is neither declared nor forwarded, and request.model_dump() (:862) drops it before POST /api/conversations.

I reproduced this in the workspace venv against the pinned SDK: after model_copy(update={'hook_project_dir': ...}), the subsequent create_request(StartConversationRequest, ...) yields a request whose hook_project_dir attribute/serialization is absent. Even passing it as an explicit kwarg is dropped. Consequences: once the pins pass 1.59.0, hooks will load for multi-repo starts but the agent-server won't know which directory to run them from — hooks would run from the parent folder with OPENHANDS_PROJECT_DIR unset, which is the exact bug the PR intends to fix, and is worse than today's skip. Fix: forward hook_project_dir through _start_request_kwargs (either in this repo by adding it to the forwarded set, or in the SDK PR by declaring it on ConversationSettings).

Secondary: the new tests (test_additional_repositories.py:859-870) only assert the helper returns the right dict literal; none exercises _build_start_conversation_request_for_user with a real StartConversationRequest + hook_config, so the drop is uncaught. Requested a regression test asserting the built request carries and serializes hook_project_dir.

PR-validation claims

  • The 358 passed / pre-commit claims are credible — CI on the reviewed head is green (Python 3.12, lint, builds).
  • The "not tested live" caveat is accurate but understated: the mechanism is broken (field dropped), not merely untested.

Also confirmed the reviewed head matches commit 5d6b47c (verified before and after posting). No code was pushed, merged, or modified.

@ak684

ak684 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

@OpenHands /codereview-roasted

Review exactly commit 2a10c18. If the PR head changes, report that and do not approve another commit. Review only: do not push code, merge, deploy, or change attribution. Check correctness, regression coverage, and whether the PR validation claims match the evidence. Keep code comments short. Post the substantive review and link it in your completion message. End the substantive review with these plain lines (no code fence), choosing one verdict:

REVIEWED_HEAD: 2a10c18
REVIEW_REQUEST: 0af4e3cf1fc84c718cf3d0816fac6e78
VERDICT: APPROVED

Use VERDICT: CHANGES_REQUESTED instead when findings require changes. If unable to review, explain the blocker without an approval verdict.

@ak684

ak684 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Disposition for the review on 5d6b47c7: the material finding is correct. ConversationSettings.create_request() forwards an allowlist, so a value stashed with model_copy(update=...) never reached the request. Fixed on 2a10c180:

  • software-agent-sdk#6306 (head 4011988d) now declares hook_project_dir on ConversationSettings (runtime field, excluded from persisted settings like hook_config) and forwards it in _start_request_kwargs, with a test.
  • Here, agent_server_runs_hooks_from_project_dir() also requires the field on ConversationSettings, so the setting is produced only when the installed SDK forwards it.
  • New regression test test_build_request_carries_hook_project_dir_on_a_supporting_agent_server builds the request through _build_start_conversation_request_for_user with hooks loaded and asserts request.hook_project_dir == '<working_dir>/<repo>' and its presence in model_dump(). It skips on the pinned 1.59.0 SDK (no field) and passes with the #6306 branch installed (43 selected tests passed, venv restored afterwards); results are in the PR description.

@openhands-ai

openhands-ai Bot commented Oct 28, 2026

Copy link
Copy Markdown

I'm on it! ak684 can track my progress at all-hands.dev

@ak684 ak684 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Taste rating: good — no material findings.

Reviewed head 2a10c180adca268b4107cdd53ff29d144c66eb54. This addresses the previous review (on 5d6b47c) in full:

  • Prior material finding (resolved). The earlier review showed hook_project_dir never reached create_request() because ConversationSettings._start_request_kwargs() forwards a fixed allowlist. software-agent-sdk#6306 (head 4011988d) now declares hook_project_dir on ConversationSettings (runtime field, exclude=True as with hook_config) and forwards it in _start_request_kwargs(); this PR keeps the model_copy(update=...) composition and the new regression test (test_build_request_carries_hook_project_dir_on_a_supporting_agent_server) asserts the field on the built StartConversationRequest and in its model_dump(), so a drop at serialization is now caught. I verified this empirically by installing the SDK PR head into the venv: the test passes, and reverting to the pinned 1.59.0 it skips with the documented reason.
  • Correctness by case. Feature detection requires the field on both ConversationConfig and ConversationSettings, and bump-sdk.yml keeps openhands-sdk/openhands-agent-server/openhands-tools in lockstep, so the installed models are a sound proxy for what the sandbox agent-server understands. Single-repo: hooks continue to load and hook_project_dir = project_dir equals the existing working directory, so behavior is unchanged. Multi-repo on an old agent-server: hooks still skipped, field not sent. Multi-repo on a supporting agent-server: hooks load from and run in the primary's folder, with OPENHANDS_PROJECT_DIR pointing there — exactly the intended fix. The hook_config is None guard prevents sending the field when no hooks were loaded.
  • Claims match evidence. On the pinned SDK I reproduced 358 passed, 1 skipped for the two named files; with the SDK PR head installed the regression test runs and passes (full-file runs green); pre-commit passes on the changed files; head CI (22 check runs) is green. The "not tested live" caveat is accurate and the dependency on an unmerged SDK PR is disclosed.

Acceptance-criteria checklist (FDE-240)

  • Hooks load again for multi-repo starts on a supporting agent-server.
  • The primary's folder reaches the agent-server as hook_project_dir (asserted on the built request and its serialized dump).
  • On a supporting server hooks run from the primary's folder (agent-server honors the field per SDK PR 6306).
  • Single-repository invariants preserved (loads_repository_hooks([]) is True regardless of support).

[RISK ASSESSMENT] LOW–MEDIUM — backend request-wiring change, inert on the current 1.59.0 pin (documented no-op); no security boundary, credential, or data-surface change. hook_project_dir is the same project_dir value already sent to the agent-server's /api/hooks endpoint. Blast radius on current production is nil and the future path has a regression test that fails closed if the forwarding regresses. No human-gate comment warranted.

Key architectural insight: the PR treats "does the sandbox support running hooks from a named directory" as a feature-detectable property of the pinned, lockstep-bumped SDK models rather than a hardcoded version check, so the change is inert until the pin moves and needs no follow-up when SDK/agent-server releases land — provided the lockstep bump discipline holds.

REVIEWED_HEAD: 2a10c18
REVIEW_REQUEST: 0af4e3cf1fc84c718cf3d0816fac6e78
VERDICT: APPROVED

ak684 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Reviewed PR #1063 at commit 2a10c18.

Review posted

REVIEWED_HEAD: 2a10c18
REVIEW_REQUEST: 0af4e3cf1fc84c718cf3d0816fac6e78
VERDICT: APPROVED

@openhands-ai

openhands-ai Bot commented Oct 28, 2026

Copy link
Copy Markdown

Review complete. Here's the summary.

Review Outcome

Verdict: APPROVED — no material findings remain on head 2a10c180adca268b4107cdd53ff29d144c66eb54.

What I verified

  1. Head SHA confirmed: 2a10c180adca268b4107cdd53ff29d144c66eb54 matches the requested review target and the current PR head — no drift.

  2. Prior review's material finding is resolved end-to-end. The earlier CHANGES_REQUESTED (on 5d6b47c) showed hook_project_dir would never reach the wire because ConversationSettings._start_request_kwargs() forwards a fixed allowlist. The SDK PR head 4011988d now declares hook_project_dir on ConversationSettings (exclude=True, like hook_config) and forwards it via setdefault in _start_request_kwargs. I empirically confirmed this by installing the SDK PR head into the venv: the new regression test passes (asserting the field on the built StartConversationRequest and its model_dump()), then restored the pinned SDK and confirmed the test skips with the documented reason.

  3. Test/CI claims reproduced: On the pinned 1.59.0, 358 passed, 1 skipped for the two named files (the skip is the SDK-gated regression test with a clear reason). Pre-commit (ruff, ruff format, mypy) passes on all four changed files; all 22 check runs at the head are green.

  4. Correctness by case: feature detection requires the field on both ConversationConfig and ConversationSettings, backed by the lockstep bump-sdk.yml discipline (SDK + agent-server + tools pinned to the same version). Single-repo behavior unchanged (hook_project_dir equals the existing working dir); multi-repo on an old agent-server still skips hooks and sends no field; multi-repo on a supporting agent-server loads and runs hooks from the primary's folder with OPENHANDS_PROJECT_DIR correct.

Where the review landed

The only caveat, which the author already disclosed: the mechanism depends on software-agent-sdk#6306, which is still open/blocked — so the change is inert until that lands and the pin moves. That's expected for this cross-repo fix and is covered by a regression test that fails closed.

@ak684
ak684 marked this pull request as ready for review October 28, 2026 19:29
@ak684
ak684 requested a review from all-hands-bot October 28, 2026 19:29
@all-hands-bot

all-hands-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review posted for 5900e82a1f7d

Verdict: ✅ APPROVED. See the review.

This is an automated status.

@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 nothing that should block this PR. Reviewed at 2a10c180.

Correctness. I checked each case against the base:

  • Pinned 1.59.0: ConversationConfig and ConversationSettings have no hook_project_dir field. So hooks are still skipped when there are additional repositories, and hook_project_dir_setting() returns {}. Behaviour is the same as main.
  • Single repository: hooks still load. The value sent equals project_dir, which is already the agent's working directory.
  • Multi-repository with a supporting SDK: hooks load from the primary's folder. The same folder goes through ConversationSettings._start_request_kwargs(), which software-agent-sdk#6306 at 4011988d now forwards. The agent-server then stores it and passes it to HookExecutor as both the cwd and OPENHANDS_PROJECT_DIR.
  • No hooks loaded: the hook_config is None guard keeps the field off the request.
  • Older agent-server that gets the key: StartConversationRequest uses pydantic's default extra='ignore', so the unknown key cannot cause a 422.

Tests.

  • On the locked 1.59.0 SDK, the two touched test files give 358 passed and 1 skipped. The skip is the new regression test.
  • With the #6306 head installed for openhands-sdk, openhands-agent-server and openhands-tools, the same files give 359 passed. The regression test runs and confirms hook_project_dir is on the built StartConversationRequest and in its model_dump(). I restored the venv to the lock afterwards.
  • All head CI checks pass (21 success, 3 skipped).

Non-blocking note, for when the pin moves. agent_server_runs_hooks_from_project_dir() checks the app server's installed SDK, not the sandbox's agent-server. Two kinds of sandbox can run an older agent-server: a custom sandbox spec (see is_custom_sandbox_spec) and a sandbox started before an upgrade. On those, a multi-repository start will load the primary's hooks again. The older server ignores hook_project_dir, so the hooks run from the parent folder, which is the case #1046 skips today. That is a narrow case and the trade-off may be fine, but the claim that "an older agent-server never gets a key it does not know" holds only while the pin is at 1.59.0.

✅ APPROVED

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

@ak684

ak684 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

On hold for now: the author is deciding whether conversation hooks should run in multi-repository conversations at all, and how that should be surfaced to users, before this lands. Approved and green; converting back to draft so it is not merged by accident. No further changes planned until that decision.

@ak684
ak684 marked this pull request as draft October 29, 2026 08:17

@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).

Since my approval of 2a10c180, the PR diff has not changed; it was rebased onto main 807e788b. But main has changed in a way that turns my earlier non-blocking note into a blocking finding.

Blocking: the support check reads the app server's SDK, not the sandbox's agent-server.

  • agent_server_runs_hooks_from_project_dir() assumes the sandbox agent-server runs the same SDK version as the app server. #1083 (OHE-3838), now on main, makes version skew a supported path. _wait_for_sandbox_start reuses running sandboxes through _find_running_sandbox_for_user() or an explicit sandbox_id. _ensure_profile_runtime now lets an older sandbox host new conversations, with a warning.
  • So once the SDK pin moves past #6306, here is what happens on a multi-repository start in a sandbox created before the upgrade:
    1. The primary's hooks load.
    2. The older agent-server ignores hook_project_dir, because StartConversationRequest uses pydantic's default extra='ignore'.
    3. The hooks run from the parent folder. That is the case #1046 deliberately skips today.
  • The PR notes say no further change is needed when the pin moves, so this would appear silently at that point.
  • Suggested fix: _ensure_profile_runtime already fetches /server_info before the request is built. Gate loads_repository_hooks and hook_project_dir_setting on the sandbox's reported sdk_version, compared with the first release that contains #6306, as well as on the local model check. Then add a test where the sandbox reports an older version.

Re-verified on 2bac5c36:

  • Locked 1.59.0: 392 passed, 1 skipped (the regression test).
  • With software-agent-sdk#6306 head 27ed684a installed: 393 passed. I restored the venv to the lock afterwards.
  • Python test and lint checks for this head pass.

🔄 CHANGES REQUESTED

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

@ak684

ak684 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Disposition for the review on 2bac5c36: the finding is correct. After #1083 a new conversation can start in a sandbox whose agent-server is older than the app server's SDK, and StartConversationRequest ignores unknown fields, so the local model check alone would have loaded the primary's hooks and let the older agent-server run them from the parent folder once the pin moves.

Fixed on 5900e82a:

  • _ensure_profile_runtime now returns SandboxRuntime(browser_available, sdk_version) from the /server_info it already fetches, and the start flow passes sandbox_sdk_version into the request builder.
  • agent_server_runs_hooks_from_project_dir(sandbox_sdk_version) requires the local models to have the field and the sandbox to report an openhands-sdk at least as new as the app server's installed one (the version whose request model has the field). The first release containing software-agent-sdk#6306 is not known yet, so the installed version is the floor; a sandbox on that release or newer runs the hooks from the primary's folder, anything older or unparsable keeps hooks skipped and the field unsent. loads_repository_hooks and hook_project_dir_setting take the computed support flag explicitly.
  • Tests: the gate's version table, the real gate on the locked SDK, /server_info version readback, and a start with additional repositories in a sandbox one release behind the app server (no hooks loaded, no hook_project_dir) while the app server's models have the field. 401 passed, 1 skipped on the pin; pre-commit clean.

@ak684
ak684 requested a review from all-hands-bot November 4, 2026 19:19

@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).

Resolved: the finding from my review of 2bac5c36. That review flagged that the gate checked the app server's SDK, not the sandbox's agent-server. This head fixes it, and I resolved the thread.

  • _ensure_profile_runtime now returns the sdk_version it reads from /server_info. That function has one caller, and that caller passes the version to the request builder.
  • agent_server_runs_hooks_from_project_dir(sandbox_sdk_version) now needs both conditions:
    • the local models have the field;
    • the sandbox reports a parsable openhands-sdk version at least as new as the installed one.
  • If either fails, the multi-repository hooks are skipped and hook_project_dir is not sent. A missing or unparsable version counts as a failure.
  • A single-repository start is unchanged.

Tests.

  • The new older-sandbox test proves the skip path: no _load_hooks_from_workspace call and no hook_project_dir, even when the local models have the field.
  • Locked 1.59.0: 401 passed, 1 skipped.
  • With software-agent-sdk#6306 head 27ed684a installed: 402 passed. I restored the venv to the lock afterwards.
  • All head CI checks pass.

Non-blocking. The gate compares against the installed SDK version, not against the first release that contains #6306. So after every later SDK bump, sandboxes one release behind will skip multi-repository hooks until they are replaced, even though they support the field. That is a safe failure, and the PR notes describe it. Once the release version is known, a fixed minimum version would keep hooks running in those sandboxes.

✅ APPROVED

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

@ak684
ak684 marked this pull request as ready for review November 4, 2026 19:31
@ak684
ak684 merged commit e2276c1 into main Nov 4, 2026
24 checks passed
@ak684
ak684 deleted the alona/multi-repo-hooks-project-dir branch November 4, 2026 20:15
@openhands-release-bot openhands-release-bot Bot added the released: 1.86.0 Shipped in 1.86.0 label Nov 4, 2026
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in 1.86.0.

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

Labels

released: 1.86.0 Shipped in 1.86.0 type: fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants