Skip to content

Phase 4 idle and wake - #4

Merged
tweinmann merged 6 commits into
phase-3-snapshots-and-queuefrom
phase-4-idle-and-wake
Oct 29, 2026
Merged

tweinmann merged 6 commits into
phase-3-snapshots-and-queuefrom
phase-4-idle-and-wake

Conversation

@tweinmann

Copy link
Copy Markdown
Owner

Phase 4 (v0.4): when a new stack does not fit into the memory budget, siding up first stops other stacks that nobody requested for a while, and a stopped stack has a verdict of its own.

Stacked on #3: the base is phase-3-snapshots-and-queue. Once #3 is merged, change the base to main.

What changed in the plan

The first proposal stopped stacks after a time without requests and woke them on the next request, with Sablier next to the proxy. The spike in task 1.1, against the pinned Traefik v3.7.16, Sablier 1.10.1 and plugin v1.4.0, found:

  • On wake, Sablier ignores Compose's depends_on order.
  • It starts one-off services such as migrations again on every request.
  • The first request after a wake gets a 302 from the plugin, not an answer from the service.
  • The plugin needs the network on every start of the proxy.

The maintainer dropped Sablier, and the change was revised. The spike's results are in the archived design.md.

What siding does now

  • Making room: when a stack does not fit, up stops other running stacks that had no request through the proxy for the idle threshold. It stops the one idle longest first, and only as many as needed to make the new stack fit. It names each stopped stack on stderr. Nothing is removed. --force and setup --idle off skip this.
  • The threshold: 5 minutes by default. siding setup --idle <duration>|off|default changes it. It is kept as the label dev.siding.idle on siding-proxy.
  • Record of requests: the proxy's JSON access log on stdout holds only RouterName and StartUTC, never a URL, header or cookie. json-file logging caps it at 30 MiB. siding reads it through the Engine API, so there is no file of its own and no new container. A proxy from v0.3 keeps no record, so up makes no room until the next siding setup and says so.
  • Verdict Stopped: no container runs, every exit code is one of a stop (0, 137 or 143), and at least one service has a route or a healthcheck. Exit code 2, with the hint siding up --wait. Such a stack is never probed, and status --wait ends on it at once. siding up starts the stack again in Compose's order.
  • Skill: it now names Stopped and how to start the stack again, says that siding status --json holds the stack's url, and says never to give localhost:<port> from the compose file.

Specs

  • New: idle-stop.
  • Updated: agent-skill, cli-contract, dev-environment, memory-budget, proxy, stack-status.
  • The change is archived as openspec/changes/archive/2026-10-29-phase-4-idle-and-wake.

Verification

  • just test: gofmt, vet, go test -race, golangci-lint (0 issues), openspec validate --all --strict.
  • just smoke-stacks: a new end-to-end test makes room with --idle 10s and a small budget. It checks that the stopped stack reports Stopped, that a request to it answers 404, that the proxy's record holds no path or token, and that up --wait makes the stack Ready again with its data.
  • By hand: in the devcontainer, and on macOS with Docker Desktop (arm64) through bin/mac-test/run.sh, with 15 of 15 checks passing.

🤖 Generated with Claude Code

tweinmann and others added 6 commits October 29, 2026 15:41
siding status --json gives the stack's url without a restart, and the
agent never gives localhost:<port> from the compose file, because
siding publishes no ports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Idle stop with Sablier next to siding-proxy, opt-in with setup --idle,
the verdict Idle, making room under memory pressure from stacks idle for
5 minutes, and the agent skill's address hints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sablier ignores depends_on on wake, starts one-off services on every
request and needs the network on every proxy start. Phase 4 now makes
room under memory pressure by stopping stacks without a request for the
idle threshold, reports them as Stopped, and starts them again with
siding up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a new stack does not fit into the budget, up stops other stacks
that had no request through the proxy for the idle threshold (5m,
setup --idle), longest idle first, and only when that makes it fit.
The proxy records router and time per request in its container log.
A stopped stack reports the verdict Stopped (exit 2) and is started
again by siding up. The skill teaches Stopped, the address from
status, and never localhost:<port>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New spec idle-stop; agent-skill, cli-contract, dev-environment,
memory-budget, proxy and stack-status updated. The skill requirement is
split in two to stay within the length strict validation allows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tweinmann
tweinmann added this pull request to stack #5 October 29, 2026 19:48
@tweinmann
tweinmann merged commit 3e728b1 into main Oct 29, 2026
4 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.

1 participant