[P0] default Code runtime to Cloud (CLI audit P0-1) - #49
Conversation
Fresh installs were This PC by default, so ensure_session refused every first turn. Cloud is now the default; This PC and SSH require CORTEX_COMPUTER (or CORTEX_SSH_HOST) and a connected session. Co-authored-by: Mathis <echobt@users.noreply.github.com>
Co-authored-by: Mathis <echobt@users.noreply.github.com>
Co-authored-by: Mathis <echobt@users.noreply.github.com>
Designer Q9 / CLI_100_CHROME_LOCK_SIGNED: Cloud is the product default for TUI and exec; This PC/SSH stay explicit 0.1.x opt-in. Co-authored-by: Mathis <echobt@users.noreply.github.com>
code_agent.rs grew past the 1000-line regression cap. Move ComputerKind into client/computer.rs and drop uncovered debug-config env rows. Co-authored-by: Mathis <echobt@users.noreply.github.com>
Greptile SummarySummaryThis change has two blocking runtime-selection problems: an invalid explicit runtime can create a Cloud session, and a cached Cloud session can continue receiving turns after the user explicitly selects This PC or SSH. The disconnected SSH recovery message also gives incomplete instructions for returning to Cloud. Merge safetyNot safe to merge until runtime selection rejects invalid explicit values and cached sessions are checked against the currently selected runtime. The SSH recovery wording should also be corrected so operators can successfully follow it. Confidence Score: 2/5Do not merge until explicit runtime changes cannot be bypassed by cached Cloud sessions and invalid runtime configuration fails clearly. Two reproduced runtime-routing failures can send turns to Cloud despite an explicit non-Cloud choice or invalid configuration. A separate reproduced recovery-message issue prevents SSH users from reaching Cloud by following the displayed instructions. Files Needing Attention: src/cortex-engine/src/client/computer.rs needs invalid-value handling and corrected recovery instructions; src/cortex-engine/src/client/code_agent.rs needs cached-session runtime compatibility validation.
|
| match normalized.as_str() { | ||
| "this_pc" | "thispc" | "local" | "paired" | "connected" => Self::ThisPc, | ||
| "ssh" => Self::Ssh, | ||
| _ => Self::Cloud, |
There was a problem hiding this comment.
If an operator sets a nonempty but misspelled CORTEX_COMPUTER value, this fallback selects Cloud rather than reporting invalid configuration. The client then creates a Cloud session, so work intended for a local runtime can be sent remotely without warning. Distinguish an unset or empty value from an unknown explicit value and reject the latter.
How this was verified: An isolated recording service observed CORTEX_COMPUTER=typoed-runtime select Cloud and create a session with {"runtime":"cloud"}.
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| /// This PC and SSH need a bound host session. Cloud is never substituted. | ||
| pub const DISCONNECTED_RUNTIME: &str = "This PC and SSH Code execution require an already connected Code session. Connect a host and resume that session, or leave CORTEX_COMPUTER unset to use Cloud. No runtime was substituted."; |
There was a problem hiding this comment.
The disconnected-runtime message says that leaving CORTEX_COMPUTER unset selects Cloud, but CORTEX_SSH_HOST and CORTEX_SSH_TARGET take precedence. A user who retains either SSH setting follows this instruction, remains on SSH, and receives the same refusal again. Tell users to clear or disable the SSH selectors as well before using Cloud. This is a non-blocking usability concern that leaves the documented recovery path unusable for SSH-configured users.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Artifacts
- Authored Rust integration test used for the targeted check.
- Shell script that installed and ran the repro under the specified environment.
- Captured command, environment values, selected runtime, recovery error, test result, and exit code.
- Authored Rust integration test used for the targeted check.
- Shell script that installed and ran the repro under the specified environment.
- Captured command, environment values, selected runtime, recovery error, test result, and exit code.
Summary
Fixes CLI audit P0-1 (
CLI_100_AUDIT_READY, author echobt). Designer cli signedCLI_100_CHROME_LOCK_SIGNEDand answered Q9: Cloud is the shipped default for the TUI andcortex exec; This PC and SSH are explicit opt-in and may ship in 0.1.x.A fresh install was This PC by default, so
ensure_session()refused every first turn. Cortex CLI / Cortex Code now defaults the Code runtime to Cloud. This PC/SSH requireCORTEX_COMPUTER(orCORTEX_SSH_HOST/CORTEX_SSH_TARGET) and an already connected session — Cloud is never substituted. No TUI chrome change.Head SHA:
41d8112381ba471895468ce1b64421385dd783d5Test plan
cargo fmt --all -- --checkcargo clippy -p cortex-engine -p cortex-cli -p cortex-tui --all-targetswith the workspace-D warningsallowlistcargo test -p cortex-engine --lib client::(ComputerKind +ensure_sessionproduct copy)cargo test -p cortex-engine --test runtime_contract_client(default CloudPOST /v1/code/sessionsruntime: cloud)cargo test -p cortex-cli --test exec_runtimecargo test -p cortex-tui --lib first_submit_uses_cloudcode_agent.rssplit so it no longer worsens the 1000-line regression (computer.rsis new and under the cap)debug config --envrows (runtime vars stay indocs/configuration/env.md)cargo audit— not re-run; no dependency changeapi.cortex.foundationturnAttestation (required)
I attest that:
DISCONNECTED_RUNTIME. API-down paths still say The coding service is temporarily unavailable. No raw provider, SDK, or transport names.tui_code_turn_context()(Cloud viadetect()). No chrome or lock frames edited.CORTEX_COMPUTER) creates a Cloud session on a loopback mock; This PC/SSH without a session refuse with product copy; TUI first submit is Cloud unless explicit opt-in..envfiles are included.Risk
Code-session create now proceeds on a fresh install (Cloud). Operators who relied on the undocumented This PC default must set
CORTEX_COMPUTER=this_pc. This PC/SSH pairing stays available as opt-in in 0.1.x. No sandbox change.