Repository navigation
feat: let PATCH change a preset automation's repositories - #625
Conversation
|
@OpenHands /codereview-roasted Review exactly commit 9bdb37e. 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: 9bdb37e Use VERDICT: CHANGES_REQUESTED instead when findings require changes. If unable to review, explain the blocker without an approval verdict. |
|
I'm on it! ak684 can track my progress at all-hands.dev |
|
Warning Your comment is too long (maximum is 65536 characters), so the coverage report was not added. See the job log for how to reduce it. |
|
Reviewed commit Taste: good. Focused, minimal change that reuses the existing preset-tarball regeneration machinery instead of inventing new plumbing. Correctness — traced end to end:
Regression coverage — solid. The new PATCH tests exercise real tarfile manipulation and a stateful in-memory store (byte-for-byte assertions on the rebuilt tarballs, Validation vs evidence — locally I ran the full suite ( No material findings. [RISK ASSESSMENT] LOW — server-side, additive API surface; no new credentials, paths, or lifecycle transitions; the destructive tarball rewrite reuses the pre-existing, transaction-scoped regeneration path. REVIEWED_HEAD: 9bdb37e |
|
The PR head is unchanged from the reviewed commit, and the review has been posted. Review summary: I reviewed PR #625 ("feat: let PATCH change a preset automation's repositories") at commit Key findings from my review (verdict: APPROVED): Correctness — The change is focused and reuses existing machinery:
Regression coverage — solid: the new PATCH tests exercise real tarfile manipulation and byte-for-byte rebuilt-tarball assertions. The "10 of 12 fail on main" claim checks out (the two passing on main are the 403 and invalid-repo cases validated before the new path). Validation vs. evidence — I ran the full suite locally: 2130 passed, 7 skipped, 1 failed ( The review ends with the required verification lines: No code changes were made — the task was review-only, as requested. |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Reviewed head 9bdb37e7158636bc34f4817be2141ecc1ddba509 (base main @ 77dd60e). The PR head matches the review request; the PR is open, labelled type: feat, and the linked issue OpenHands/OpenHands#18775 is open with bug + ready-for-dev.
Scope gate — passes. This changes the automation service's own PATCH/preset contract (tarball regeneration, preset_metadata, capabilities). That is this repository's ownership per AGENTS.md and .agents/skills/custom-codereview-guide.md; the Canvas-side read/edit of repositories correctly lives in OpenHands/OpenHands#18776.
Correctness — no material findings. I traced the changed path end to end:
reposis accepted onUpdateAutomationRequestwith the sameRepoSourceentries and the same single-item normalization as preset creation. I compared validation of create vs update forhttp://(upgraded tohttps://), shortowner/repowithoutprovider(422),ftp://(422),git@…and list/object forms — they agree.reposis popped fromupdate_databefore thesetattrloop, so no non-column attribute is written; the preset-type gate (prompt/plugin only) raises 422 before anything is applied.- Prompt and repo edits in one request produce one
regenerate_preset_tarballcall (filesdrives a single rebuild).repos_config.jsonis added when absent and removed (not written empty) when the list is emptied; sibling members are copied through. - Unchanged list rebuilds nothing, and the "changed" comparison is shape-consistent with creation (
dump_repos/model_dump(exclude_none=True)on both sides). - A repo change whose tarball cannot be rebuilt raises 422 with the metadata untouched, so
preset_metadata.reposcan never claim a checkout the run will not make. Prompt-only edits keep their existing graceful no-op. - Authorization is unchanged and correct:
_assert_can_manageplus_assert_can_update_fieldsreject a non-creator's repo edit with 403 before the new path is reached. - The old upload is soft-deleted in the transaction and its object removed only via
background_tasksafter commit, matching the pre-existing regeneration contract (no new partial-write or stranded-object window).
Verification. Docker is not available in this environment, so I could not run the container-backed PostgreSQL fixture. I ran the suite against a SQLite-backed copy of the harness (tracked files untouched):
- The 12 new
PATCHtests: 12 passed. - The same 12 tests against
main@77dd60e: 10 failed, 2 passed — the PR's "10 of 12 fail on main" claim checks out (the two passing are the 403 and invalid-repo cases, rejected before the new path). tests/test_router.py,test_capabilities_router.py,test_schemas.py,test_openapi.py,test_route_permissions.py,test_preset_router.py,test_draft_router.py,test_tarball_validation.py,test_uploads.py,test_disable_automation.py,test_git_sync_serializer.py,test_verify_automation_skill.py: all passed. Note the new tests exercise router/file-store logic, not PostgreSQL-specific behavior.ruff checkandruff format --checkon the changed files: clean.map checkandmap coveragefor the verify-automation skill: clean.- Current CI for this head is green (
unit-tests,backend,Build and Push Automation Image,check-pr-artifacts,pr-title);cleanup-after-mergeis skipped as expected.
Non-blocking. Adding repoUpdate to _STATIC_FEATURES leaves the verify-automation feature map's exact-list assertion in F03-capabilities-and-validate.md stale (it does not include the new feature). Per references/maintenance.md, map corrections ship in their own maintenance PR rather than with the product change, so this does not block; worth folding into the next maintenance pass.
No material correctness, security, compatibility, or acceptance-criterion defect found on this head. Issue #18775's service-side acceptance criteria (repository updates persist; unsupported automations are refused rather than silently discarding the change; an unchanged list is left alone) are met.
✅ APPROVED
|
🚀 Released in 1.24.0. |
Prompt and plugin preset automations keep their repositories in the preset package (
repos_config.json) and inpreset_metadata.repos, butPATCH /v1/{automation_id}could not change them, so they were fixed when the automation was created. Agent Canvas's editor therefore could not save repository changes (OpenHands/OpenHands#18775).PATCHnow acceptsrepos, with the same entries as preset creation, for prompt and plugin presets:nullremoves them.repos_config.json, in one rebuild with any prompt change in the same request, andpreset_metadata.reposis updated. An unchanged list rebuilds nothing.repoUpdatefeature, so clients offer repository edits only where the service supports them.Tests:
uv run pyteston77dd60e: 2122 passed, 7 skipped. The GCS storage integration test was excluded because its emulator image could not be pulled here. 10 of the 12 newPATCHtests fail onmain.Recording: Agent Canvas running this branch's service together with the matching Canvas change. An automation created with
OpenHands/docsgainsOpenHands/extensionsin Edit, and both are still there after Save, Close and reopening. The automation's downloaded package then lists both repositories inrepos_config.json.On an OpenHands Enterprise test install running this branch's image (
automation:sha-9bdb37e) with Agent Canvas from OpenHands/OpenHands#18776, capabilities listrepoUpdate. In Edit, adding a second repository and saving, then removing the first and saving again, updated the automation's saved repositories each time, and reopening Edit showed the same list.