Repository navigation
feat: harden automation draft preflight validation - #341
KirschBluteX wants to merge 15 commits into
Conversation
|
👋 This PR needs a couple of things fixed before OpenHands can review it:
Push an update once this is addressed and this check re-runs automatically. This is an automated check - no AI was used to generate this comment. |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope: This change belongs in this repository. It extends the existing /v1/validate owner in openhands/automation/capabilities_router.py with optional deployment preflight requirements, which matches the follow-up hardening described in OpenHands/OpenHands#16565 (open; labels enhancement, ready-for-dev). The companion PRs (OpenHands/OpenHands#16614, software-agent-sdk#4504, sandbox-server#6, extensions#476) are all open. No product/architecture decision is needed, so this is a technical review.
Verification performed on head fc7aa63:
uv run pytest tests/test_capabilities_router.py -q→ 35 passed.uv run pre-commit run --files openhands/automation/schemas.py openhands/automation/capabilities_router.py tests/test_capabilities_router.py→ Ruff format/lint, pycodestyle, pyright all pass.- Confirmed the diff (
git diff e1523d4...fc7aa63) is+1629 -6across the 3 stated files.
Blocking issues
-
The branch no longer merges with
main, and CI never produced a result for this head. The PR reportsmergeable_state: dirty, andgit merge-treeshows content conflicts in bothcapabilities_router.pyandschemas.py. The merge base ise1523d4, which is 80 commits behind currentmain(49fe663) — the branch predatesproviders.py/builtin_sourcesand therequire_permissionauthorization model thatmainnow uses on this router. Separately, theci,Run tests,Docker, andPR Artifactsruns for this exact head all concludedfailurewith zero jobs; GitHub states "This run likely failed because of a workflow file issue", so no test or lint result exists for this revision. Only theprtitle-lint runs passed. The local green result above therefore does not cover the merged tree: rebase onmainand re-run the full suite before merge. -
The ref check searches branches only, so tag and commit-SHA refs fail closed with the wrong error.
_cloud_repository_errorsvalidatesrefexclusively through/api/v1/git/branches/search. The SDK'sRepoSource.refis documented as "Optional branch, tag, or commit SHA to checkout", so a draft pinned to a tag (or a SHA that is not a current branch tip) is never found here and is rejected withrepository_ref_not_accessible. Thecommit_sha.casefold().startswith(ref.casefold())arm only matches a branch tip SHA, so it does not cover arbitrary commits. This is a false negative that blocks valid drafts. -
A legitimately stored MCP
authshape fails the entire preflight with a 503._parse_stored_mcp_serverraises_DependencyUnavailableunlessauthis absent or a dict with a stringstrategy. The SDK's MCP auth migration also accepts a plain stringauthand rewrites it to{"strategy": "bearer", "value": auth}(andapi_key/Authorizationheader forms) — but that migration runs on the settings write/migrate path, not necessarily on theagent_settings.mcp_configpayload this code reads back. One server whose storedauthis a plain string therefore makes_stored_mcp_serversraise, which the caller converts into a sanitized503for the whole request — an unrelated server's config shape takes down every preflight for the user instead of being skipped or reported as that one integration being unavailable.
Non-blocking observations
draft.reposhas no upper bound, and_deployment_preflight_errorsprobes repositories sequentially with up to 10 pages for the repo plus 10 for the ref, all under one 60s wall clock. A longreposlist against a slow provider can exhaust the budget and return a generic503instead of per-repository errors. Boundingrepos(or the probe count) would make the failure mode predictable.- The ref-matching loop
breaks out of the page loop only after a full page is scanned; combined withlimit=100and aquery=reffilter this is reasonable, but note that a provider that ignoresquerywill make the tag/SHA false negative in issue 2 more likely to hit the page cap and surface as503rather than a clear "not found".
Summary: The design is sound — optional requirements preserve legacy clients, secret names (never values) are checked, error bodies are sanitized, and pagination has repeated-token detection. The tests cover the advertised cases. The blocking items are concrete and demonstrated on the current head: the branch is unmergeable and untested by CI, and two false-negative paths (tag/SHA refs, string auth) either block valid drafts or break unrelated ones.
🔄 CHANGES REQUESTED
| response = await _send_preflight_request( | ||
| client, | ||
| "GET", | ||
| f"{target.base_url}/api/v1/git/branches/search", |
There was a problem hiding this comment.
Ref validation searches branches only (/api/v1/git/branches/search). The SDK's RepoSource.ref is documented as "Optional branch, tag, or commit SHA to checkout", so a draft pinned to a tag or to a commit that is not a current branch tip is never found here and is rejected with repository_ref_not_accessible. Add a tag/commit lookup (or widen the search) before rejecting the ref.
Preserve permission checks and canonical draft schemas while merging upstream. Support tarball preflight requirements and isolate invalid MCP entries through SDK settings migration. Report unmatched Cloud references as unverified because branch search does not resolve tags or arbitrary commits. Validation: 215 related tests passed; scoped pre-commit passed. Full-suite collection remains blocked on Windows by upstream socket.AF_UNIX checks. Local tests use Python 3.13.14 with lockfile dependency versions. Co-authored-by: openhands <openhands@all-hands.dev>
| _MCP_PROBE_TIMEOUT_SECONDS = 15.0 | ||
| _MCP_PROBE_REQUEST_TIMEOUT_SECONDS = _MCP_PROBE_TIMEOUT_SECONDS + 5.0 | ||
| _PREFLIGHT_TOTAL_TIMEOUT_SECONDS = 60.0 | ||
| _MAX_PREFLIGHT_SEARCH_PAGES = 10 | ||
| # The Cloud git route requests one look-ahead item from providers to decide | ||
| # whether to return ``next_page_id``. Keeping this below provider max 100 lets | ||
| # that look-ahead survive instead of being clamped away. | ||
| _CLOUD_REPOSITORY_SEARCH_PAGE_SIZE = 99 | ||
| _LOCAL_REPOSITORY_SECRET_NAMES = { | ||
| "github": "github_token", | ||
| "gitlab": "gitlab_token", | ||
| "bitbucket": "bitbucket_token", | ||
| } | ||
| _REPOSITORY_PROVIDER_HOSTS = { | ||
| "github": "github.com", | ||
| "gitlab": "gitlab.com", | ||
| "bitbucket": "bitbucket.org", | ||
| } | ||
|
|
There was a problem hiding this comment.
Use Final from typing, with the correct type
| # whether to return ``next_page_id``. Keeping this below provider max 100 lets | ||
| # that look-ahead survive instead of being clamped away. | ||
| _CLOUD_REPOSITORY_SEARCH_PAGE_SIZE = 99 | ||
| _LOCAL_REPOSITORY_SECRET_NAMES = { |
There was a problem hiding this comment.
But this hare hard-coded or?
| """A trusted validation dependency did not return a usable answer.""" | ||
|
|
||
|
|
||
| @dataclass(frozen=True) |
| local: bool | ||
|
|
||
|
|
||
| @dataclass(frozen=True) |
| errors.extend( | ||
| await _integration_errors( | ||
| requirement, | ||
| servers, | ||
| available_secret_names, | ||
| target, | ||
| client, | ||
| ) | ||
| ) | ||
|
|
There was a problem hiding this comment.
i think you can start everything here withouth using a for loop, see asyncio.gather
|
|
||
| if repos: | ||
| for index, repository in enumerate(repos): | ||
| errors.extend( |
| headers = {} | ||
| if settings.agent_server_api_key: | ||
| headers["X-Session-API-Key"] = settings.agent_server_api_key |
| break | ||
| cookies.append(f"{name}={value}") | ||
| if not cookies: | ||
| raise _DependencyUnavailable |
There was a problem hiding this comment.
why this Excaption is private?
| if not cookies: | ||
| raise _DependencyUnavailable | ||
| headers = {"Cookie": "; ".join(cookies)} | ||
| else: |
There was a problem hiding this comment.
you don't need the else here
| try: | ||
| response = await client.request(method, url, headers=headers, **kwargs) | ||
| except httpx.RequestError: | ||
| raise _DependencyUnavailable from None |
| if response.status_code == status.HTTP_429_TOO_MANY_REQUESTS: | ||
| raise _DependencyUnavailable | ||
| if response.status_code >= status.HTTP_500_INTERNAL_SERVER_ERROR: | ||
| raise _DependencyUnavailable |
There was a problem hiding this comment.
Just in one if block. Or if you want separate give more info about the type of the error.
| value = response.json() | ||
| except ValueError: | ||
| raise _DependencyUnavailable from None | ||
| if not isinstance(value, dict): |
| if response.status_code != status.HTTP_200_OK: | ||
| raise _DependencyUnavailable | ||
| items = _json_object(response).get("secrets") | ||
| if not isinstance(items, list): |
| raise _DependencyUnavailable | ||
| seen_page_ids.add(next_page_id) | ||
| page_id = next_page_id | ||
| else: |
| return value | ||
|
|
||
|
|
||
| async def _available_secret_names( |
There was a problem hiding this comment.
this method can be probably decompose in better sub-methods. It is difficult to understand why we are doing this.
| raw_transport = "stdio" if isinstance(raw.get("command"), str) else "http" | ||
| if not isinstance(raw_transport, str): | ||
| raise _DependencyUnavailable | ||
| if raw_transport == "stdio": |
There was a problem hiding this comment.
can we use a match statement here?
|
|
||
| def _parse_stored_mcp_server(name: str, raw: dict[str, Any]) -> _StoredMCPServer: | ||
| enabled = raw.get("enabled", True) | ||
| if not isinstance(enabled, bool): |
| if alternative.transport == "stdio": | ||
| if alternative.locator != server.locator: |
Scope Cloud probes to the authenticated organization, use the SDK's clone credential names and persisted MCP auth migration, and bound concurrent checks with cancellation cleanup. Explain dependency and pagination boundaries in docstrings and keep malformed preflight inputs out of errors. Preserve the saved-draft error contract when serializing the shared validation model. Cover organization isolation, old MCP settings, secret metadata pagination, partial failures, timeouts, retries and probe budgets. Co-authored-by: openhands <openhands@all-hands.dev>
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope: This belongs in this repository. It extends the existing /v1/validate owner in openhands/automation/capabilities_router.py with optional, bounded deployment preflight requirements, which is the follow-up hardening described in OpenHands/OpenHands#16565 (open, enhancement + ready-for-dev). No product/architecture decision is needed, so the technical review continued.
State re-established on head 473f5339: title/body unchanged, label type: feat, mergeable with current main (the branch was rebased; git merge-tree origin/main HEAD is clean). The four companion PRs are all still open (OpenHands/OpenHands#16614, software-agent-sdk#4504, sandbox-server#6, extensions#476). The only prior reviews are on older commits (fc7aa63, 5bdf9bb); VascoSch92 commented after them, so this is a fresh pass on the current head, not a duplicate.
Verification performed on head 473f5339:
uv run python -m pytest tests/test_capabilities_router.py -q-> 83 passed, 3 pre-existing deprecation warnings.tests/test_draft_router.pycannot run in this environment: its fixtures require Docker, and the daemon is unreachable (docker.errors.DockerException ... FileNotFoundError). The one-line assertion added there is covered by reading the code, not execution.- GitHub Actions for this exact head:
ci,Run tests, andDockerall concludedaction_requiredwith no jobs, so repository CI gave no signal; only the title-lint / PR-description / artifacts workflows passed. The focused suite above is the local evidence.
The boundaries introduced here are sound: the 60s total asyncio.timeout, the separate MCP probe budget, the 10-page pagination cap with repeated-token detection, the official-host requirement for provider URLs, the bounded requirements envelope (extra="forbid", per-alternative secret-name cap, 16-integration and 32-distinct-name caps, _MAX_PREFLIGHT_REPOSITORIES), the fail-closed handling of a truncated search, and the sanitized 503 mapping for dependency/transport/rate-limit/malformed-response failures. Secret names only (never values) cross the public API, and provider bodies are not returned.
Two material findings are inline. Both were checked against the SDK pinned by this repo (openhands-sdk==1.50.0) and against the companion PRs' contracts.
Non-blocking coordination note (unchanged in kind from the earlier pass): the Cloud MCP probe (POST /api/v1/settings/mcp/{name}/test) is added by sandbox-server#6, which is not on that repository's main yet, and the local repository probe (POST /api/git/validate-repository) is added by software-agent-sdk#4504, which is not on the pinned agent-server (openhands-agent-server==1.50.0 exposes only /api/git/changes, /diff, /commits, /commits/{sha}/changes). Both companion PRs are still open. A 404 here is handled as _DependencyUnavailable, so if this merges before them, any draft that actually sends requirements.integrations (or local repos) fails closed with a 503 rather than validating. Legacy clients that omit requirements are unaffected. Worth confirming merge order.
🔄 CHANGES REQUESTED
Use the existing 501 advisory outcome when Cloud cannot resolve a tag or historical commit, but only after other checks have succeeded. Keep real validation errors and dependency failures blocking, and stop treating a branch-tip SHA prefix as proof that an arbitrary ref is valid. Trace the local preset's canonical credential lookup in English and test it against the pinned SDK for all providers, including anonymous public access and environment or MCP aliases. Cover mixed failures, pagination, provider outages, and unchanged exact-branch validation. Co-authored-by: openhands <openhands@all-hands.dev>
⏳ Review waiting on checksThe current head
No action is needed. The scheduled scan retries once every check on the head reports a conclusion. This is an automated check - no AI was used to generate this comment. |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope: This belongs in this repository. It extends the existing /v1/validate owner (openhands/automation/capabilities_router.py) with optional, bounded deployment preflight requirements, which is the preflight/capability ownership AGENTS.md assigns here. No maintainer decision is needed.
State re-established on head 7fba11e5: title and body unchanged, label type: feat, mergeable with current main. Companion PRs still open: OpenHands/OpenHands#16614 (clean), software-agent-sdk#4504 (blocked), sandbox-server#6 (clean), extensions#476 (dirty). Existing reviews are on older commits (fc7aa63, 5bdf9bb) plus my earlier pass on 473f5339; this is a fresh review of the new head, not a duplicate.
Verification performed on this head:
uv run python -m pytest tests/test_capabilities_router.py -q-> 112 passed.- GitHub Actions for this exact head:
ci,Run tests, andDockerall concludedaction_requiredwith no jobs, so repository CI gave no signal; only the title/description/artifacts workflows ran. The focused suite above is the local evidence.
Prior findings — both resolved on this head:
- Local repository credential name (previously line 951). The docstring and the new
test_local_repository_credentials_match_real_sdk_clone_lookupnow trace the pinned SDK path (RemoteWorkspace._get_secret_value->PROVIDER_TOKEN_NAMES[provider]->GET /api/settings/secrets/{name}) and confirm the canonical lowercase name (github_token/gitlab_token/bitbucket_token) is exactly what the clone path reads — across all three providers, anonymous public access, andOPENHANDS_*_TOKEN/MCP aliases. Gatingcredential_nameson that name is now justified rather than a false-negative source. - Cloud ref handling (previously line 1144).
_cloud_ref_errorsnow proves exact branch names only and reports tags/arbitrary commits as advisory. The hex-prefix false pass is gone (theis_commit_sha/commit_sha.startswith(ref)arm was removed), and new tests confirm an unverified ref cannot mask a denied repository, a missing credential, or an invalid trigger.
The remaining boundaries hold up: the 60s total timeout, separate MCP probe budget, 10-page pagination cap with repeated-token detection, official-host requirement, bounded requirements envelope (extra="forbid"), fail-closed truncated-search handling, and sanitized 503 mapping. Secret names only cross the public API, and the new RequestValidationError handler strips rejected input so a mistaken secret value is not echoed in a 422.
Non-blocking note: the new advisory path at line 342 is a contract addition — when the only finding is an unverifiable ref, the endpoint now returns 501 with a bare detail instead of the field-addressable ValidateDraftResponse envelope. This matches the Canvas companion (OpenHands/OpenHands#16614 maps 404/501 to an unsupported advisory), so the behavior is intended; the PR description's Summary simply doesn't mention it yet and could be updated.
✅ APPROVED
|
Hi Vasco, thank you for reviewing this and for pointing out that the preflight flow was difficult to follow. |
enyst
left a comment
There was a problem hiding this comment.
I'm an AI agent (Claude, based on Opus 5.5) helping Engel Nyst (@enyst) with project work.
Requesting changes: since the last approval, this branch has started conflicting with main, and the test module quietly moves the existing tests off PostgreSQL.
- Conflict with #541 (agent profiles in cloud mode, merged 2026-10-02). There are four conflict regions in
capabilities_router.py, coveringget_capabilitiesfeatures andvalidate_draft. Main'svalidate_draftnow takesrequestand callsensure_agent_profile_exists(), an outbound call made before the other checks and reported last. The rebase has to bring that into_validated_draft_responseand its 60s/503 handling.agentProfilesis also now advertised unconditionally. tests/test_capabilities_router.py:127-134overridesasync_enginewith in-memory SQLite for the whole module.async_clientdepends on that fixture, so the 23 existing capabilities tests stop running on the PostgreSQL fixture in CI too. Please limit the override to the new tests or drop it.
On the scoping questions:
- Not superseded. Main's
POST /v1/validatestill checks only schema, model and agent profile, cron floor, event source and types, and sample events. Nothing on main checks credentials, MCP integrations, or repository access. - The bot's merge-order note still applies. SDK 1.51.0, main's pin since #549, still has no
/api/git/validate-repository. OpenHands/software-agent-sdk#4504 and OpenHands/sandbox-server#6 are still open. Until they ship, a client that sendsrequirementsgets a 503 for local drafts with repos and for Cloud drafts whose integrations reach the MCP probe. - Size.
capabilities_router.pygrows from 350 lines on main to about 1,255 here, most of it defensive client code for the Cloud and agent-server endpoints it calls. The tests add about 1,600 lines for 26 new cases. They contain 27 hand-writtenoutboundmock handlers that repeat the same upstream responses, for example/api/v1/git/branches/searchand/api/v1/settings11 times each. Moving preflight into its own module and building the tests on one shared fake upstream would shrink both and address @VascoSch92's readability feedback. This is not blocking on its own.
enyst
left a comment
There was a problem hiding this comment.
I'm an AI agent (Claude, based on Opus 5.5) helping Engel Nyst (@enyst) with project work.
Both items from my last review are fixed: the branch now builds on #541, and the module-wide SQLite engine override is gone.
15884fd introduces one new issue. A failed agent-profile lookup now returns 503 for every request (capabilities_router.py:278), including legacy clients that send no requirements. On main, #541 deliberately leaves the profile unjudged and still returns the other verdicts. This PR rewrites #541's test for that case to expect 503: test_keeps_its_other_verdicts_when_profiles_cannot_be_checked is now test_profile_dependency_failure_is_not_reported_as_a_valid_draft. Please keep #541's behavior when requirements is absent and return 503 only to clients that opt in, or agree the change with #541's author.
Status of the dependencies: OpenHands/software-agent-sdk#4504 and OpenHands/sandbox-server#6 are both still open.
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope: This belongs in this repository — it extends the existing /v1/validate owner (openhands/automation/capabilities_router.py), which is the preflight/capability ownership AGENTS.md assigns here. No maintainer decision is needed.
State re-established on head e8530ea: title and body unchanged, label type: feat, open and mergeable (GitHub reports behind). Head is now a merge of main (7cda26a, 1.19.3) into the feature branch (11 commits, 7 files, +2763/-19). The prior reviewer's two requests are addressed: the branch is rebased onto #541 (agent profiles in cloud mode), the module-wide in-memory SQLite async_engine override is gone, and commit 9cd66f8 restores legacy behavior so an unavailable agent-profile lookup now returns 503 only to clients that send requirements (capabilities_router.py:275-289). Existing reviews are on older commits; there is no review on e8530ea, so this is not a duplicate.
Blocking finding — the module no longer imports
openhands/automation/capabilities_router.py:28 still imports SESSION_COOKIE_NAME from openhands.automation.auth, but the merge with main brought in #568 (fb3f3cb), which replaced that symbol with SESSION_COOKIE_NAMES = ("openhands_auth", "keycloak_auth") plus _extract_session_cookie(). SESSION_COOKIE_NAME is not defined, re-exported, or aliased anywhere in the tree at this head (verified against the raw GitHub content for the head SHA). Importing the router therefore raises ImportError: cannot import name 'SESSION_COOKIE_NAME' from 'openhands.automation.auth', which fails at openhands.automation.app import time. Confirmed locally: uv run python -m pytest tests/test_capabilities_router.py -q aborts during conftest collection with that exact error, so none of the 1657 added test lines run.
The stale symbol is used at line 506 to reconstruct the cookie header:
cookies.append(f"{name}={value}")Beyond the hard failure, this reconstruction is also semantically wrong on current main: #568 deliberately forwards the cookie under its original name (the openhands_auth JWT cookie is preferred over the legacy keycloak_auth), and _extract_session_cookie() returns that name. Hard-coding keycloak_auth here would send the credential back under the wrong cookie name even after the ImportError is resolved. The fix should obtain both the name and the value from _extract_session_cookie(request) (or the SESSION_COOKIE_NAMES loop with the matched name), matching the reader main now uses.
Note this cannot be caught by the checks that ran on this head: Docker, Run tests, and ci all concluded action_required with no jobs, so only the title/description/artifact workflows reported. python -m pytest tests/test_capabilities_router.py -q reproduces the failure immediately after installing dependencies.
The remainder of the head is consistent with the previously approved design (bounded requirements envelope, 60s budget, paginated credential/repo lookup with repeated-token detection, official-host requirement, sanitized 503 mapping, and the fail-closed-only-when-requirements-present profile handling). Clarifying the HUMAN: section would also let the automated description check pass, but that is not the blocker.
🔄 CHANGES REQUESTED
Co-authored-by: openhands <openhands@all-hands.dev>
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Review of 292d106152aaa2241c4174a8831600a5a0d7cfc0
Scope gate: in scope. This is the automation service's own /v1/validate owner plus app.py/schemas.py, which AGENTS.md places here. No repository move or product decision needed.
I re-read the current state: head is still 292d106152aa, title/labels unchanged (type: feat only), the linked issue OpenHands/OpenHands#16565 is open with enhancement + ready-for-dev, and the head's checks (pr-title, Validate PR description, check-pr-artifacts) are green. No review by this account exists on this head, so this is not a duplicate.
The implementation itself is careful: bounded concurrency and deadlines, field-addressable errors, sanitized 503s, secret-name-only requests, and the _errors_to_json(exclude_unset=True) change that keeps saved-draft responses byte-compatible. The previously reported SESSION_COOKIE_NAME breakage is fixed at this head (_extract_session_cookie is imported and SESSION_COOKIE_NAME no longer appears).
However, the new preflight calls two endpoints that do not exist in the versions this repo actually pins, so the feature fails closed on the deployments it targets:
- Local repository preflight posts to
POST {agent_server}/api/git/validate-repository. The released agent server (openhands-agent-server1.55.1 and the newest 1.56.0, which is whatopenhands-workspace==1.55.1pulls in) exposes only/git/repositories/search,/git/changes,/git/diff,/git/commits,/git/commits/{sha}/changes. The route is added only by the still-openOpenHands/software-agent-sdk#4504. Against the pinned dependency the 404 becomes_DependencyUnavailableand the whole validation returns 503, so any local-mode draft with areposentry now fails outright instead of validating. - Cloud MCP preflight posts to
POST {cloud}/api/v1/settings/mcp/{name}/test.OpenHands/sandbox-servermainhas no/settings/mcp/...route (itssettings_routerexposes only'',/agent-schema,/conversation-schema, and/profiles*); the route is added only by the still-openOpenHands/sandbox-server#6. So any Cloud-mode integration requirement returns 503.
This PR does not bump the SDK/agent-server pins (pyproject.toml is untouched) and carries no needs-sdk-release label, even though AGENTS.md and the review guide require tracing new endpoints to their real producer and labeling work that cannot finish until an upstream release ships. Merging as-is would land a validation path that hard-fails with 503 on the current released stack.
Requested: either land the upstream endpoints and bump the pinned openhands-sdk/openhands-workspace (and Cloud server) so these routes exist, or add the needs-sdk-release label and hold until those releases ship. Note also that the Cloud ref check only proves branch names: a draft pinned to a tag or commit returns 501 via repository_ref_unverified, which is a deliberate, documented limitation rather than a defect, so it is not blocking here.
🔄 CHANGES REQUESTED
…utomation-preflight # Conflicts: # openhands/automation/app.py
Why
Automation draft validation currently checks schema, schedules, and event triggers, but it cannot verify the deployment resources a selected automation actually needs. A draft can therefore reach creation with a missing credential, unusable MCP integration, or inaccessible repository.
Related to OpenHands/OpenHands#16565.
Summary
/v1/validateowner with optional, bounded integration requirements while preserving legacy clients that omit them503responses for dependency, transport, rate-limit, pagination, and malformed-response failuresHow to test
python -m pytest tests/test_capabilities_router.py -q— 35 passedpre-commit run --files openhands/automation/schemas.py openhands/automation/capabilities_router.py tests/test_capabilities_router.py— Ruff format/lint, pycodestyle, and Pyright passedThe tests cover successful validation, multiple prerequisite errors, secret-name-only requests, Cloud and local repository checks across later pages, repeated pagination tokens, provider-host validation, total and MCP-specific deadlines, sanitized dependency failures, and malformed requirement bounds.
Companion changes
Jev-Fast-Audit
⚡ Jev fast audit · estimates · 0.33s · commit a1b27cd⚠️ reduced context — partial coverage; 21/24 hunks, 7/7 files (context budget: 21, hunk budget: 3).
Strongest signal: No primary concern selected.
Evidence: No primary concern to locate.
Coverage:
All estimates and evidence