Repository navigation
feat(status): expose controller per-tick cost in host status - #403
Conversation
Persist the previous reconcile tick's wall duration and the controller process's cumulative CPU seconds in observed state under observed.controller, shown by host status --json and as a Controller cost line in human output. Document the fields and recommend capping maximumConcurrentWorkers or worker CPUs on interactive dev hosts. Refs #391 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GZgRs2crE1YQ1TT4kftix1
pollCheckpoint built observed state without the controller cost, so every serving and cadence checkpoint stored zeros. Share one controllerCost helper between it and the step's closing write, and note that tick duration includes the listener long poll. Refs #391 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GZgRs2crE1YQ1TT4kftix1
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd2057a0f3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
PR body contract — issue linkage This PR body conforms to the issue-linkage contract. Nothing to do. |
…dows (#408) No related issue: fixes main's Windows go-quality lane broken by #403. ## Summary `TestReconcilerPublishesPreviousTickCost` failed on main's Windows go-quality lane (run 36356368154): `LastTickDurationSeconds:0`. A fast fake Step measures 0 on Windows' coarse wall clock, so the test's nonzero assertions were timing-dependent. #403's own PR run passed the Windows lane by chance. ## Fix - Both controller cost tests now run inside `synctest.Test` with a `slowResources` monitor that sleeps 1s per sample. The bubble clock advances only on that sleep, so Step's measured duration is deterministic and the test asserts the persisted previous-tick value is at least 1s. - Process CPU (`GetProcessTimes`, ~15.6 ms granularity) is asserted non-decreasing across Steps / non-negative, not nonzero. - Production code is unchanged. ## Verification - Native Windows: cross-compiled test binary run via WSL interop, `-test.run 'ControllerCost|PreviousTickCost' -test.count 20`: 40/40 PASS. - `go build ./...`, `go test -race ./...`, `golangci-lint run ./...` (v2.13.2, 0 issues), `CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath ./cmd/...` all pass. ## Related - #403 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01GZgRs2crE1YQ1TT4kftix1 Co-authored-by: Claude Opus 5.5 <[email protected]>
No related issue: partial work on #391 (asks 2 and 3); the issue stays open for the dynamic concurrency cap.
Summary
host statusnow reports the controller's own cost, so idle and per-tick CPU can be watched without external sampling (#391 ask 3, #328 suggestion 4). The README also documents the existing contention guard for interactive dev hosts (#391 ask 2). Ask 1 was confirmed on the issue: v0.1.27 idles at about 0.05 core.Fix
ObservedStategainscontroller.lastTickDurationSeconds(previous reconcile tick's wall time, measured inReconciler.Step's defer) andcontroller.processCpuSeconds(cumulative process CPU:GetProcessTimeson Windows,Getrusageelsewhere).pollCheckpoint) fill the field through onecontrollerCost()helper, so the value never drops to zero mid-tick.Controller cost: last tick 0.250s, process CPU 12.5s;--jsoncarries it underobserved.controller.processCpuSecondsdeltas are the cost measure. The resources section recommends settingmaximumConcurrentWorkersbelow the sum of poolmaxCapacityand/or loweringworker.cpuson interactive hosts, sincecpuBlockPercentreacts to sustained host-wide CPU, not interactive latency. No new config field or schema change.Verification
go build ./...,go test -race ./...,golangci-lint run ./...(0 issues, also withGOOS=windowson the controller package), andCGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath ./cmd/...all pass.TestReconcilerPublishesPreviousTickCost(second Step persists nonzero previous-tick duration and CPU),TestPollCheckpointPersistsControllerCost(cadence checkpoint keeps the value), andTestStatusJSONExposesStableBusyWorkContractextended for the JSON keys and the human line.observed.jsonkey (LoadObservedignores unknown fields);ObservedStatedoes not cross the strict control transport.Related
🤖 Generated with Claude Code
https://claude.ai/code/session_01GZgRs2crE1YQ1TT4kftix1