amico cloud: extract the thin cloud client from RemoteExecutor (#460) - #464
Merged
Merged
Conversation
…oteExecutor (#460) The amico-run dissolution's buildable slice (memo note-20260817 §4): the submit→poll→mirror logic leaves RemoteExecutor ONCE and lives in a thin, reusable client, so any agent shell can talk to the solve service without going through the launch path. - src/cloud_client.ts — the client, in two reusable layers: CloudClient (the wire: submit/status/stats/pulse/frames/abort, carrying every documented wire-shape workaround exactly once — {stats}|{iters}, {raw} key=value records, presigned-url frames, 204 lanes) and CloudMirror (the local run-dir mirror: AMICODE_ITER/PULSE run.log delivery with high-water dedup, iter_NNNNN.png frames, FINISHED, the #425 GPU receipt ledger row + receipt.toml at settle). cloudRun() composes them into the full lifecycle and is RemoteExecutor's delegation target — zero behavior change, pinned by the untouched FakeCloud wire-shape tests, executor parity, and the extension suite. - src/cloud_verb.ts — the `amico cloud` verb surface (fleet/pasqal verb pattern, single-line JSON out, deliberately NOT an MCP tool per memo §9): submit (script path or --spec's script_path; problem_spec refused until P6a), status (one poll), mirror (one-shot snapshot into a contract run dir; preflight refuses to mint a run dir for an unknown task), abort (the REQUEST), and run (the composing lifecycle, launch-path exit lanes). Honest one-line failures when cloud.json is absent or the endpoint is unreachable (#423 NXDOMAIN) — the cause is surfaced, not buried. - RemoteExecutor is now the Executor adapter: it validates the submit contract and delegates; EXIT_INFERRED moved to the client with the terminal lanes (re-exported through the package index; the extension's imports are unaffected). The wallclock ladder (explicit > env > 2h) lives once in wallclockCap. - S31: the sanctioned-network-edge exemption moved from remote_executor.ts to cloud_client.ts with the fetches — remote_executor.ts makes no network calls at all now, so it lost the exemption. Receipt accounting (#430) flows unchanged through the extracted settle path — executor runs, verb runs, and one-shot mirrors all emit the pure-spend ledger row. Tests: +42 (cloud_client, cloud_verb, router seam); remote_executor.test.ts assertions untouched (only the relocated EXIT_INFERRED import split).
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughThe change extracts cloud execution into ChangesCloud execution
Estimated code review effort: 4 (Complex) | ~60 minutes Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
aarontrowbridge
marked this pull request as ready for review
August 20, 2026 19:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #460
What this does
The amico-run dissolution's buildable slice (memo
note-20260817§4): the cloud code that lived as inline fetches insideRemoteExecutoris extracted once into a thin, reusable client, and surfaced as anamico cloudverb — so any agent shell can submit → poll → mirror without going through the launch path.RemoteExecutordelegates; zero behavior change.Layout
src/cloud_client.ts— the client, two reusable layers:CloudClient— the wire (submitScript/status/iterLines/pulseLines/frame/abort), carrying every documented wire-shape workaround exactly once:{stats}|{iters}bodies,{raw}key=value stats records, presigned-URL frames (base64 lane kept for older runners), 204 lanes, 401 →ConfigError.CloudMirror— the local run-dir mirror:AMICODE_ITER/AMICODE_PULSErun.log delivery with high-water dedup, atomiciter_NNNNN.pngframes, the run.log-mtime heartbeat,FINISHED, and the Receipt accounting: parse gpu_sku/gpu_seconds/cost_usd into the run ledger; surface in run status #425 GPU receipt (ledger row +receipt.toml) at settle.cloudRun()composes both into the full lifecycle —RemoteExecutor.submit()'s delegation target.src/cloud_verb.ts—amico cloud submit | status | mirror | abort | run(fleet/pasqal verb pattern: single-line JSON,ok/errorsshape, exit 64 on usage/config faults;runuses the launch path's exit lanes 0/130/exit_code). Deliberately not a spine verb — that registry auto-publishes MCP tools, and the memo's working answer (§9) is bash CLI only.remote_executor.ts— now the Executor adapter: validates the submit contract (problem_spec routing, script existence, config, lab), delegates the rest.EXIT_INFERREDmoved to the client with the terminal lanes; the package index re-exports it (extension imports unaffected). The wallclock ladder (explicit > env > 2h) lives once inwallclockCap.remote_executor.tstocloud_client.tswith the fetches; the executor module lost the exemption because it no longer makes network calls.Acceptance criteria
amico cloudexists as a verb — submit (script path or--spec'sscript_path; aproblem_specspec is refused exactly as the executor refuses it, until P6a), status (one poll), mirror (one-shot snapshot into a contract run dir; preflight refuses to mint a run dir for an unknown task). The composingrunfell out cheaply and is included. ZeroRemoteExecutor-private code in any of it.RemoteExecutordelegates with no fetches of its own. No behavior change: the FakeCloud wire-shape tests, executor parity, scheduler, and the extension suites all pass unchanged (only edit: the relocatedEXIT_INFERREDimport split). The slow live smoke is untouched and still skip-gated.cloud run, and one-shotcloud mirrorall emit the GPU receipt accounting: remote runs emit spend rows; ledger gpu sums them (#425) #430 pure-spend ledger row (no fidelity field, by design).fetch failed (getaddrinfo ENOTFOUND …), one line, exit 64, the real cause surfaced rather than buried (Cloud endpoint unresolvable (NXDOMAIN) — the harmoniqsapis.com domain has NO nameservers; HP lane down #423 reality).Notes for the director
amico cloud mirroris one poll pass: a terminal task mirrors completely (Δ4 re-serves full history); a running task yields an honest snapshot with noFINISHEDand a note in the JSON. The manifest'sscript_pathiscloud://<task_id>for one-shot mirrors (run.schema.jsonrequires a non-empty string; the script content lives in the cloud task).amico cloud abortpreflights the channel with one status poll before posting — the abort POST is best-effort by contract and swallows network faults, so without the preflight an unreachable endpoint would report a falseok.remote_executor.test.tsuntouched.test/agent_spawn.test.tsleaks the developer's realOPENCODE_CONFIG_CONTENTinto a child-env assertion — confirmed failing on the clean tree at 845bb53.Summary by CodeRabbit
amico cloudcommand for submitting, monitoring, mirroring, running, and aborting cloud tasks.