Skip to content

refactor(daemon): extract diagnostics initialization from Run - #1602

Merged
skevetter merged 1 commit into
mainfrom
refactor/surface-daemon-diagnostics-setup
Oct 20, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/surface-daemon-diagnostics-setup

Conversation

@skevetter

@skevetter skevetter commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Extracts diagnostics setup from DaemonCmd.Run into private initDiagnostics(location, locatorPath): startedAt capture, NewRecorder, Nop() fallback, and locator write.
  • Run keeps the runtime lock, locator env resolution (still before AcquireRuntimeLock), the EventDaemonStarted record and status update, and the stopping defer, all in the original order.
  • Adds TestInitDiagnostics for the published-locator path and the nop-recorder fallback.

Why

Run mixes runtime locking, recorder/locator initialization and patrol lifecycle. A private diagnostics initializer separates setup from lifecycle while preserving lock ownership and all diagnostics semantics. This is the next bounded slice in a file untouched by open PRs or the last three surface-refactor merges.

Validation

  • mise run cli:format: exit 0, no file changes.
  • mise run cli:lint:ci: exit 0. Runs only golangci-lint config verify (0 issues). Started after another agent's golangci-lint run cleared; it was blocked by "parallel golangci-lint is running" until then.
  • golangci-lint run ./cmd/internal/...: no findings in changed code. One pre-existing goconst finding on the existing "ws-test" literal in agent_daemon_test.go:41; this change adds and removes no ws-test occurrence. Not touched.
  • gofmt -l cmd/internal/ clean; go vet ./cmd/internal/ clean; go test ./cmd/internal/ -count=1 ok.
  • prek run --files cmd/internal/agent_daemon.go cmd/internal/agent_daemon_test.go: all hooks passed, including golangci-lint.

CodeRabbit CLI

Failed. coderabbit review --agent --committed --base-commit 2a0a20255ceb9f4e6c638b95c21311f556d8ba39 (merge-base of HEAD and origin/main) returned Connection failed: WebSocket closed (recoverable) on three attempts, the last running about 700s. No review output was produced. The GitHub CodeRabbit review still gates.

Auto-merge

Eligible: yes. Behaviour-preserving internal refactor; 56 non-test changed lines (30 added, 26 removed) in 1 non-test file; no tests removed or weakened.

Next

None for this file.

@skevetter skevetter added the surface-refactor Unattended refactor (surface) label Oct 19, 2026
@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 9a22af6
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ad69d37172aff95389daefb

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5efc30c7-4337-455e-a7c7-4a2d4f4420aa
📥 Commits

Reviewing files that changed from the base of the PR and between 2a0a202 and 9a22af6.

📒 Files selected for processing: 2
  • cmd/internal/agent_daemon.go
  • cmd/internal/agent_daemon_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 9a22af6
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad69d37ebf75c110bdfbd17

@skevetter
skevetter marked this pull request as ready for review October 20, 2026 02:20
@mergify

mergify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter

Copy link
Copy Markdown
Contributor Author

@greptileai review

@skevetter

Copy link
Copy Markdown
Contributor Author

Coordinator update: CI is green on head 9a22af6, including CI Success. PR is ready. Greptile review was requested at #1602 (comment) and has not posted yet. CodeRabbit CLI repeatedly failed with WebSocket closed; GitHub CodeRabbit returned Review rate limited (not a completed review). No unresolved review threads were present at the last check. Leaving the PR ready for the next cycle to complete reviewer gates.

@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Extracts diagnostics setup from DaemonCmd.Run into private initDiagnostics without changing the daemon’s startup or shutdown order.

  • Daemon startup sets up diagnostics in a separate step.

Reviews (1) · Last reviewed commit: "refactor(daemon): extract diagnostics in..." · Reviewed by Greptile

@skevetter

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 28 minutes.

@skevetter

Copy link
Copy Markdown
Contributor Author

Needs human: CodeRabbit review is unavailable due to OSS quota. The fresh full-review request was rejected (next included review in 28 minutes); its success status is not completed reviewer coverage. Current head remains 9a22af6. CI including CI Success passed, Greptile reviewed this head at 5/5, commit signature is verified, and there are no review threads. Final diff is behavior-preserving with 56 non-test changed lines. Leaving ready and unmerged until actual CodeRabbit coverage is obtained.

@skevetter
skevetter merged commit c2bd508 into main Oct 20, 2026
112 checks passed
@skevetter
skevetter deleted the refactor/surface-daemon-diagnostics-setup branch October 20, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m surface-refactor Unattended refactor (surface)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant