Skip to content

perf(daemon-client): reuse remote /health across CLI processes - #5134

Open
thymikee wants to merge 10 commits into
mainfrom
perf/persist-remote-health
Open

thymikee wants to merge 10 commits into
mainfrom
perf/persist-remote-health

Conversation

@thymikee

@thymikee thymikee commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Each CLI call to a remote daemon is a new process, so the in-memory health cache never hit. Every command paid GET /health before POST /rpc: one extra network round trip per agent step.

The usable /health answer now also lives in the client state dir. Every RPC from it carries the instance preconditions, so a replaced daemon or proxy upstream answers 409 before dispatch and the client probes again (ADR 0006, amended).

  • A cached send whose connection never opened (the client's own evidence, never reply data) drops the entry; after a failure it re-runs a live /health check and is sent once more, within the remaining budget. Heartbeats included.
  • Any remote 5xx clears the cache, and so does a timeout whose probe finds the daemon gone. A capability that only the cache lacks is re-probed before refusal.

Before / after

session list, 10 calls through a delay proxy in front of a local HTTP daemon:

                 requests/call      avg wall (RTT 0)   avg wall (RTT 100 ms)
base 0b5627d635  2.0 (/health+/rpc)  296 ms             492 ms
head 1771b6c     1.1 (1 /health)     266 ms             378 ms

Security

  • The file stores a SHA-256 digest of client version, RPC protocol, URL and token, never the token or URL. Mode 0600, atomic write.
  • It is read only from a bounded regular file the user owns that nobody else can write. Links and FIFOs are a miss.
  • Auth is unchanged. A client upgrade or token change is a miss.
  • Open: a rollback to a release that ignores instance headers (maintainer decision).

Validation

Head 015189f: touched test files and tsc -b packages/daemon-client pass locally. CI pending.

🤖 Generated with Claude Code

Each CLI call to a remote daemon is a new process, so the in-process
health cache never hit and every command paid GET /health before
POST /rpc. The usable /health answer now also lives in the client state
directory, named by a digest of client version, base URL and token.
Every RPC sent from it carries the instance preconditions, so a replaced
daemon or proxy upstream still answers 409 before dispatch and the
client probes again.

A cached RPC that fails before it leaves the client opens the /health
gate (same recovery budget and typed refusal) and is sent once more. A
reply that is not the daemon's JSON-RPC clears the cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.64 MB 6.64 MB +3.8 kB
Package (unpacked) 6.64 MB 6.64 MB +3.8 kB
Package (download) 2.03 MB 2.03 MB +1.4 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 20.4 ms 21.4 ms +1.0 ms
CLI --help 43.6 ms 47.4 ms +3.8 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 12 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread website/docs/docs/remote-proxy.md Resolved
Comment thread website/docs/docs/remote-proxy.md Resolved
@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on 1771b6c. The verdict and the full list are in the summary comment.

- Resend after an unsent cached RPC only on evidence the client's own
  transport recorded before the connection opened, never on reply
  details. The gate and resend share the command's remaining budget, and
  a caller abort during the gate stays request_canceled.
- Read the persisted entry only from a bounded regular file the user owns
  that nobody else can write; links and FIFOs read as a miss.
- Clear the cache on any remote 5xx. A timeout clears it only when the
  timeout route's probe finds the daemon gone or replaced.
- Probe /health again before refusing a recording for a capability only
  the cached answer lacks.
- Keep the /health wire declarations in transport (wire-compat), move the
  request guard and the health gate out of it, and drop the transport ->
  lifecycle import cycle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Fix round at 35e9b68 (security review, Cubic, Apex, CI):

  • Duplicate mutation (security review 1): A resend after a cached RPC now needs evidence that the client recorded itself: its own transport failed before the HTTP connection opened. That marker is a module-private set, never the reply's reason/daemonRequestSent. A reset after connect counts as ambiguous, so the request is not resent. Test: a daemon error that claims it was unsent is sent once and no gate runs.
  • Untrusted cache path (security review 2): The entry is opened with the existing verified-read helper (no-follow, non-blocking, identity check). It counts only if the descriptor is a regular file of at most 16 KiB that the current uid owns, with no group or world write bit. Anything else is a miss and the client probes /health live. Tests cover a link, a FIFO, a group-writable file and a malformed entry.
  • 5xx (security review 4): Any remote HTTP 5xx clears the cache, whatever its framing. Nothing is resent. Daemon command failures are also 500, so the next call after one probes /health again.
  • Stale capability (security review 5): A recording refused only by a cached capability first re-probes /health.
  • Gate budget, timeout and abort (Apex and Cubic): The gate and the resend share the remaining deadline. A timeout clears the cache only when the timeout route's probe finds the daemon gone or replaced. An abort during the gate surfaces as request_canceled.
  • CI / wire-compat (Apex MAJOR): The /health declarations are back in daemon-client-transport.ts, byte-identical to main, so the manifest and ledger are unchanged. The request guard and the gate moved out of transport instead. Transport no longer imports lifecycle, which removes the 3 fallow cycles.
  • Rollback to a release that ignores instance headers (security review 3): Not addressed, pending the maintainer's decision.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 35e9b68. The verdict and the full list are in the summary comment.

thymikee and others added 2 commits November 26, 2026 21:38
…eout owner

The new daemon-client-request-guard.ts module made src/cli.ts,
packages/client and the daemon-client entry evaluate one more module at
flat weight plus new transport statements, which the eager-closure
no-growth rule refuses. The guard now lives in daemon-client-timeout.ts,
which every one of those entries already evaluates, beside the timeout
route it must stay apart from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ol too

A cached /health answer stands in for the protocol check, so its digest
now includes DAEMON_RPC_PROTOCOL_VERSION beside the client version, base
URL and token. A protocol change reads as a miss and the client probes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 5a21fb5. The verdict and the full list are in the summary comment.

thymikee and others added 2 commits November 26, 2026 21:46
…tests

The request guard now lives in daemon-client-timeout.ts, so a full mock of
that module dropped refuseAbortedRequest and the guard with it. The mock
now spreads the real module and replaces only handleRequestTimeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A single file held the last identity only, so a client alternating
between two remote daemons missed the cache on every call. Each entry
now has its own file, named by a prefix of the identity digest; the full
digest inside still has to match. The read and write stay the same:
verified, bounded, owner-only, atomic 0600. Stale entries are tiny and
never read, so nothing evicts them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

The change at 84d6878 needs fixes before merge. The saved remote health entry can outlive the evidence that disproves it, and some routes can dispatch or resend without a safe live check.

An RPC that relies on saved health, sent to a host that drops packets can time out before it connects (daemon-client-transport.ts:934). The error handler then returns on settled, the unsent proof is never set, and timeout recovery skips the /health probe, so the entry is never removed. Each later command waits the full timeout and fails with a generic timeout, instead of the typed remote-unavailable refusal and its disconnect hint that the base gives. This also breaks the amended ADR rule to probe /health when such an RPC fails before its connection opens. Every such RPC failure whose request never left the process, by socket error or timeout, must at least drop the entry. For example, sendRequestWithFallback can treat a timeout with daemonRequestSent === false as a drop. Routing it only to resendAfterRemoteHealthGate is not enough, because the spent budget throws before the gate runs. Please add a test with a saved entry and a short timeout before connect, and assert that the state-dir file is gone.

A second independent pass found that a rollback can dispatch to an incompatible daemon (daemon-client-lifecycle.ts:288). After a protocol 3 daemon is saved, the same URL and credential can move to v0.21.16, which speaks protocol 2 and ignores the instance headers. The next CLI call sends the command, while the base probes and refuses first. A current proxy with a rolled-back upstream has the same route. A live compatibility check must run before dispatch whenever a peer can ignore these headers. Saved reuse is safe only when an independently enforced version floor covers both proxy and upstream.

A second independent pass found that an RPC error body can pass as a pre-dispatch refusal (daemon-client-transport.ts:570). A JSON-RPC error with details.reason: remote_instance_mismatch triggers a probe and a resend, even without an HTTP 409 and the mismatch header, and even on a 5xx. That can run a mutation twice. The reason check exists on the base, but it breaks the amended rule here. Only an error that the transport itself marked as coming from the qualifying 409 may cause an instance-mismatch resend.

A second independent pass found that a second stale-instance refusal keeps a disproved entry (daemon-client-transport.ts:536). The probe saves instance B, C replaces B before the single resend, and the resend refusal is returned without removing B. The next CLI call starts with another refused RPC. Every qualifying mismatch response, including one on the resend, must remove the entry, with no further dispatch.

A second independent pass found two timeout eviction errors (daemon-client-transport.ts:373). The probe compares only the endpoint ID, so a proxy that now reports a different upstream keeps the old entry. A caller abort during the probe also reads as unreachable and removes a valid entry. Eviction must compare every saved instance ID, including remoteUpstreamInstanceId, and a caller cancellation must not count as proof that the daemon is gone or replaced.

A second independent pass found that a forced refresh can reuse the entry it should verify (daemon-client-remote-health-gate.ts:77). If the state directory is readable but not writable, removal fails silently and the refresh loads the old entry again. After a daemon upgrade, open --save-script can then be refused without asking the daemon, and an unsent RPC can be resent without a live probe. Every forced refresh must probe live, whatever is saved, and save the compatible answer only when possible.

A second independent pass found that a saved entry can be used without the caller knowing (daemon-client-lifecycle.ts:285). Another CLI can save health between the first lookup and the gate's lookup. The branch then returns without remoteHealthCached, which skips the capability re-probe and the recovery for failures before connect. Each remote resolution must read the saved entry once and report whether the answer was saved or live.

A second independent pass found that upload lease heartbeats have no such recovery (daemon-client-lease-beat.ts:331). A heartbeat that uses saved instance headers and fails before connect removes the entry and reports a failed beat, with no live probe or resend. Every send that relies on saved health, as enumerated by the callers that attach those instance headers, must get the same single refresh and resend, bounded by its own timeout and abort signal.

A second independent pass found that a proxy can be saved without an upstream instance ID (saved health, line 45). If the upstream health body is not a readable object, such as JSON null, the proxy answer is treated like a direct daemon. The next call then leaves the upstream unfenced. Any answer that identifies itself as a proxy must have an upstream instance ID before it is saved.

A second independent pass found that a reflected credential can reach disk (saved health, line 119). The configured credential is sent on GET /health, and the endpoint can echo it or the URL in hostArch or an instance ID. Those strings are written as received. Only metadata needed for admission should be saved, and nothing should be saved when a kept value contains the credential or URL.

A second independent pass found that an invalid instance ID can lock out a repaired daemon (daemon-client-transport.ts:294). A value with a newline is saved, and Node then rejects it as a header before any request exists, so nothing removes the entry. Every endpoint and upstream instance ID must be a valid HTTP header value before it is saved or accepted from disk.

Not blocking: these can be taken or left: a 5xx that is an ordinary daemon command failure also removes the entry (daemon-client-transport.ts:879), so clearing only on other 5xx answers, or documenting this in ADR 0006, could be a follow-up; a rollback to a release without instance headers is an open maintainer choice between documenting the risk and limiting the entry's age (saved health, line 153); the unexplained move of the abort and request guard helpers could be dropped or explained (daemon-client-timeout.ts:461); "after a failed call" in the proxy docs is broader than the code, and "after a connection failure, a server error, or a timeout the daemon did not answer" would fit once timeouts before send are fixed; and the bare assert.rejects calls in the transport tests could assert the error reason or code.

These earlier threads no longer apply and can be resolved: docs now name upgrade, credential change and failed calls, docs now cover peers with incomplete instance IDs, an abort now stays request_canceled, with a test, and the test now checks file contents and permissions.

Not verified here: the first timeout problem was found by reading code and assumes Node emits finish only after the socket write completes. If it fired earlier, the entry would be removed, but that command would still return a timeout instead of the remote-unavailable refusal. The PR benchmark and local test suites were not re-run, and the internals of attemptVerifiedOpen were not re-audited.

All 21 code jobs pass at 84d6878.

The Body rules check was cancelled, not failed. It checks PR metadata, so this is likely unrelated to the code and consistent with a newer run replacing it. It still needs a re-run.

Before merge, please fix the problems above, starting with the saved entry that survives a timeout before send, add its test, and re-run Body rules.

thymikee and others added 2 commits November 26, 2026 22:16
…ansport proof

- A timeout before the connection opens clears the saved entry, like a
  failure before connect.
- An instance-mismatch resend needs a 409 with the mismatch header that
  the transport read, not the reason in an error body. A second refusal
  on the resend clears the entry.
- Timeout eviction compares the upstream instance too and ignores a
  caller abort.
- The /health gate always probes live; remote resolution reads the saved
  entry once and reports whether the answer was saved.
- Lease heartbeats get the same single refresh and resend.
- Only instance IDs and capabilities are saved, and only header-valid IDs
  that echo neither the token nor the URL; a proxy answer needs its
  upstream ID.
- The transport failure and timeout builders join the abort guard in
  daemon-client-timeout.ts to keep the transport under its line limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r own file

The transport test file passed the 1000-line limit. The saved-health
cases and their remote fixture move unchanged to
daemon-client-transport-persisted-health.test.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Response to the review of 84d6878, fixed in 3dd9d76 and b28065b:

  • Timeout before send: a timeout whose connection never opened is marked by the transport and clears the saved entry. Test: saved entry, a requester that never connects, 50 ms timeout, file gone.
  • Mismatch resend: this needs a 409 with the mismatch header that the transport read. The same reason in an error body is neither probed nor resent. Every transport-proven mismatch clears the entry, including one on the resend. One test covers both.
  • Timeout eviction: this compares the endpoint and upstream IDs, and a caller abort never evicts. Test: a proxy whose upstream changes is evicted; a matching one is kept.
  • Forced refresh: the gate always probes live, so a refresh never reuses the saved answer, even when removal fails. Tested with a read-only state dir.
  • Single read: remote resolution reads the saved entry once and returns remoteHealthCached only on a hit. A miss goes straight to a live probe.
  • Heartbeats: upload lease beats get the same single refresh and resend, under the beat's own budget and signal. Tested.
  • Proxy upstream ID: a proxy answer is saved only with its upstream ID.
  • What's saved: only instance IDs and capabilities. An ID is saved only if it is at most 256 chars, a valid header value, and does not contain the token or URL.
  • Not blocking, taken: the docs wording now says "connection failure, server error, or a timeout the daemon did not answer", and the bare assert.rejects calls now assert the error reason or code. The guard and failure builders moved to daemon-client-timeout.ts to keep transport under its line limit without adding an eagerly loaded module.
  • Not blocking, kept: a daemon command failure (HTTP 500) still clears the entry, as ADR 0006 states.

Rollback (live check or version floor): not changed in this push. The maintainer is still choosing between opt-in persistence, a bounded entry age, or a conditional route that older peers refuse with 404 before dispatch.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 2 new findings on b28065b. The verdict and the full list are in the summary comment.

Comment thread packages/daemon-client/src/index.ts Resolved
@thymikee

Copy link
Copy Markdown
Member Author

The change at b28065b still needs fixes before merge: it does not typecheck, and two problems from the 84d6878 review remain. The rollback problem is still open, the credential echo is only partly fixed, and the other nine required fixes are closed.

A rollback can still dispatch to an incompatible daemon (daemon-client-lifecycle.ts:288). After a protocol 3 daemon is saved, the same URL and credential can move to a protocol 2 release that ignores the instance headers, or a current proxy can get a rolled-back upstream. The next CLI call then uses the saved health and sends the command. The base probes /health first and refuses with the typed protocol error, so this is a regression. A live compatibility check must run before dispatch whenever a peer can ignore the conditional headers. An enforced version floor on both proxy and upstream, a route that older peers refuse before dispatch, opt-in saving, or a bounded entry age can address this. A bounded age or any other remaining risk needs explicit maintainer acceptance in ADR 0006, and a recorded acceptance of the risk also resolves this point.

A second independent pass found that the refresh callback breaks compilation (daemon-client-transport.ts:502). SendRequestOptions.remoteHealthGate now takes a budget and a signal, but the gate parameter of resendAfterRemoteHealthGate still takes only the budget. This causes TS2345 at line 453 and TS2554 at line 514. Every function that receives this callback must use the same type, NonNullable<SendRequestOptions['remoteHealthGate']>, and the typecheck lists any site that does not.

A second independent pass found that the credential sent on /health can still be saved as an instance ID (saved health, line 56). A credential with surrounding whitespace is kept as is by the client but trimmed in the auth headers. If /health echoes the sent value in the endpoint or upstream instance ID, the raw substring check misses it and the ID is written in clear text. Every retained ID, both before saving and when read from disk, must be checked against the non-empty credential normalized the same way as in the auth header builder. A test with a padded credential should show that no entry is saved.

The gate parameter type thread still applies, as does one lower-priority open thread.

The Lint, Typecheck & Package, Numeric Ranges and Integration Tests jobs fail because of this change. All report the two type errors above, and the failing Integration Tests cases compile TypeScript doc examples that include this file.

Not verified here: local tests, the typecheck and the PR benchmark were not re-run, and the benchmark comes from 1771b6c, not this commit. The caller-abort guard in timeout eviction (line 379) was checked only by reading, with no test that aborts during that probe. The handling of a timeout on a reused keep-alive connection, which is treated as possibly sent, looks conservative but was not tested. attemptVerifiedOpen and the packages/remote callers beyond the sendRequest uses were not re-audited.

Before merge, please fix the type error so the three jobs pass, close the credential case, and resolve the rollback with a live check, a version floor, or a maintainer acceptance recorded in ADR 0006.

thymikee and others added 2 commits November 26, 2026 23:07
…the sent credential

- resendAfterRemoteHealthGate takes the gate as
  NonNullable<SendRequestOptions['remoteHealthGate']>, so the budget and
  signal it is called with type-check (TS2345/TS2554 at b28065b).
- An instance ID is checked against the credential as the auth header
  builder sends it (trimmed), before saving and when read from disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a budget

A command with no request timeout hands the gate no deadline, so its
/health probe ran its own window after the caller aborted. The resend
path now runs the gate under the request guard, which settles at once
with request_canceled and dispatched: no.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Response to the review of b28065b, at 015189f:

  • Typecheck: the gate parameter is now NonNullable<SendRequestOptions['remoteHealthGate']> (280b4de). A self-referencing initializer in a test fake that strict mode would reject is also fixed. tsc -b packages/daemon-client, which covers its tests, reproduces both CI errors on the old line and is clean now.
  • Credential echo: endpoint and upstream instance IDs are checked against the token exactly as buildDaemonHttpAuthHeaders sends it (trimmed), before saving and when read from disk. Test: a padded credential saves nothing, and an echoing upstream ID planted on disk reads as a miss.
  • Abort without a budget (Apex): the resend-path gate runs under the request guard, so an abort settles at once. Test added.
  • Rollback to a peer that ignores the instance headers: still open. My coordinator asked me not to change the persistence design while the maintainer decides between opt-in saving, a bounded entry age with the risk accepted in ADR 0006, or a conditional route older peers refuse before dispatch. It stays a blocker until that decision is recorded.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 015189f

Since the review of b28065b: 0 new · 0 still open · 2 no longer raised (2 marked fixed)

No open findings.

🔧 2 findings marked fixed in their threads
Finding Fixed by Where
Health gate is typed for one argument but called with two, so the package cannot typecheck thymikee 280b4de · reply
Health-gate probe runs without the caller's abort signal when the command has no request timeout thymikee 39b5386 · reply

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (3e0814c574f5).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

At 015189f, a saved /health entry can still send a command to a rolled-back peer that the base refuses before dispatch. The typecheck and credential-echo items from the earlier review are fixed. The rollback problem remains, as confirmed in the thread.

daemon-client-lifecycle.ts:284: ensureRemoteDaemon reads the saved entry and dispatches without a live probe. After a protocol 3 daemon is saved, the same URL and credential can move to an older release that ignores the conditional instance headers. A current proxy can also get an older upstream. The next CLI process then sends a possibly mutating command to an incompatible peer, while the base returns the typed protocol error first. The rule: a saved entry must not admit dispatch to a peer that may ignore those headers, unless a maintainer accepts that risk. Options are an enforced version floor on proxy and upstream, a conditional route that older peers refuse before dispatch, opt-in saving, or a bounded entry age with the remaining risk accepted in ADR 0006. A recorded acceptance in ADR 0006 alone also closes this. ADR 0006 has no such acceptance now. The next three paragraphs trace the cases.

For a direct daemon, a second independent pass found this route at daemon-client-lifecycle.ts:288. Health is saved from a protocol 3 daemon, then v0.21.16 replaces it at the same URL with the same credential. A new CLI process applies the saved instance ID and sends POST /rpc with the conditional header. The protocol 2 daemon ignores it and reaches its command handler. The base probes live and refuses the mismatch before POST /rpc. Can a persisted hit probe live before dispatch, unless the direct endpoint is independently guaranteed to honor the precondition?

For a proxy rollback, a second independent pass found this route at daemon-client-lifecycle.ts:288. Health is saved from a protocol 3 proxy and daemon, then a v0.21.16 proxy takes the same endpoint with the same client and upstream credentials. The next process skips /health. The old proxy forwards POST /rpc without checking its instance or forwarding the upstream precondition, and even a current upstream accepts an RPC with no expected instance. The base rejects the protocol 2 health response before dispatch. Can a persisted hit probe live first, unless the proxy has an independently enforced guarantee that it checks its own instance and forwards the upstream precondition?

For an upstream rollback, a second independent pass found this route at daemon-client-lifecycle.ts:288. Health is saved from a current proxy and protocol 3 upstream, the proxy stays up, and v0.21.16 replaces the upstream with the same credentials. The saved proxy ID still matches, so the proxy forwards the RPC and passes the saved upstream ID in a header that the old daemon ignores. The command reaches its handler. A live probe would report the upstream protocol, and the base refuses the mismatch before sending the command. Can a persisted hit probe live first, unless the upstream is also independently guaranteed to honor the precondition?

Two earlier threads no longer apply and can be resolved. The first is fixed because the gate type now matches its two-argument call, and the typecheck passes. The second is fixed because the gate now runs under the request guard, so a caller abort settles as request_canceled even when the probe has no budget.

The code jobs that failed on b28065b now pass. The only failing check is Body rules, which was cancelled. It validates only the PR description, so the failure is likely unrelated to the code, and a newer run after a description edit is the usual cause.

Not verified here: local type checks and the new tests were not re-run, and the relevant CI jobs pass. Abort settling was checked only by reading the code and the new test. It was not checked whether the abandoned unbudgeted probe keeps the CLI process alive until its internal timeout. The benchmark in the description comes from 1771b6c, and the later changes do not touch the measured hot path.

Before merge, the rollback problem needs a fix or a recorded maintainer acceptance in ADR 0006.

This branch has not been deployed

No deployments
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