Skip to content

compute: add insta compute restart - #157

Merged
Fermionic-Lyu merged 2 commits into
mainfrom
feat/compute-restart
Aug 28, 2026
Merged

compute: add insta compute restart#157
Fermionic-Lyu merged 2 commits into
mainfrom
feat/compute-restart

Conversation

@Fermionic-Lyu

@Fermionic-Lyu Fermionic-Lyu commented Aug 28, 2026

Copy link
Copy Markdown
Member

Adds insta compute restart [service], the CLI half of insta-platform#310 (merged).

Why

start could 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, so insta secrets set / bind / unbind never reached a running machine. The docs' standing answer was "takes effect on the next deploy/redeploy", with no command behind the "redeploy" half.

restart re-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

insta compute restart [service] [--branch <b>] [--json]

Joins start/stop/suspend/status, and [service] resolves the same way. Gated under deploy — 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/stop stay 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 through handleApproval.

The printed line

restart gets its own wording rather than the shared desired-vs-live one, because running is a precondition it enforces, not news it reports:

restarted compute api on nginx:1.27 — env re-resolved from the current secrets (live: running)

lifecycleLine is pure and unit-tested, including that the restart line does not echo desired_state and that it falls back to the resolved service id when an older platform answers without the service object.

Verification

npm run typecheck && npm test green (660 tests). Also driven end to end against a local dev:fake platform with this build: the line above is real output, service.restart appears in insta events, a stopped service is refused with a pointer to insta compute start and exit code 1, and --json returns {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 (start no-ops on one already started).

Behavior

  • Gated under deploy, so a project denying deploys denies restart; approval policies relay through the usual 202.
  • start/stop stay ungated and still cycle a wedged machine without approval.
  • Refuses stopped or suspended services with a pointer to insta compute start.
  • Prints a restart-specific line instead of the shared desired-vs-live line, since running is a precondition, not news.
  • --json returns {service, state}.

Written for commit 7687687. Summary will update on new commits.

Review in cubic

Fermionic-Lyu and others added 2 commits August 27, 2026 23:51
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>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Re-trigger cubic

@agent-zhang-beihai agent-zhang-beihai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-codesrc/index.ts:231, AGENTS.md:16, CONTRIBUTING.md:41, .claude/skills/developing-insta-cli/SKILL.md:36

@agent-zhang-beihai agent-zhang-beihai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Fermionic-Lyu

Copy link
Copy Markdown
Member Author

Declined — the reference is updated, in the repository that holds it

The rule is real and I'm following it. What the finding misses is that insta/cli-reference.md is not in this repository: AGENTS.md:16 names it as skills/insta/cli-reference.md (superproject skills/ submodule), i.e. InsForge/insta-skills. Nothing in this repo can contain that edit — find . -name cli-reference.md returns nothing here.

It is covered by the companion PR, open alongside this one: InsForge/insta-skills#63, which adds the row at insta/cli-reference.md:51 with the syntax, both options, the deploy gate and the refusals — plus the operate.md section and the governance.md policy row. That is the same change set the rule asks for, spread across repositories the way the rule itself describes.

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. insta setup agent installs the skill from the insta-skills default branch, so if the doc landed first it would reach every agent while the published CLI is still 0.0.49. That is why the row carries (CLI ≥ 0.0.50), the gate this reference already uses for four other rows. An agent on an older build is told what it needs instead of getting commander's unknown-command error.

Gate

npm run typecheck && npm test green on 7687687 (660 tests). CI green. Also driven end to end against a local dev:fake platform: the output line, the service.restart event, the stopped-service refusal with exit code 1, and the --json shape.

@jwfing jwfing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - approved.

@Fermionic-Lyu
Fermionic-Lyu merged commit f0ac75c into main Aug 28, 2026
3 checks passed
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