Skip to content

[codex] Stabilize serverless sleep wake transitions#104

Merged
arjunkomath merged 1 commit into
mainfrom
feat/serverless-wake-stabilization
Jul 6, 2026
Merged

[codex] Stabilize serverless sleep wake transitions#104
arjunkomath merged 1 commit into
mainfrom
feat/serverless-wake-stabilization

Conversation

@arjunkomath

Copy link
Copy Markdown
Member

Summary

Stabilizes serverless sleep/wake handling across the agent and control plane.

  • adds transition IDs and CP ACKs so the agent only clears serverless sleep/wake reports after the CP applies or explicitly rejects them
  • keeps reconcile guards active until expected state reflects the accepted transition
  • gates gateway wake readiness on a TCP connection to the local upstream instead of only container running state
  • repairs the observed incident state where a serverless deployment is desired running but stuck with stale observed_phase=stopped while the agent reports the container running

Root Cause

The agent treated HTTP 200 from status reporting as proof that a serverless transition was applied. The CP could reject a sleep transition because the deployment was outside its sleepable state window, but the agent still cleared its guard. Reconcile would then restart the stopped container, the idle timer would fire again, and the system could flap.

A second issue made wakes look ready before the app port accepted connections. The gateway considered a running container ready when there was no health check, which could produce early 502/503 responses.

The DB query for the live service showed the concrete wedge was runtime_desired_state=running with stale observed_phase=stopped, not a failed/autoheal variant. The reducer now repairs that narrow serverless state when a live running report proves the container is up.

Validation

  • pnpm exec tsc --noEmit
  • pnpm test
  • go test ./...

@arjunkomath arjunkomath force-pushed the feat/serverless-wake-stabilization branch from 7ceb783 to 3c6accf Compare July 6, 2026 14:15
@arjunkomath arjunkomath force-pushed the feat/serverless-wake-stabilization branch from 3c6accf to d2e8bec Compare July 6, 2026 14:18
@arjunkomath arjunkomath marked this pull request as ready for review July 6, 2026 14:18
@arjunkomath arjunkomath merged commit 58561a5 into main Jul 6, 2026
11 checks passed
@arjunkomath arjunkomath deleted the feat/serverless-wake-stabilization branch July 6, 2026 14:22
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