Repository navigation
provider: recover from a stalled coordinator reconnect, and let stop finish without a session - #1606
Conversation
A coordinator restart makes every provider reconnect at once. The connection wait in CoordinatorClient.connectAndRun had no deadline, and Network.framework leaves an NWConnection in .preparing for as long as the peer holds the TLS handshake or the WebSocket upgrade open. Ping/pong and heartbeats start only after .ready, so one stalled handshake stranded the reconnect loop: the daemon kept writing fresh state, status showed "Trust: awaiting coordinator status", no request arrived, and only a process restart recovered it. CoordinatorConnectionHandshake bounds the wait to 30 seconds and cancels the stalled connection, so the reconnect loop backs off and retries. A provider in that state also could not stop gracefully: the lifecycle drain required a coordinator acknowledgement even when no session was registered, so stop, restart and start failed with "coordinator acknowledgement false" and needed --force. Without a registered session nothing can acknowledge, accepted work was already cancelled at the disconnect and outbound messages are never carried to a later connection, so the drain now completes when no work remains. A registered session still requires the acknowledgement.
Refactor pass over the handshake deadline and the no-session drain; no behavior change. - CoordinatorError(terminalState:) maps .failed, .waiting and .cancelled once, for both the handshake wait and the session's failure monitor. - CoordinatorClient.connectionParameters(for:) is the unchanged transport setup moved out of connectAndRun, so the handshake tests use the production stack and cover the TLS stall (wss) as well as the stalled WebSocket upgrade (ws). - performLifecycleDrain names the condition coordinatorSettled (acknowledged, no client, or no registered session); same outcomes. - New guard test: without a session, accepted work still keeps the drain open and a timeout leaves it in place.
- protocol-messages.md: a lifecycle drain with no registered session completes without the barrier once accepted work and local response writes finish. - telemetry-schema.md: a reconnecting process, not only a starting or schedule-idle one, can drain with coordinator_acknowledged = false. - cli-reference.md: the no-acknowledgement drain also needs no work left. - Changelog: a failed stop also left the provider draining.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Threat model review — advisoryReviewed head Reviewers: anthropic/claude-sonnet-5.5: first pass completed; anthropic/claude-opus-5.5: selected depth completed (3 batches); openai/gpt-6.1-sol: selected depth completed (1 batches) No actionable findings in the reviewed text. This is not a security approval. Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging. Scan completed; human review required. Coverage: 55/55 source units; cross-file integration complete. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned. Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens. Saved findings and earlier report · Historical findings are not confirmed resolved. Bedrock: 19 request(s), 838591 uncached + 0 cache-read + 44803 cache-write input / 15559 output tokens; 0 request(s) with unknown usage. OpenRouter backup used 0 time(s). Dollar amounts above cover OpenRouter only; AWS billing is reconciled separately. |
Brings in #1615, #1618 (provider 0.10.3 hotfix), #1617, #1619 and #1620 (reversible add-on hold). Conflicts and resolutions: - docs/provider/cli-reference.md: only the "Last updated" stamp conflicted (2026-10-26 here, 2026-10-27 on master). Kept the one 2026-10-27 stamp; both texts are kept. - docs/reference/protocol-messages.md: only the "Last updated" stamp conflicted. Kept the one 2026-10-27 stamp; this branch's no-session drain text and master's busy_reason/busy_since_ms/busy_addon fields merged cleanly. provider-swift/Sources/ProviderCore/ProviderLoop+Lifecycle.swift merged cleanly: #1620 changes beginServingDrain and the lifecycle monitor, this branch only the end of performLifecycleDrain (coordinatorSettled). Interplay with #1620, reviewed: an add-on hold keeps its registered connection, so the stop path still waits for the coordinator's drain acknowledgement while held; only a stop without a registered session skips it. A planned reconnect under a hold goes through the bounded handshake, and its fresh register still carries the busy fields.
Brings in #1606 (stalled coordinator reconnect; `stop` finishes without a session) and #1605. Resolutions: - provider-swift/Sources/ProviderCore/ProviderLoop+Lifecycle.swift (conflict): took master's (#1606's) version whole. This branch's changes to the file were only the no-session drain (`drainReconnectGrace`, the 250 ms reconnect poll and `sessionDown`), which #1606 supersedes with its `coordinatorSettled` rule; no auto-merged hunk of that drain is kept. This branch's other changes are in other files and are unchanged: the 15 s per-model shutdown bound (`ProviderLoop.shutdownUnloadWait`, ProviderLoop+StartupShutdown.swift) and the add-on hold cancelling a selected-model recovery load in progress (ProviderLoop+AddonHold.swift, from 4b513e5). - ProviderLifecycleTests: deleted `aDrainWithTheCoordinatorConnectionDownFinishes`; it duplicates #1606's `drainWithoutARegisteredCoordinatorSessionCompletes`. `shutdownDoesNotWaitForeverForAnUnloadThatNeverFinishes` stays. - docs/provider/cli-reference.md (`darkbloom stop`): deleted the sentence saying a drain with the connection down waits up to 10 seconds for the session; kept the 15-second per-unload shutdown sentence. #1606 documents the no-session drain. - docs/provider/troubleshooting.md (drain-did-not-complete row): replaced "waits 10 seconds for it" with "needs no acknowledgement"; the 15-second unload clause stays. - changelog.d/selected-models-recover.md: cut the drain half of the stop/restart/start bullet (#1606's fragment covers it); kept the 15 s shutdown bound.
Master moved the coordinator connection handshake into CoordinatorConnectionHandshake.start with a deadline (#1606). The member's attempt hooks (noteMemberAttemptStarted, noteMemberAttemptUnreachable) now wrap that helper; the inline handshake and its HandshakeResumption are gone. CoordinatorClientConfig carries the member role and claim beside master's handshakeTimeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve conflicts with #1605/#1606/#1607 and later master changes: - docs freshness stamps take the later date; - cli-reference.md keeps master's status bullets and adds this PR's App Attest lease bullet after the trust-verdict bullet; - StatusCommandRunTests.swift keeps master's trafficVerdict and heldProviderHasNoTrafficVerdict tests and this PR's lateLeaseRenewalStillAuthorizes test. No behavior change beyond the two sides.
The merge adds #1566, #1591, #1602, #1605, #1606, #1607, #1612, #1621, #1622, #1623, #1625, #1629, #1630, #1631, #1632 (provider 0.10.4), #1633, #1644, #1652 and #1653 to this branch. Conflicts and resolutions: - CoordinatorClient+Connection.swift: #1606 moves the transport setup out of connectAndRun into the static function connectionParameters(for:), and puts the connectAndRun header below it. This branch adds the session parameter to the same header. The merge keeps the layout of master. The moved header has the signature of this branch: connectAndRun(_ session: CoordinatorSessionRecorder). Git merged the other changes without a conflict: the bounded handshake of master (CoordinatorConnectionHandshake.start) and the session recorder of this branch (markOpened after register, the session parameter of sessionLoop and receiveLoop, and the close-code read). - docs/provider/cli-reference.md: the runtime constants table. The merge keeps the three reconnect rows and the ping/pong row of this branch. It adds the handshake deadline row of master after the ping/pong row, where master has it. - docs/provider/troubleshooting.md: only the "Last updated" stamp had a conflict (2026-10-26 on this branch, 2026-10-27 on master). The merge keeps one stamp, 2026-10-27. Git merged the rows: the backoff citation of this branch and the new rows of master. Each decision has one owner after the merge: - CoordinatorReconnectPolicy chooses the wait before the next connection attempt, after each end of a session or of an attempt. - CoordinatorConnectionHandshake (#1606) cancels a handshake that does not complete in 30 s. runLoop catches the timeout error. That attempt did not send register, so the policy gives the next backoff range, as on master. - UnauthorizedConnectionRecovery (#1607, #1633) decides when to start a re-registration of a connection that the coordinator refuses. Its retry backoff counts re-registrations, not connection attempts, and an authorized verdict sets that count to zero. The re-registration closes the session. Then the policy chooses the wait, as for each other end. Checks: against master, the merge has only the changes of this branch, in its 15 files. The troubleshooting stamp is the one exception: it has the date of master. Against this branch, the merge has only the changes of master, in 651 files. The one exception is the connectAndRun header, which has the session parameter. The gitlinks do not change: libs/mlx 31f550af, libs/mlx-swift 4926d3d9, libs/mlx-swift-lm aee6ebb6. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…r another model blocked them A selected model left cold by memory (skipped by the startup preload, or unloaded by an Autopilot operation to place another model) is retried from the capacity tick until it is resident again, evicting only idle models outside the selection within Autopilot's victim rules. `darkbloom status` says why it waits and when a saved `enabled_models` differs from the running selection. Shutdown waits at most 15 s per unload instead of forever for a slot whose native retirement never finishes. Rebased onto dev as one commit (was 17 commits plus four master merges on master). The merges carried the #1606 drain and #1620 add-on hold resolutions, so the branch's net change is re-applied instead of replaying each commit. Resolved against dev: #1730's operator model filter (`operatorModelFilter`) is kept beside this PR's `savedEnabledModels` and `enabledModelsAtLastSwitch`; `DaemonState.registeredModels` is kept beside the new optional keys; the add-on hold calls dev's `publishBusy()`; the recovery invariant in model-autopilot.md is numbered 11 after dev's operator-filter invariant 10.
…r another model blocked them A selected model left cold by memory (skipped by the startup preload, or unloaded by an Autopilot operation to place another model) is retried from the capacity tick until it is resident again, evicting only idle models outside the selection within Autopilot's victim rules. `darkbloom status` says why it waits and when a saved `enabled_models` differs from the running selection. Shutdown waits at most 15 s per unload instead of forever for a slot whose native retirement never finishes. Rebased onto dev as one commit (was 17 commits plus four master merges on master). The merges carried the #1606 drain and #1620 add-on hold resolutions, so the branch's net change is re-applied instead of replaying each commit. Resolved against dev: #1730's operator model filter (`operatorModelFilter`) is kept beside this PR's `savedEnabledModels` and `enabledModelsAtLastSwitch`; `DaemonState.registeredModels` is kept beside the new optional keys; the add-on hold calls dev's `publishBusy()`; the recovery invariant in model-autopilot.md is numbered 11 after dev's operator-filter invariant 10.
Summary
After a coordinator restart, some providers stayed
Readybut never registered again, and received no requests until their operator restarted them. This PR fixes two provider bugs behind that:CoordinatorConnectionHandshakenow bounds TCP, TLS and the WebSocket upgrade to 30 s (defaultTimeout = 30). On timeout it cancels the connection, and the client backs off and retries like any failed connection.darkbloom stop,restartandstartfailed withcoordinator acknowledgement falseeven with 0 requests, and left the daemon draining with automatic restart disabled. A drain now completes when no work is left and no session is registered, and the CLI reportscoordinator acknowledgement: not needed (no coordinator connection). A registered session must still acknowledge.Base:
masterf9d1af3d0(provider 0.10.2 source).Why
Operator report. Operators reported providers that kept running and showed
Ready, but got no traffic, sometimes for hours, until a manual restart. Theirdarkbloom statusshowedTrust: awaiting coordinator status. A gracefuldarkbloom stopthen failed withDrain did not complete: 0 unfinished request(s), coordinator acknowledgement false … pass --force, so they had to restart with--force.Root cause.
Trust: awaiting coordinator statusis printed only when the daemon holds notrust_statusat all, and the daemon clears it on every connect and disconnect. A registered session normally gets one within seconds, and App Attest sessions get a renewal every 5 s. So these providers were not "connected but unrouted": they had no registered coordinator session.connectAndRunwaited forNWConnection.readywith no deadline. Ping/pong (30 s pong timeout) and heartbeats start only after.readyand registration. A standalone Network.framework harness using the provider's exact parameters showed that a peer that accepts TCP but never answers the TLS handshake or the WebSocket upgrade keeps the connection.preparingfor the whole 150 s observation window. Only an unanswered SYN ends on its own, as.waiting(ETIMEDOUT)after 75 s, which the client already handled. One stalled exchange in the restart herd stranded the daemon:runLoopnever reached its backoff;status,doctorand the watchdog all said "running";performLifecycleDraincounted as drained only when the coordinator acknowledged, or when there was no client object at all. With a client but no registered session,acknowledgeDrainreturnsfalseat once, so the outcome was.timedOut. Nothing needs that acknowledgement: a disconnect already cancelled accepted work (cancelAllInflight), and messages produced while disconnected are dropped, not carried to a later connection. The planned-reconnect path already treats "no registered connection" as "no barrier needed". The failed stop left the daemon draining and refusing work with automatic restart disabled, which extended the outage until--force.Before
Behavior
%%{init: {"flowchart": {"wrappingWidth": 380}}}%% flowchart LR classDef ctx fill:#f1f5f9,stroke:#64748b,color:#0f172a classDef bad fill:#fee2e2,stroke:#b91c1c,color:#7f1d1d R["Coordinator restart:<br/>every provider reconnects"]:::ctx --> H["Peer accepts TCP, never answers<br/>the TLS handshake or WebSocket upgrade"]:::ctx H --> W["Waits for .ready forever:<br/>no deadline, no backoff, no retry"]:::bad W --> S["status: Ready, Trust: awaiting coordinator status<br/>no requests until a manual restart"]:::bad S -->|"darkbloom stop"| D["Drain did not complete:<br/>0 unfinished request(s),<br/>coordinator acknowledgement false"]:::bad D --> F["Left draining, automatic restart<br/>disabled; only --force recovers"]:::badCode flow
%%{init: {"flowchart": {"wrappingWidth": 380}}}%% flowchart LR classDef code fill:#e0e7ff,stroke:#4f46e5,color:#1e1b4b classDef bad fill:#fee2e2,stroke:#b91c1c,color:#7f1d1d RL["runLoop"]:::code --> CR["connectAndRun"]:::code CR --> WC["inline continuation: resumes only on<br/>.ready, .failed, .waiting or .cancelled"]:::bad WC -->|"none arrives"| X["suspended forever;<br/>catch and backoff never run"]:::bad PLD["performLifecycleDrain"]:::code --> AD["acknowledgeDrain<br/>(false at once without a session)"]:::code AD --> C["drained only if acknowledged<br/>or coordinatorClient == nil"]:::bad C --> TO[".timedOut with 0 requests"]:::badAfter
Behavior
%%{init: {"flowchart": {"wrappingWidth": 380}}}%% flowchart LR classDef ctx fill:#f1f5f9,stroke:#64748b,color:#0f172a classDef good fill:#dcfce7,stroke:#15803d,color:#14532d classDef same fill:#e0e7ff,stroke:#4f46e5,color:#1e1b4b R["Coordinator restart:<br/>every provider reconnects"]:::ctx --> H["Peer accepts TCP, never answers<br/>the TLS handshake or WebSocket upgrade"]:::ctx H --> T["Gives up after 30 s<br/>and cancels the connection"]:::good T --> B["Logs a failed connection, backs off<br/>(1 s doubling to 30 s, jittered), retries"]:::good B --> OK["Registers on the next answered attempt;<br/>trust status and traffic return"]:::good N["No registered session,<br/>no unfinished work"]:::ctx -->|"darkbloom stop"| ND["Drain drained, 0 unfinished request(s),<br/>coordinator acknowledgement:<br/>not needed (no coordinator connection)"]:::good G["Registered session"]:::ctx -->|"darkbloom stop"| GA["Waits for the coordinator<br/>acknowledgement (unchanged)"]:::sameCode flow
%%{init: {"flowchart": {"wrappingWidth": 380}}}%% flowchart LR classDef code fill:#e0e7ff,stroke:#4f46e5,color:#1e1b4b classDef new fill:#cffafe,stroke:#0e7490,color:#083344 classDef good fill:#dcfce7,stroke:#15803d,color:#14532d CR["connectAndRun"]:::code --> HS["CoordinatorConnectionHandshake.start<br/>timeout: config.handshakeTimeout (30 s)"]:::new HS -->|".ready"| RDY["onReady installs the session's<br/>failure handler, then registration"]:::code HS -->|"terminal state"| TE["CoordinatorError(terminalState:)<br/>(one mapping, also used after .ready)"]:::new HS -->|"deadline"| TO["clear handler, cancel,<br/>CoordinatorError.handshakeTimeout"]:::new TE --> RL["runLoop catch: .disconnected,<br/>backoff.nextDelay(), retry"]:::code TO --> RL PLD["performLifecycleDrain"]:::code --> SET["coordinatorSettled = acknowledged, or no client,<br/>or no hasRegisteredConnection()"]:::new SET --> DR[".drained only if nothing remains, native owners<br/>and the App Attest worker retired"]:::goodColors: grey = situation, red = failure, green = new outcome, indigo = existing or unchanged code and behavior, cyan = new code.
Changes
Coordinator/CoordinatorConnectionHandshake.swift(new):CoordinatorConnectionHandshake.start(_:on:timeout:onReady:)starts the connection and returns at.ready.onReadyruns on the connection queue before it returns, so the post-ready failure handler is installed with no gap, as before. A terminal state throws as before. The deadline clears the state handler, cancels the connection and throwsCoordinatorError.handshakeTimeout(seconds:). A lock-guarded one-shot hands the continuation to exactly one of the state handler and the deadline, so a late state update cannot resume it twice.CoordinatorError(terminalState:)maps.failed,.waitingand.cancelledtoconnectionClosedin one place, for the handshake and for the session's failure monitor.CoordinatorClient+Connection.swift:connectAndRunuses the helper. The transport setup moved unchanged intoCoordinatorClient.connectionParameters(for:), so the tests use the production stack.CoordinatorClientTypes.swift:CoordinatorClientConfig.handshakeTimeout(an optionalinitargument, defaulting todefaultTimeout; production does not set it) and thehandshakeTimeout(seconds:)error case.ProviderLoop+Lifecycle.swift(performLifecycleDrain): when the drain is not acknowledged and not cancelled, the coordinator side counts as settled if the client has no registered session. Everything else that a drain waits for is unchanged.Interface effects
provider_drainevent can now reportreason = drainedwithcoordinator_acknowledged = falsefor a provider that is reconnecting. The fields are unchanged.Coordinator connection failed; reconnectingwarning and the reconnect telemetry count. There are no new log lines and no prompt content.CoordinatorErrorgains a case, which affects exhaustive switches outsideProviderCore(there are none in this repository), andCoordinatorClientConfig.initgains a defaulted argument.Merge order with the stuck-provider work
This PR does not duplicate the related stuck-provider work: unauthorized connections, the
Traffic:status line, the doctor check and re-registration.fix/stuck-provider-authorization-recovery: in darkbloom-platform, so no shared files.fix/stuck-provider-wip: not onoriginyet. Checked against its latest local commit0b666e201(fix/stuck-provider-serving-readiness, also offf9d1af3d0).docs/provider/cli-reference.md, in different sections. This PR changes the drain rule under "Graceful stop and restart" and the runtime-constants row; that branch changes thedarkbloom statusoutput list. Both set the stamp to 2026-10-26, and each adds its own changelog fragment.CoordinatorClient+Connection.swift,CoordinatorClientTypes.swift,ProviderLoop+Lifecycle.swiftand the newCoordinatorConnectionHandshake.swift.StatusCommand.swift,DoctorRunner.swift,DaemonStateFile.swift,ProviderLoop.swift,ProviderLoop+Serve.swift,ProviderLoop+Trust.swift,ProviderLoop+Capacity.swift, plus new files.git merge-tree --write-tree 960747dfe 0b666e201merges cleanly. Recheck once that branch is pushed, especially if it touchesProviderLoop+Lifecycle.swift,CoordinatorClient*orCoordinatorClientTypes.swift.noteCoordinatorConnection(connected: false)restartssinceon every.disconnectedevent. A failing reconnect loop emits one.disconnectedper attempt, about every 30–60 s with this PR, and every ≤30 s for cause B or a refused port. ItsTraffic:line would then say "disconnected 20s ago" during an hour-long outage. Keepingsincewhile the connection stays down avoids that.Validation
Setup.
960747dfe.CFFIXED_USER_HOME,HOME,DARKBLOOM_STATE_FILE, loaded-models file and verified-weights file.~/.darkbloom/usage-history.json(29cd1d59…) and of every other top-level file in~/.darkbloomwas unchanged before and after every run.swift build --build-tests -debug-info-format none --disable-index-store; this changes only debug info and indexing.What "before" means. "Before" is the final head with both production fixes reverted to
f9d1af3d0behavior: the original inline.readywait and the original drain condition. The new tests were kept. The helper file stayed compiled, so the helper-level test still passes there. "Author" is the branch before the refactor pass,c1be71399.c1be71399960747dfeCoordinatorHandshakeDeadlineTestsclientRetriesAfterAStalledHandshakefails forwsandwss: the 60 s time limit is exceeded, there are 0 disconnects, and the client stays in its first handshake (1 accept), with 6 issueswsonly)ws,wss)ProviderLifecycleTests.timedOutinstead of.drained, 3 issues);drainWithARegisteredSessionStillRequiresTheAcknowledgementpassesCoordinatorClientTests,CapacityEventHeartbeatTestsand the heartbeat and registration codec tests)ServiceDrainTests,ServiceDrainWaitTests,LifecycleRecoveryPublicationTests,LifecycleRecoveryRollbackTests,RestartCommandTests,LogoutCommandTests,StatusLifecycleDrainLineTestsThe 15 coordinator suites:
CoordinatorIntegrationTests,ServeLoopConnectionTests,AppAttestResumeTransportTests,AppAttestShadowReplyTests,ChunkSenderTests;UpdateDrainAwarenessTests,CoordinatorLifecycleBarrierTests,PlannedProviderDisconnectTests,CoordinatorModelSwitchTests,ProviderModelSwitchTests,AutopilotModelSwitchOwnershipTests;StandaloneServerDrainTests,LocalDrainHTTPTests;HeartbeatIdlePolicyTests,PerformanceHeartbeatMaterialityTests.The two primary suites passed 5 times on the final tree, with no flakes.
New and changed tests:
CoordinatorHandshakeDeadlineTests.stalledHandshakeTimesOutAndCancelsTheConnection(scheme:)checks that a silent loopback peer that accepts TCP gets exactly 1 accept, then.handshakeTimeout, then a.cancelledconnection, forws(stalled upgrade) andwss(stalled TLS).CoordinatorHandshakeDeadlineTests.clientRetriesAfterAStalledHandshake(scheme:)checks that the realCoordinatorClientreports two.disconnectedevents with at least two accepts, never.connected, forwsandwss.ProviderLifecycleTests.drainWithoutARegisteredCoordinatorSessionCompletes:.drained, 0 remaining, not acknowledged.ProviderLifecycleTests.drainWithoutARegisteredSessionStillWaitsForAcceptedWork(guard): with an accepted request and no session, a drain times out with 1 remaining and admission stays closed. After the request finishes, the next drain completes.ProviderLifecycleTests.drainWithARegisteredSessionStillRequiresTheAcknowledgement(guard): a registered session whose coordinator never acknowledges still gives.timedOut, and the mock coordinator received the barrier.The investigation also checked the handshake helper against the real Network.framework, outside this repository. Compiled unchanged with
swiftc -swift-version 6, it gave:wsandwsspeers;.readyat once, withonReadyfirst, against an upgrading peer;The original inline wait hung against the silent peers.
Limitations
make provider-test, and a real coordinator restart. CI must run the full Provider Unit Tests.invalid prefix-cache capabilities: the aggregate hash must equalmodels[].weight_hash, and the model must be inmodels. In a heartbeat, the same mismatch is only logged and the cache evidence cleared. So a provider whose live advertisement drifts stays connected until its next reconnect, and from then on every identical re-registration is closed before anytrust_status: a reconnect loop about every 30 s, with the sameawaiting coordinator status. No concrete 0.10.1 trigger was found.coordinator/api/provider/session.go), a capability-only failure should dropPrefixCacheV2ModelsandPrefixCacheMemoryModelsand continue, exactly as the heartbeat path does. It should revalidate so that non-cache errors, such as duplicate or blank model IDs, still close the session. Cache routing stays fail-closed and the provider stays routable. This needs a composed-router contract test in darkbloom-platform.CoordinatorClientactor. The rebuild runscsrutil(twice),rdma_ctl,diskutil info /,system_profiler SPHardwareDataType,ioregand an SE signature (AttestationBuilder) throughSecurityCommandRunner.live, which has no timeout. If one tool hangs:.ready, so this PR's deadline does not cover it;stophangs atsendEventHeartbeat()until the CLI's deadline and still needs--force.ProviderLoop+Serve.swiftintends, and only re-sign on reconnect. Or, at minimum, useSecurityCommandRunner.bounded(timeout:)and build the attestation off the actor with a deadline. The attestation and trust owner should decide.Coordinator connection failed; reconnectingon every attempt. The detailed error line useslocalizedDescription, andCoordinatorErroris not aLocalizedError, so it readsThe operation couldn’t be completed. (ProviderCore.CoordinatorError error N.)rather than the timeout text. This is unchanged for everyCoordinatorErrorcase.trust_status) in the daemon state file, whereDaemonState.connectivityexists but is never written. Havestatuswarn "no coordinator session for N min" instead of the neutralawaiting coordinator status.How to spot a stuck provider
darkbloom statusAuthorization: App Attest authorizes this connection …Trust: awaiting coordinator statusfor more than 1 mindarkbloom logs --last 10m[…:coordinator]line every 30 s (the coordinator's transport ping)Disconnected from coordinator; with this PR:Coordinator connection failed; reconnectingabout every 30–60 s while the peer stallsCoordinator connection failed; reconnectingevery ≤30 spgrep -lP <daemon pid>(pid fromDaemon: running (pid …))diskutil,system_profiler,csrutil,rdma_ctlorioreg/v1/statssample <daemon pid> 3tells A from C, and contains no prompt content. With no registered session there is no accepted work to lose, sodarkbloom stop --force && darkbloom start(ordarkbloom restart --force) is safe. With this PR, a gracefuldarkbloom stopalso works for A and B; C still needs--force.Components touched
Protocol / interface changes
Documentation impact
docs/provider/cli-reference.md: the handshake-deadline runtime constant, and the drain rule under "Graceful stop and restart";docs/reference/protocol-messages.md: a drain with no registered session needs no barrier;docs/reference/telemetry-schema.md: whencoordinator_acknowledged = falsecan accompany a drained outcome.Changelog
changelog.d/coordinator-reconnect-stall.md;make changelog-checkpasses.CHANGELOG.mdis untouched.Refactor Pass
An independent refactor subagent reviewed
c1be71399(behavior-preserving, perAGENTS.md). It found the fix correct:It pushed
3804763f4:CoordinatorError(terminalState:);CoordinatorClient.connectionParameters(for:), so the handshake tests use the production stack forwsandwss;coordinatorSettlednames the drain condition, with equivalent outcomes;It also pushed
960747dfe, a docs-accuracy commit (protocol and telemetry references, the CLI drain rule, the changelog). The focused, coordinator and CLI suites and the docs checks above were rerun on960747dfe. All commits are signed and GitHub-verified.Need help on this PR? Tag
@codesmith-botwith what you need.