fix(agents): refresh daemon provider configuration - #271
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe change adds deterministic provider configuration revisions to local agent clients and daemons. The daemon protocol reports configuration matches and supports conditional stops. Clients replace stale idle daemons and report active stale daemons with ChangesLocal agent configuration synchronization
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to This change refreshes daemon provider configuration while preserving active work and protocol compatibility; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant LocalAgentClient
participant LocalAgentDaemon
participant Manager
LocalAgentClient->>LocalAgentDaemon: Send hello with configRevision
LocalAgentDaemon-->>LocalAgentClient: Return status and configMatches
alt Configuration matches
LocalAgentClient->>LocalAgentDaemon: Start or continue turn
LocalAgentDaemon->>Manager: Execute tracked turn
Manager-->>LocalAgentDaemon: Return turn result
LocalAgentDaemon-->>LocalAgentClient: Return turn result
else Configuration differs
LocalAgentClient->>LocalAgentDaemon: Request daemon.stop with ifIdle
LocalAgentDaemon->>Manager: Check active work
LocalAgentDaemon-->>LocalAgentClient: Stop idle daemon or return DAEMON_CONFIG_CHANGED
end
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThe PR adds stable provider-configuration revisions to the private daemon handshake and safely replaces stale idle daemons while preserving active work.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported replacement race is closed by atomic request admission and active-work checks, and the configuration-revision concern was withdrawn after clarification of the intended persisted-configuration boundary.
|
| Filename | Overview |
|---|---|
| src/local-agent-client.ts | Adds revision-aware hello handling, stale-daemon replacement, and atomic idle-only stopping while retaining legacy upgrade behavior. |
| src/local-agent-daemon.ts | Returns private revision-match state and coordinates conditional shutdown with in-flight and active-turn accounting. |
| src/local-agent-daemon-protocol.ts | Upgrades hello and stop request shapes and adds strict decoding for the private handshake response. |
| src/local-agent-config.ts | Computes a deterministic SHA-256 revision over normalized persisted provider configuration. |
| src/local-agent-daemon.test.ts | Covers stale idle replacement, active-work preservation, the turn-start race, protocol upgrades, and status-field privacy. |
Sequence Diagram
sequenceDiagram
participant C as Client
participant D as Running daemon
participant M as Agent manager
C->>D: hello(configRevision)
D-->>C: status + configMatches
alt Configuration matches
C->>D: Start or continue work
D->>M: Execute turn
else Configuration differs and daemon is idle
C->>D: "daemon.stop(ifIdle=true)"
D->>D: Stop accepting requests
alt Turn request or active turn exists
D->>D: Resume accepting requests
D-->>C: Retryable rejection
else Still idle
D-->>C: Stopping
C->>D: Start replacement daemon
end
else Configuration differs and work is active
D-->>C: DAEMON_CONFIG_CHANGED
end
Reviews (3): Last reviewed commit: "fix(agents): refresh daemon provider con..." | Re-trigger Greptile
2058304 to
8c44d60
Compare
8c44d60 to
f7289d8
Compare
f7289d8 to
46a8a38
Compare
46a8a38 to
cdffbd2
Compare
A running daemon previously kept the provider configuration it loaded at startup even after
config.jsoncchanged. The client and daemon now compare an internal stable revision during their private handshake without returning or logging the revision itself.A stale idle daemon is stopped and replaced before new work starts. A stale daemon with active work is left alone and returns retryable
DAEMON_CONFIG_CHANGEDuntil that work finishes. The public daemon status shape stays unchanged, and the protocol upgrade path still handles older idle daemons safely. Tests cover stable hashing, idle replacement, active-work preservation, version skew, and hidden status fields; the full suite and production build pass.Summary by CodeRabbit
New Features
Bug Fixes