Skip to content

fix(acq): refuse incompatible SBX provisioning before create - #691

Draft
mogul wants to merge 3 commits into
mainfrom
fix/690-sbx-v3-preflight
Draft

mogul wants to merge 3 commits into
mainfrom
fix/690-sbx-v3-preflight

Conversation

@mogul

@mogul mogul commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

🤖: AI agent (First Mate), AI-assisted change (OpenCode), posting on behalf of @mogul. Human review required before merge.

Summary

Fail early when creating a sandbox with sbx 0.51.0 or later. That release resolves its shell agent as a v3 kit and rejects composition with acq's v1/v2 kits. Existing-sandbox commands are not blocked. This is a temporary compatibility guard, not a v3 migration.

Issues

Before / After

Before: acq create passes v1/v2 kits to sbx 0.51.0, which fails with a raw kit-composition error. After: fresh create fails before sandbox creation with an explanation and --backend msb fallback. Reattach and existing-sandbox operations retain the normal version-floor guard. Unknown version output also blocks fresh create rather than risking the incompatible path.

Verification

  • bash -n acq acq.backends/sbx.sh: PASS.
  • git diff --check: PASS.
  • ACQ_BATS_JOBS=1 ./scripts/test-acq-bats test/bats/70-msb-backend.bats test/bats/30-dispatch-routing.bats test/bats/100-kit-translate.bats test/bats/101-sbx-grammar-acceptance.bats: 84 pass, 3 explicit SKIP (no real sbx installed), 0 fail.
  • shellcheck --severity=warning acq.backends/sbx.sh test/bats/70-msb-backend.bats: PASS. Full acq ShellCheck reports two pre-existing SC2034 warnings at lines 38–39, identical on the parent commit.
  • Independent blocker-only adversarial review: no blockers after fixing its two findings (existing-sandbox reattach and unknown-version handling). Re-review: no blockers.
  • Real sbx 0.51.0: NOT RUN here; original failure was observed in the maintainer's live run. CI is pending.

Merge Guard

Current-head CI and human review. This change deliberately leaves #690 open; SBX 0.51+ remains unsupported for new acq sandboxes.

Rollback

Revert this commit if a verified compatible sbx composition path is delivered, after testing its create and reattach flows.

Security Impact

Fail-closed provisioning for unknown/incompatible SBX versions; no change to credentials, kit content or existing-sandbox flows.

Reject fresh sandbox creation with sbx 0.51+ until its v3 shell kit can compose with acq v1/v2 kits. Keep existing-sandbox operations available and explain the MSB fallback.

@wz-gsa wz-gsa 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.

P2 — Avoid repeating MSB host preparation on fresh agent-form runs. acq:1407 adds acq_backend_prepare create after acq_backend_prepare already ran at line 1319. This executes for both backends; MSB ignores the new argument and repeats its readiness/doctor path. On an unfit host, acq.backends/msb.sh:862–881 can repeat msb doctor --fix and failure advisories. Keep the fresh-create compatibility check separate from host preparation, or otherwise preserve one MSB preparation call. Add a fresh-run test asserting doctor/fix counts and no provisioning side effects when the SBX ceiling rejects the run.

Nit — Refresh the adapter contract comment. acq.backends/sbx.sh:136–140 and docs/adr/0032-msb-version-policy-and-migration-recovery.md:180–181 still say SBX check_version and prepare do identical work. Document the optional fresh-create ceiling.

AI-assisted independent full-diff review of #691 at 3247e79d002e249e4a779f9e5cc69de53ffa1315, with primary source-byte and control-flow corroboration. Reported CI is green; no live host preparation or SBX provisioning was executed for this review.

Move the sbx >=0.51 / unparseable-version gate out of acq_backend_prepare into the optional
acq_backend_check_create_compat hook, so msb host preparation (doctor --fix) runs once.

Co-authored-by: OpenCode Agent <user@gsa.gov>
@mogul

mogul commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

🤖: AI agent (First Mate), posting on behalf of @mogul. Human review required before merge.

Addressed the P2 in ba6f8e2 (plus a plain git merge origin/main, no rebase/force):

  • Removed the second acq_backend_prepare create. acq_backend_prepare is back to the plain version floor on sbx.
  • The sbx >=0.51 / unparseable-version gate is now the optional adapter hook acq_backend_check_create_compat (sbx only). acq calls it via acq_backend_guard_create_compat (command -v guarded) at the two fresh-create points only: create after its prepare, and the run agent-form else-branch. msb defines no hook, so msb doctor --fix and its advisories run once.
  • Reattach and github-scope paths and message text are unchanged.
  • Refreshed the sbx.sh adapter-contract comment and ADR-0032; KNOWN_FAILURE_MODES 53 needed no change.

Tests (70-msb-backend.bats): existing tests renamed to the new hook; added fresh agent-form run and create on an unfit msb asserting doctor --fix exactly once, and sbx 0.51 fresh run/create rejected before any sbx create. The agent-form msb test failed on the prior head. The new sbx test and the msb create test passed on it, since the old gate was already effective there.
Bats 70/30/100/101: 90 tests, 0 failures. Shellcheck shows only the two pre-existing SC2034 warnings in acq.

@mogul
mogul requested a review from wz-gsa November 12, 2026 20:17
@mogul
mogul disabled auto-merge November 13, 2026 08:03
@mogul
mogul marked this pull request as draft November 13, 2026 08:04
@mogul

mogul commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Converting to draft since we have a workaround that will work with newer versions of sbx pending.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants