fix(engine): gate the experimental cloud engine behind an opt-in (#966) - #1099
Conversation
E2B cloud execution is out of launch scope and does not work end to end, but it was listed next to the engines that do and was reachable with a plain `--engine cloud`. Rather than fix a non-launch feature, put it behind CODEFRAME_ENABLE_CLOUD_ENGINE=1 and take it off the advertised surface. - resolve_engine and get_external_adapter both refuse it, so CODEFRAME_ENGINE=cloud is not a way around the flag. The message names the variable, so it is a gate and not a dead end. - ADVERTISED_ENGINES drives the "supported engines" list; cloud stays in VALID_ENGINES so a refusal is specific rather than "unknown engine". - The CLI resolves the engine in the existing pre-run validation block (single-run and batch) — the gate raises inside execute_agent, which runs after the run record exists, and would otherwise strand an IN_PROGRESS run. - --engine help and the worked examples no longer offer it; the IsolationLevel.CLOUD error no longer points at it as a supported route. The five known E2B defects are recorded in CLAUDE.md as the checklist for lifting the gate. They are deliberately NOT fixed here: the point of the issue is that a broken non-launch feature should be unreachable, not repaired.
codex review [P2]: the execution path was gated but the two lists a user actually reads still offered it — `cf engines list` iterated VALID_ENGINES, and EnvironmentConfig.validate suggested it as a fix for a bad `engine:`. `cf engines list` now lists ADVERTISED_ENGINES, adding cloud only when opted in and labelling it EXPERIMENTAL so it never blends in with the engines that work. Config validation still accepts any VALID_ENGINES member (a gated engine is a known name, not a typo) but suggests only the advertised set. test_all_valid_engines_resolve opts in rather than dropping cloud, so it still covers every valid engine.
AC2 covers docs, not just CLI help. CLAUDE.md's "What's implemented" and the roadmap's Phase 4.A–4.D "all complete" both counted E2B cloud execution among the working features. Both now say it is experimental and gated.
Precision bug-hunting review in progress
|
ReviewReviewed the diff ( SummarySolid, well-scoped gate. The design does what the description claims:
Minor, non-blocking observations
Neither point blocks merge — the core gating logic, its placement, and the test coverage are all solid. |
codex review [P3]: `cf engines check <typo>` built its message from VALID_ENGINES, so cloud was still offered as a valid option — the fourth user-facing list, after --engine help, `cf engines list` and the config validator. The previous commit fixed three of them by hand, which is how the fourth survived. `suggestable_engines()` is now the single source: absent by default, present once opted into. All four sites call it, so they cannot drift apart again. A test asserts they agree. Also fixes an asymmetry the shared helper exposed: resolve_engine's invalid-engine message omitted cloud even when the caller HAD opted in.
Third-party review —
|
|
Claude finished @frankbria's task in 4m 55s —— View job Precision bug-hunting review — ✅ no defects foundReviewed the full diff plus surrounding code in No new concrete defects introduced by this PR. The gate is correct and the defense-in-depth is real:
Already covered by prior review (not re-posted): the Checklist:
|
Review (commit b63cdff, latest push)Re-reviewed the full diff including the two What I re-verified
Still outstanding (non-blocking, carried over from the earlier review)
No new defects found in the latest commits. The gate placement, defense-in-depth ( |
Demo — acceptance criteria → outcome evidenceAC1 — rejected unless opted in; message says experimental and unsupportedOutcome, not just the message:
AC2 — reachable with the opt-inAnd the real adapter is constructed, not stubbed: AC2 (cont.) — off every advertised listSame for AC3 — known-limitations checklist
AC4 — tests36 tests in Deliberate deviation on
|
Two non-blocking items from the claude-review bot, both real: - `cf work batch run --dry-run --engine cloud` returned before the gate check, so it printed a "here is what will run" preview for an engine that would be refused. Moved the check ahead of the dry-run return — it doubles as the pre-run guard for conductor.start_batch. - CHANGELOG had no [Unreleased] entry despite this breaking existing `--engine cloud` invocations. Added under Changed, with the upgrade note (set the env var) stated plainly.
|
Both carried-over items from the review are now fixed in fdd0f5a — neither was blocking, but both were real.
No CHANGELOG entry. Correct, and it matters more than usual here: this breaks existing Re-running the full backend gate on the final commit. |
|
Claude finished @frankbria's task in 4m 33s —— View job Precision bug-hunting review — ✅ no defects foundReviewed the full diff (including the latest push: batch dry-run gate + CHANGELOG) plus surrounding code in No concrete defects introduced by this PR — including the latest commit. The gate is correct and defense-in-depth holds on every path I traced:
Items the prior reviews flagged are resolved in the latest commits (batch Checklist:
|
Review (final commit 00a5178)Re-checked the final state after the batch dry-run fix and CHANGELOG addition, on top of my two earlier passes (05:14, 05:17) and the independent findings from
No new defects. This is consistent with the prior reviews: the gate is correctly placed with real defense-in-depth, the dangling-run fix is sound, and the two non-blocking follow-ups from earlier passes are now closed out. |

Closes #966.
E2B cloud execution is out of launch scope and does not work end to end, but it was listed next to the engines that do and was reachable with a plain
--engine cloud. Per the issue, this gates it rather than fixing it — the five PARKED defects are deliberately untouched and recorded as the checklist for lifting the gate.The gate
CODEFRAME_ENABLE_CLOUD_ENGINE=1unlocks it. Closed by default:Both
resolve_engineandget_external_adapterrefuse it, soCODEFRAME_ENGINE=cloudis not a way around the flag. The message names the variable — a gate, not a dead end.cloudstays inVALID_ENGINESso the refusal is specific rather than a generic "unknown engine"; the newADVERTISED_ENGINESset drives what gets offered.The gate is also checked before any run record is created.
resolve_engineruns insideexecute_agent, which the CLI reaches afterstart_task_run— refusing there alone stranded anIN_PROGRESSrun, the exact failure the neighbouring "validate API key before creating run record" block exists to prevent. Both the single-run and batch CLI paths now resolve the engine in that pre-run block. A test pins it by assertingget_latest_run(...) is None.Off the advertised surface
Five places, not one:
--enginehelp (×2)cloud--engine cloud --cloud-timeout 45cf engines listVALID_ENGINESADVERTISED_ENGINES; opted-in it appears asexternal, EXPERIMENTALEnvironmentConfig.validatecloudfor a typo'd engineIsolationLevel.CLOUDis a separate thing and stays unimplemented; its error no longer points at--engine cloudas a supported route.Known-limitations note (AC3)
CLAUDE.md→CODEFRAME_ENABLE_CLOUD_ENGINErecords the five parked defects as a numbered lift-the-gate checklist: thepip install codeframe/codeframe-aipackage-name bug, unhandledCommandExitException, broken sync-back, unbatched upload, and non-autospec mocks that make every failure branch dead code under a green suite. A test asserts the note names them, so it cannot silently drift.Verification
tests/core/test_cloud_engine_gate_966.py— closed by default (incl. the env-var route andget_adapter/get_external_adapterdefence in depth), open with the opt-in (5 truthy / 5 falsy values), absent from each advertised surface, no run record on refusal._reject_cloud_unless_enabledfails 9 tests; removing the CLI pre-run check fails the dangling-run test with a liveRUNNINGrecord.pytest tests/ --ignore=tests/e2e -m "not lifecycle"→ 6085 passed, 49 skipped, 0 failed (16m07s), run withenv -u DATABASE_PATH -u CODEFRAME_AUTH_REQUIRED -u ANTHROPIC_API_KEY -u AUTH_SECRET -u OPENAI_API_KEYto mirror CI's ambient environment.ruff checkclean.codex review --base mainraised one [P2] — the execution path was gated butcf engines listand the config validator still offered it. Verified against the running CLI (cloud was visible in the table) and fixed in 6dba19f.Three pre-existing tests were adjusted rather than weakened: two E2B registry tests and
test_all_valid_engines_resolvenow set the opt-in, so they still cover the cloud path instead of dropping it.Known limitations
check_requirements("cloud")is still callable directly. It reports env-var presence and creates nothing, andcf engines listno longer surfaces it; gating a pure predicate would break the opted-in list rendering for no safety gain.