compute: add insta compute restart - #157
Conversation
Re-runs the image a compute service already runs, against a freshly resolved env bundle. That indirection is the feature: env is materialized into machine config at deploy time, so a changed secret or binding never reached a running machine without a full redeploy, and `start` no-ops on a machine that is up but wedged. The printed line is purpose-built rather than the shared desired-vs-live one — `running` is a precondition restart enforces, not news it reports. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The platform gates it (insta-platform #310): it changes what the service runs, not whether it is running, so it stands behind the same policy as a deploy. `start`/`stop` stay ungated and still cycle a wedged machine without one, which is what the description now tells the reader to reach for under a deny. The 202 relay needs no code — lifecycle() already routes every answer through handleApproval. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
No issues found across 3 files
You’re at about 91% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
There was a problem hiding this comment.
Reviewed by Yang Dong
This adds the restart operation through the existing lifecycle path, including JSON and approval handling. The implementation is coherent, but the required agent-facing command reference is missing, so I would not merge it as it stands.
The new command is absent from the agent-facing CLI reference
important · judgement · conventions · src/index.ts:231
Coding agents discover the CLI surface through insta/cli-reference.md, so they will not know this command, its approval gate, or its branch and JSON options exist. The repository explicitly requires every command change to update that reference in the same change set; add the restart syntax and behavior to InsForge/insta-skills’s insta/cli-reference.md.
Evidence
read-the-code — src/index.ts:231, AGENTS.md:16, CONTRIBUTING.md:41, .claude/skills/developing-insta-cli/SKILL.md:36
There was a problem hiding this comment.
Reviewed by Wang Miao
This adds insta compute restart [service] alongside the existing lifecycle verbs, extracts the printed line into a pure lifecycleLine so restart can say which image came back instead of echoing a desired_state it enforces as a precondition, and unit-tests that seam. I checked the CLI half against the platform route it calls (POST /projects/:id/services/:id/restart in insta-platform src/server.ts:1852, src/provisioning/services.ts:1267) — path, gating on deploy, the {service, state} 200 shape and the nullable image field all line up, the 202 relay rides the existing handleApproval, and typecheck plus all 660 tests pass locally. No findings; approve.
Declined — the reference is updated, in the repository that holds itThe rule is real and I'm following it. What the finding misses is that It is covered by the companion PR, open alongside this one: InsForge/insta-skills#63, which adds the row at One thing worth flagging rather than leaving implicit, since it is the real risk behind this finding: merge order does not matter here, and that is deliberate. Gate
|
Adds
insta compute restart [service], the CLI half of insta-platform#310 (merged).Why
startcould not do either job a manual restart is wanted for. It no-ops on a machine that is up but wedged, and it cannot land a changed secret — env is baked into machine config at deploy time, soinsta secrets set/bind/unbindnever reached a running machine. The docs' standing answer was "takes effect on the next deploy/redeploy", with no command behind the "redeploy" half.restartre-runs the image reference already recorded on the service against a freshly resolved env bundle. It asks for no new version and no new spec.Surface
Joins
start/stop/suspend/status, and[service]resolves the same way. Gated underdeploy— it lands configuration the way a deploy does — so a project denying deploys denies it, and an approve policy relays through the usual 202.start/stopstay ungated and still cycle a wedged machine without an approval; what that pair cannot do is pick up new configuration.The 202 relay needed no code:
lifecycle()already routes every answer throughhandleApproval.The printed line
restartgets its own wording rather than the shared desired-vs-live one, becauserunningis a precondition it enforces, not news it reports:lifecycleLineis pure and unit-tested, including that the restart line does not echodesired_stateand that it falls back to the resolved service id when an older platform answers without the service object.Verification
npm run typecheck && npm testgreen (660 tests). Also driven end to end against a localdev:fakeplatform with this build: the line above is real output,service.restartappears ininsta events, a stopped service is refused with a pointer toinsta compute startand exit code 1, and--jsonreturns{service, state}.🤖 Generated with Claude Code
Summary by cubic
Adds
insta compute restart [service], which re-runs the image a service already runs against a freshly resolved env bundle. This lets changed secrets or bindings reach a running machine without a full redeploy, and cycles a machine that is up but wedged (startno-ops on one already started).Behavior
deploy, so a project denying deploys denies restart; approval policies relay through the usual 202.start/stopstay ungated and still cycle a wedged machine without approval.insta compute start.runningis a precondition, not news.--jsonreturns{service, state}.Written for commit 7687687. Summary will update on new commits.