Skip to content

fix(keepalive): no ping while the session has a request in flight; failed pings stop and trip the route - #527

Merged
amiddavid merged 12 commits into
mainfrom
lc-default/ka-fixes
Oct 14, 2026
Merged

amiddavid merged 12 commits into
mainfrom
lc-default/ka-fixes

Conversation

@OsherElhadad

@OsherElhadad OsherElhadad commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #524. Two keep-alive fixes found while testing the lifecycle signals with real sessions.

(a) No ping while a request of the same thread is in flight

The keeper counts each thread's real requests between arrive and record, keyed like the held entries. A due ping waits only while its own thread has a request open, for example two overlapping requests of one thread. Other threads are never held back: a subagent's slow request does not delay the main thread's ping, so a session-wide pause cannot let the main cache expire. A request leaves the count only after its hold is stored. If a count ever leaked, that thread would stop pinging, which costs nothing. No case needs a session-wide pause, because the compaction call stays on the main thread (#519).

(b) A ping that gets no usable answer is a failure; transient errors and real misses are not

  • Transient: a 429 or any 5xx (for example a 529 overload). Counted skipped and booked. Nothing stops, the route breaker is untouched, and the next ping slot retries.
  • Credential refused: a 401/403 is about the key, not the route. A 401 blocks the credential on every model for an hour. A 403, which is often a per-model permission or a gateway policy or budget refusal, blocks only that credential on that model. Every session pinging with a blocked credential stops, and new holds with it are refused. A teammate's sessions on the same account, route and model ping on. The credential is identified by an HMAC-SHA256 of the full auth header values, under a random per-process key that is held only in memory and never logged, stored or exported.
  • Failed: any other non-retryable 4xx, or a 2xx with no usage at all (no input, no cache read, no cache write). An example of the second is a translating gateway that relays the provider's refusal as a 200. The session is not pinged again. Three failures in a row for the same account, upstream and model switch the keep-alive off for that route, for that account only, for an hour (route_trips in /stats). A successful ping or a miss resets the count.
  • Missed: a ping that landed after expiry and read nothing, but billed input (OpenAI) or wrote the prefix again (Anthropic). It did refresh the cache, so it is counted missed, pinging goes on and the route is not tripped. A second miss in a row means the prefix does not match, and the session stops.

Eligibility. Native Anthropic (*.anthropic.com), Bedrock and Vertex upstreams are eligible by type, whatever the deployment is called (ARNs, inference profiles, aliases). The Anthropic route forwarded to any other host (LiteLLM, a corporate gateway) may serve another family there, such as an OpenAI or Azure model with no explicit cache control. On those relays only, the model name must contain claude, opus, sonnet or haiku, or match CONTEXT_GURU_KEEPALIVE_MODELS. The failed-ping breaker is the backstop for a Claude-named alias of another family.

Tests

  • TestASlowSubagentRequestDoesNotDelayTheMainThreadsPing (end to end, slow upstream: the main ping fires on time while a subagent request is open; fails with a session-wide count) and TestAnOpenRequestOnTheSameThreadPausesItsPing (fails without the pause).
  • TestPingThatRefreshesNothingFailsAndTripsTheRoute: empty-usage pings are counted failed, the session stops, the route trips, a tripped route holds nothing, another route is unaffected, and the trip expires.
  • TestARealMissIsNotAFailedPing (miss, read, miss, miss: pinging continues after one miss and stops after two; nothing failed, no trip), TestPingFailureNeedsNoUsageOrAnError (no usage and a 401 fail; a 5xx, a 429, an OpenAI miss and an Anthropic miss do not), TestOverloadedPingsDoNotTripTheRoute (529/429: every session retried at its next slot, nothing failed, no trip), TestKeepAliveNameCheckIsForRelaysOnly (native Anthropic alias, Bedrock/Vertex ARNs pass; relay names checked; a look-alike host is a relay), TestKeepAliveModelAliasesFromTheEnvironment, TestAuthRefusalStopsOnlyThatCredential (a revoked key's other sessions stop and new holds are refused; the teammate pings on; a rotated key is held; no route trip), TestCredentialIDsDoNotCollideOnAMask, TestA403BlocksTheKeyOnThatModelOnly (403: the key keeps pinging on another model; 401: blocked on both; forget clears the marks), TestBreakerCountsA4xxForgetClearsItAndAnOpenAIDoubleMissStops.
  • TestPingThatWritesInsteadOfReadingStopsTheSession now uses a partial read; a zero read is a miss first.
  • go test ./proxy passes. TestKeeperSurvivesASideRequestsArrival now finishes its side request before the sweep.

Live check (real Claude Code 2.1.296, Anthropic route -> LiteLLM -> Azure gpt-5-mini, experimental proxy)

  • With gpt-5-mini as the model name, nothing is held and no pings are sent.
  • With a Claude-named LiteLLM alias of the same model, each session's first ping got HTTP 400 at Azure, relayed as a 200 with no usage. It was counted failed, and that session was not pinged again. After three such sessions the route tripped, and a fourth session was not held and got no pings.
  • /compact still releases the old prefix, and no ping was sent during it. That compaction was shorter than the idle interval, so the in-flight case is covered by the slow-upstream test.

@OsherElhadad
OsherElhadad force-pushed the lc-default/ka-fixes branch 2 times, most recently from 56e7df4 to a7a4c22 Compare October 13, 2026 19:53

@OsherElhadad OsherElhadad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review: REQUEST CHANGES at da2f351. (Posted as a comment: GitHub does not let the author account request changes.)

Verified:

  • gofmt and go vet are clean. go test ./proxy passes in full (nice 10). Both commits are by Osher-Elhadad and signed off, with no AI attribution, and the PR text has no figures.
  • Mutations:
    • Each of these makes a new test fail: the in-flight skip in sweep, the failed-ping branch in fire, claudeModel forced true, and the tenant dropped from kaRouteKey.
    • With the arrive increment removed, TestNoPingWhileARequestOfTheSessionIsInFlight hangs until the 10 min go test timeout instead of failing. Give it a deadline.
  • In-flight pairing. arrive (proxy.go, inside the pipeline closure, which recovers) runs only with a non-empty session. serve always follows, and its defer calls record, which calls departed first with the same tenant and session. Errors, client cancel and streaming aborts all end serve and run the defer, and the same holds on the OpenAI path and for tenants with keep-alive off. Only a panic in serve before the defer is registered (its first ~60 lines) would leak a count, and the cost is that session is never pinged.
  • Eviction case. A ping that reads 0 and writes the prefix still takes the CacheWrite > CacheRead branch first: it is counted wrote, the session stops, and the route breaker is not touched. That is right. A stop lasts until the session's next real request, which re-arms a fresh entry.
  • Breaker key. It includes the tenant (da2f351), so one tenant cannot switch off another. A revoked key (4xx) only stops that session, as before.

Blocking:

  1. A transient 5xx now stops the session and counts toward the 1 h trip. The new branch fires on status/100 != 2, which includes the 5xx statuses that pass the 4xx check above. That reverses the existing rule, whose comment two lines up still says "A 5xx is transient and the next ping may work". Under a provider overload burst (529s), three sessions' pings fail in a row and keep-alive goes off for that tenant, upstream and model for an hour, which turns a short provider blip into an hour of cache misses. Count only a 2xx that read nothing (status/100 == 2 && CacheRead == 0) as failed and toward the breaker. Leave 5xx and 429 as before: the next ping may work. Add a test that three 529 pings do not trip the route.
  2. The name test also drops real Claude deployments on Bedrock and Vertex. claudeModel gates every case of the first switch arm: Anthropic, Bedrock, BedrockMantle and Vertex. A Bedrock application inference profile (arn:aws:bedrock:…:application-inference-profile/<id>) or a custom gateway alias has no Claude word, so it silently loses keep-alive. The problem you are solving is a non-Claude model on the Anthropic route behind LiteLLM. Apply the name test only to bschemas.Anthropic, where the route breaker already catches a mislabelled alias. On Bedrock and Vertex the provider is the Claude evidence. Also check whether any client sends a tier name such as Bob's premium on the Anthropic route.

Non-blocking:
3. Pair the in-flight count where it is raised: defer h.keeper.departed(...) right after arrive in the caller, instead of inside record. Then no panic path can leak a count, and record keeps one job.
4. routeTripped and routeFails are never pruned, and tenant purge (forget) does not clear them or inflight. They are bounded by tenants × routes × models, so this is small, but delete expired trips when they are read, and clear a tenant's keys in forget.
5. routeIsTripped takes k.mu on every real request's record. That is cheap, but it could move inside the critical section record already enters.
6. The docs line "3 in a row switch the keep-alive off for that upstream and model" should say per account, to match the code.

@OsherElhadad OsherElhadad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Re-review: APPROVE at c85907f. (Posted as a comment: GitHub does not let the author account approve.)

Both blockers from the review at da2f351 are fixed:

  1. Transient errors. A 429 or any 5xx (including 529) is counted skipped: the audit row is kept, nothing stops, the breaker is untouched and the next slot retries. Making the branch non-transient, or dropping 429 from it, fails TestOverloadedPingsDoNotTripTheRoute and TestPingFailureNeedsNoUsageOrAnError.
  2. Name check. It now runs only for the Anthropic route forwarded to a host other than anthropic.com / *.anthropic.com. Bedrock, BedrockMantle and Vertex qualify by type, and so does native Anthropic under any model name. Applying the check to every provider, or name-checking native hosts, fails TestKeepAliveNameCheckIsForRelaysOnly. A look-alike host (evil-anthropic.com.example) counts as a relay. With CONTEXT_GURU_KEEPALIVE_MODELS ignored, TestKeepAliveModelAliasesFromTheEnvironment fails.

Other changes, verified:

  • A non-retryable 4xx stops the session and counts toward a breaker keyed by tenant + upstream + model. With the tenant removed from the key, TestPingThatRefreshesNothingFailsAndTripsTheRoute fails. A 2xx with no usage counts as a failure: removing that branch fails two tests.
  • A real miss is counted missed and pinging continues. Making it stop immediately fails TestARealMissIsNotAFailedPing, and a second Anthropic miss stops the session through the wrote guard.
  • The in-flight skip: removing the arrive increment now fails at once ("the slow request never arrived") instead of hanging. Every arrive (proxy.go, before serve) reaches serve's deferred record with no return in between, and departed runs first in record.
  • Expired trips are pruned on the next failure, and forget clears the tenant's breaker state.
  • gofmt and go vet are clean, and go test ./proxy passes in full (nice 10). All 5 commits are by Osher-Elhadad and signed off, with no AI attribution. The PR text and docs have no numbers.

Non-blocking test gaps (each mutation below still passes every test):

  • A 4xx counting toward the breaker: with routeFailed removed from the 4xx branch, nothing fails. TestPingFailureNeedsNoUsageOrAnError checks failed but not route_trips.
  • forget clearing routeTripped.
  • The OpenAI double miss: with || u.CacheRead == 0 removed from the guard, nothing fails, because an Anthropic miss writes and hits CacheWrite > CacheRead anyway. Also, the stop is then logged as "CREATED a cache entry", which reads oddly for OpenAI.
  • A host like evilanthropic.com (suffix with no dot) is not in the table. The code is right; the test does not pin it.

Note: three 401s from one user's revoked key switch the keep-alive off for that account's route + model for an hour, including for teammates on the same account. That is documented ("for that account only") and acceptable; just flag it in the docs if accounts are shared by several people.

@OsherElhadad OsherElhadad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Re-review: APPROVE at 087e102. It covers 4808d44, c9b5902, 74d615a and 087e102. (Posted as a comment: GitHub does not let the author account approve.)

Verified:

  • Credential-dead behaviour. A 401 or 403 on a caller-pays hold marks that credential dead for 1 h. The sweep stops every entry pinging with it, record refuses new holds with it, and a teammate on the same account pings on. A server-held key (up.setKey) has no credential id, so its 401 still goes to the route breaker. Each of these mutations makes a test fail:
    • removing the sweep check;
    • removing the record refusal;
    • removing markCredDead;
    • collapsing credKey to the tenant alone, which is the teammate-collision case (fails TestAuthRefusalStopsOnlyThatCredential and TestCredentialIDsDoNotCollideOnAMask).
  • Secret handling. credKey is an HMAC-SHA256 under a random 32-byte key per process, over the masked header values. No plaintext copy is made, the key is never stored, and the id is never logged or exported: the new slog line has no cred field, and it appears in no metric or debug route.
  • Map bounds. credDead is pruned of expired marks on every new mark, and forget(tenant) clears the tenant's marks by prefix.
  • gofmt and go vet are clean, and go test ./proxy passes in full (nice 10). All 4 commits are by Osher-Elhadad and signed off, with no AI attribution. The PR body has no figures.

Non-blocking:

  1. A 403 is not always a dead key. Anthropic answers 403 permission_error when a key may not use one model or feature, and gateways use 403 for per-key budget or policy refusals. As written, one such ping stops keep-alive for that key on every model and route for an hour. Real requests are unaffected; only holds stop. Consider marking only on 401, or keying a 403 on credential + model.
  2. Bedrock SigV4. The Authorization value carries a per-request date and signature, so every hold gets its own credential id, and a dead mark only ever matches its own entry. That is harmless: it degrades to the old per-session stop, and replaying a stored SigV4 header fails anyway. Worth one line in the comment so no one relies on cross-session matching there.
  3. forget clearing credDead is untested. Removing that loop still passes every test. A one-line assertion in the existing forget test would pin it.
  4. credDead has no count cap. It is bounded in practice by holds (512) times ping cycles per hour, which is fine; a ponytail: note would record the ceiling.

@OsherElhadad OsherElhadad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Re-review: APPROVE at ac5515d. (Posted as a comment: GitHub does not let the author account approve.)

  • fb4bb94: departed is now deferred to the end of record, so a request leaves the in-flight count only after its hold is stored.
  • ac5515d: a 403 marks only (credential, model), and a 401 marks the credential on every model. With the 403 special case removed, TestA403BlocksTheKeyOnThatModelOnly fails. It also pins that forget clears the marks.
  • The SigV4 comment and the note on the missing count cap are in.
  • gofmt and go vet are clean, and the -race keep-alive, credential and signal subset passes. Both commits are signed off with no AI attribution.

Approved.

@OsherElhadad OsherElhadad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Re-review: APPROVE at 9e0295f. This is a rebase only: git range-diff against the approved ac5515d shows all 11 patches identical (=). go test ./proxy passes in full on this head, along with the thread, dash signal and plugin signal tests and the Codex tests. CI is green, and the commits are signed off. Approved. Merge after #524.

@amiddavid

Copy link
Copy Markdown
Collaborator

Summary

One concern about fix (a), "no ping while the session has a request in flight". It pauses pings for every thread of the session while any request of the session is in flight. That can bring back the gap that per-thread keep-alive (#426) closed. Fix (b), the failed-ping rules, has no problem from my side.

What we found

sweep skips a due entry when k.inflight[kaKey(e.tenant, e.session)] > 0 (proxy/keepalive.go, about line 1123). The count is per session, not per thread.

  • While subagents work, the main thread's ping waits for a moment when no subagent request is open.
  • On the internal LiteLLM gateway, requests took up to 103 s on 2026-10-13 (the debug log of the laptop proxy). The main ping is due at 270 s. If a subagent request runs from 260 s to 340 s, the main cache expires at 300 s before the ping can fire. With 2 or more subagents working in parallel, moments with no open request are rare.
  • Before feat(keepalive,dash): key cache attribution and keep-alive per thread #426, keep-alive kept only one thread per session warm. On production data, that was the cause of 74% of idle gaps that went without a ping. A session-wide pause has the same shape.

I reasoned this from the code. I did not run a test that shows a missed ping.

Why the stated reason is mostly gone

The motivation is a long /compact on another thread while the main thread's entry is due. After #519 (merged), the compaction call stays on the main thread. Its arrival already clears the main thread's entry, so no ping of the old prefix can fire during the call.

Proposal

  1. Count requests in flight per thread key, the same key arrive and record use, and pause only that thread's ping.
  2. Add a test: main thread entry due, a subagent request in flight for longer than the remaining TTL, and the main ping still fires on time.
  3. If a session-wide pause is still wanted for some case, state the case. Then limit the pause to requests that can change that thread's prefix.

Posted by an AI assistant (Claude), for the release integrator.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verdict

Not ready to merge as is. One defect (finding 1). The failed-ping rules are correct.

Findings

  1. A long call on one thread stops the main thread's ping until its cache is already gone. proxy/keepalive.go:1123 skips every due entry of a session while k.inflight[kaKey(tenant, session)] > 0. The count is per session, not per thread. This confirms the concern in #527 (comment).
    • Failing case (test I wrote, it fails on the PR code): main thread entry due at 60 s idle (cache life 300 s). A request on another thread (the "SUMMARIZE" call of the PR's own test) stays in flight. I sweep at t=61 s and t=299 s. Result: 0 pings before the main cache expires. The test wants 1.
    • After the slow call ends (t=301 s) the sweep then sends the ping. The cache is already gone, so the ping is a miss and writes the prefix again. That costs money and saves nothing. Nothing caps the wait, because due() has no upper bound (keepalive.go:359).
    • Real default: ping at 270 s, cache life 300 s. One subagent or compact request that is in flight for more than 30 s at that moment is enough. Long Opus calls do this. Before the PR the ping went out on time.
    • Proposed fix: (a) count in flight per thread (kaThreadKey) instead of per session. A compact on another thread is already handled by #520, which retires the main thread on the compact signal. (b) Also cap the wait. If the entry would expire within one sweep tick, ping anyway. Then a leaked count cannot make the main cache expire.
  2. No other defect found in the in-flight count. arrive is called at proxy.go:1249. Between it and serve there is no return. serve always runs record in a defer (proxy.go:1590), and record runs departed (keepalive.go:740). A leak is not reachable on a normal path.

What I verified

  • New test TestReviewMainPingFiresWhileSubagentCallInFlight (not pushed): fails on the PR code, "0 pings (t=299s)", 1 ping at t=301 s.
  • Mutation: removing the in-flight check makes TestNoPingWhileARequestOfTheSessionIsInFlight fail ("1 pings while ... in flight"). The PR's test is real.
  • go test -race ./proxy/ (whole package, box 1): pass, 411 s.
  • A ping transport error (timeout, issue #532) does not trip the breaker and does not stop the session. In fire, err != nil only does failed++ and returns (keepalive.go:1262). routeFailed, markStopped and markCredDead are not called. The next slot retries. Note: the ping still counts toward MaxPings, because sweep increments e.pings before the send. Two timeouts use up a 2-ping budget.
  • 429 and 5xx: counted skipped, no stop, no breaker. 401/403 block the credential, not the route. Other 4xx and empty-usage 2xx trip the route after 3. A real miss resets nothing and does not trip.
  • The credential id is an HMAC under a per-process key. It is not logged or exported.
  • Stack: this PR touches keepalive.go, clientsignal.go and tests. Rebase on #524 and then main should be clean. #521 changes keeper.record (campaign hook), so watch the defer order there.

Questions

  1. Is a cap on the wait in scope for this PR, or a follow-up? I think it belongs here, because the PR adds the wait.

Reviewed by an AI reviewer (Claude)

@OsherElhadad

Copy link
Copy Markdown
Collaborator Author

@amiddavid thanks. The fix is in 6bf5248.

1. Per-thread count. Done. The in-flight count now uses the same thread key that arrive and record use (kaThreadKey), and sweep waits only while the entry's own thread has a request open. The record-after-store ordering from fb4bb94 still applies per thread: departed is deferred to the end of record with that thread's key.

2. Tests (both pass with -race):

  • TestASlowSubagentRequestDoesNotDelayTheMainThreadsPing runs end to end through the handler with a slow upstream. The main thread's entry is held. A subagent request (x-claude-code-agent-id: sub1) stays in flight past the main thread's idle time, and the main ping still fires on time. With the old session-wide count it fails with "0 main-thread pings".
  • TestAnOpenRequestOnTheSameThreadPausesItsPing: two requests of one thread overlap. The first one's hold is not pinged while the second is open, and is pinged once the second ends. Without the pause it fails with "1 pings while another request of the same thread was open".
  • The test I had before (no ping while a /compact-shaped side request was in flight) is replaced: it asserted the session-wide behaviour you flagged.

3. Does any case still need a session-wide pause? No. The motivating case was a long compaction call on another thread while the main entry was due. After #519 the compaction call stays on the main thread, and its arrival clears and pauses that thread itself. The per-thread pause still covers overlapping requests of one thread.

Checks: go vet ./proxy ./dash ./internal/thread is clean, go test ./proxy ./dash ./internal/thread passes, the full ./proxy suite passes, and a -race run of the keep-alive, signal and thread tests passes. I did not do a live check for this change: the slow-upstream test reproduces the case directly.

@OsherElhadad OsherElhadad left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Re-review: APPROVE at 6bf5248 (addresses the per-thread in-flight comment). (Posted as a comment: GitHub does not let the author account approve.)

  • arrive, record's deferred departed and the sweep check now all use kaThreadKey(tenant, session, threadID). serve passes the same session and threadID to arrive and to record, so the counts pair up. departed deletes at count 1 or below and never goes negative.
  • Mutations. With all three switched back to the session-wide key, TestASlowSubagentRequestDoesNotDelayTheMainThreadsPing fails. With the pause removed entirely, TestAnOpenRequestOnTheSameThreadPausesItsPing fails.
  • gofmt and go vet are clean, and the -race keep-alive, ping, signal and compact subset of ./proxy passes. CI is green, and the commit is signed off with no AI attribution.

This approval covers 6bf5248.

Osher-Elhadad added 12 commits October 14, 2026 21:27
…iled pings stop and trip the route

A due ping waits while any real request of the same session is in flight (a long /compact call).
A ping that reads nothing from the cache (200 with no usage, or a relayed 5xx) counts as failed,
stops that session, and three in a row switch the keep-alive off for that upstream and model for
an hour. On the Anthropic-shaped route only Claude models are held.

Signed-off-by: Osher-Elhadad <[email protected]>
…del aliases from the environment

Failure is a non-2xx or a 200 with no usage at all. A ping that read nothing but billed input or
wrote the prefix (it landed after expiry) is counted missed: pinging goes on and the route does not
trip; a second miss in a row is a prefix mismatch and stops the session, as a partial read always
did. CONTEXT_GURU_KEEPALIVE_MODELS adds model names for aliases that do not name a Claude model.

Signed-off-by: Osher-Elhadad <[email protected]>
…s for the Anthropic route only

Only a 2xx with no usage fails a ping and counts toward the route breaker; an overload burst
(529) does neither. Bedrock and Vertex are not name-checked, so inference-profile ARNs keep their
keep-alive. Expired trips are pruned and an account's breaker state goes with forget. The in-flight
test fails instead of hanging when the count is broken.

Signed-off-by: Osher-Elhadad <[email protected]>
…heck applies to relays only

A 429 or any 5xx (a 529 overload) is transient: counted skipped, booked, and the next slot
retries; nothing stops and the route breaker is untouched. A non-retryable 4xx and a 2xx with no
usage are the failures. Native Anthropic, Bedrock and Vertex upstreams are eligible by type; only
the Anthropic route forwarded to another host (LiteLLM, a gateway) needs a Claude model name or a
CONTEXT_GURU_KEEPALIVE_MODELS alias.

Signed-off-by: Osher-Elhadad <[email protected]>
…ip, the OpenAI double miss, a look-alike host

Signed-off-by: Osher-Elhadad <[email protected]>
…so another test's price table cannot skip its hold

Signed-off-by: Osher-Elhadad <[email protected]>
…t the account's route

An auth refusal marks the credential (a hash of the masked auth slots) for an hour: every session
pinging with it stops and new holds with it are refused, while a teammate's sessions on the same
account, route and model ping on. The route breaker keeps no-usage 200s and other non-retryable
4xx. A server-held key has no credential id and still counts toward the route.

Signed-off-by: Osher-Elhadad <[email protected]>
…ue under a per-process key

Adds a test with two keys that share every character a display mask keeps.

Signed-off-by: Osher-Elhadad <[email protected]>
…old is stored

departed is deferred to the end of record, so a ping can never see the session idle between the
response and the hold. The in-flight test waits for record (it runs after the client has its
response) and uses an in-memory dashboard; it passed 40 runs in a row and the full suite 3 of 3.

Signed-off-by: Osher-Elhadad <[email protected]>
…ry model

A 403 is often a per-model permission or a gateway policy or budget refusal, so it marks the
(credential, model) pair; a 401 still marks the credential. Tests cover a 403 on one model leaving
the key pinging on another, a 401 blocking both, and forget clearing the marks.

Signed-off-by: Osher-Elhadad <[email protected]>
The in-flight count was per session, so while any subagent request was open no thread of the
session was pinged, and a slow gateway request could let the main thread's cache expire. It is now
per thread (the key arrive and record use), and the record-after-store ordering holds per thread.
No case needs a session-wide pause: the compaction call stays on the main thread.

Signed-off-by: Osher-Elhadad <[email protected]>
@amiddavid
amiddavid force-pushed the lc-default/ka-fixes branch from 6bf5248 to 693192b Compare October 14, 2026 18:39
@amiddavid
amiddavid changed the base branch from lc-default/public to main October 14, 2026 18:39
@amiddavid
amiddavid merged commit 83d33ea into main Oct 14, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants