Skip to content

feat(agent): agent-ready exec probe over a pod-local health socket (proposal 041) - #1156

Merged
bpalermo merged 1 commit into
mainfrom
feat/041-agent-ready
Oct 3, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/041-agent-ready

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Refs #1123. Part 2 of 4 of proposal 041. Stack: #1155 ← this PR ← chart ← e2e gate. Base: feat/041-agent-standby.

Why

The agent pod is hostNetwork, so its TCP probe port (8082) is a node port:

  • a surge pod declaring it stays Pending (the scheduler's NodePorts filter);
  • the process could not bind it anyway;
  • a port shared with SO_REUSEPORT would let the other agent answer the kubelet for this one.

What

Agent.

  • --health-socket serves /healthz and /readyz on a Unix socket in the pod's own /tmp emptyDir.
  • The readiness checks are the agent's own aggregate (the standby gate among them) plus the manager's ping and cache-sync, so the socket gate is no weaker than the TCP one.
  • --health-probe-bind-address exposes the TCP address; 0 turns it off.
  • Both default to today's behaviour (no socket, TCP :8082), so a chart that predates this works against the new image.

agent/cmd/agent-ready, the exec probe (open question 2):

  • It writes one HTTP/1.0 request by hand and reads the status line, so it links neither net/http nor anything outside the standard library.
  • On failure it prints the ?verbose body, so the kubelet's probe event names the failing check.
  • //agent/cmd/agent-ready:deps_test asserts that the linked ELF's build info lists no module at all. It also checks the main path, so a vacuous pass is impossible, plus an 8 MiB ceiling.

Image. The agent image ships it as /agent-ready (image_test asserts it).

Tests

  • agent-ready_test:
    • 200 vs 500 (the failing check named);
    • the liveness path;
    • a missing socket;
    • a server that never answers (bounded);
    • real exit codes via a subprocess;
    • the default socket pinned to constants.DefaultAgentHealthSocketPath.
  • healthsock_test:
    • the mux over a real socket;
    • stale socket replacement;
    • the baseline checks are present.
  • --config=race on //agent/cmd/agent-ready:all //agent/internal/cmd:all: pass. //agent/cmd/agent:image_test: pass. Lint clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…roposal 041)

The agent pod is hostNetwork, so its TCP probe port (8082) is a node port: a
surge-rolled standby could neither declare it (hostPort collision keeps the pod
Pending) nor bind it, and a port shared with SO_REUSEPORT would let the other
agent answer the kubelet for this one.

- agent: --health-socket serves /healthz and /readyz (the agent's readiness
  checks, the new "standby" gate among them, plus the manager's ping and
  cache-sync) on a Unix socket in the pod's own /tmp emptyDir.
  --health-probe-bind-address exposes the TCP endpoint's address; "0" turns
  it off. Both default to today's behaviour (no socket, TCP :8082), so a chart
  that predates this keeps working against the new image.
- agent/cmd/agent-ready: the exec probe. Stdlib-only and without net/http
  (one hand-written HTTP/1.0 request, the status line read back);
  //agent/cmd/agent-ready:deps_test asserts the linked ELF's build info lists
  no module. A failing readyz prints the verbose body, so the kubelet's probe
  event names the failing check.
- the agent image ships it as /agent-ready (image_test asserts it).

Refs #1123

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo force-pushed the feat/041-agent-ready branch from 3abc095 to ca13a5e Compare October 3, 2026 18:54
@bpalermo
bpalermo marked this pull request as ready for review October 3, 2026 18:54
@bpalermo
bpalermo merged commit 8d00637 into main Oct 3, 2026
24 checks passed
@bpalermo
bpalermo deleted the feat/041-agent-ready branch October 3, 2026 19:02
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