[9.5](backport #7548) fix: handle index_not_found in token resolver to avoid spurious checkin errors - #7559
Conversation
…in errors (#7548) * fix: handle index_not_found in token resolver to avoid spurious checkin errors When .fleet-actions does not yet exist (new project with no agent actions) or has been deleted, a fleet-server restart clears the LRU ack-token cache. The subsequent cache-miss search on .fleet-actions returned an unhandled index_not_found_exception that propagated as an error to the agent check-in, logging "resolveSeqNo: elastic fail 404". Treat ErrIndexNotFound the same as ErrNotFound so the caller falls back to agent.ActionSeqNo gracefully. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: add changelog fragment for token resolver index-not-found fix Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit 12b3ede)
TL;DRThe failing Buildkite step ( Remediation
Investigation detailsRoot CauseThe pre-fetched log at
It does not include the specific failing test/package line, so a concrete code-level root cause cannot be proven from the available Buildkite evidence. I also checked the PR delta (backport of #7548):
These changes are narrow and local to token resolution behavior, and do not overlap with any visible failing output in the provided CI excerpt. Evidence
Verification
Follow-up
What is this? | From workflow: PR Buildkite Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
The backport target branches have an older MockBulk.Search that uses a
bare type assertion (args.Get(0).(*es.ResultT)), which panics when nil
is passed. Return an empty &es.ResultT{} instead so the mock handles
both the IndexNotFound and OtherError test cases without panicking.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
What is the problem this PR solves?
When
.fleet-actionsdoes not yet exist (e.g. a new project that has never had an explicit agent action), a fleet-server restart or a new fleet-server instance being spun up clears the in-memory LRU ack-token cache. The subsequent cache-miss triggers a search on.fleet-actionsviaTokenResolver.Resolve→dl.FindSeqNoByDocID.ErrIndexNotFoundwas not handled in this code path and propagated all the way up to the agent check-in handler, loggingresolveSeqNo: elastic fail 404: index_not_found_exception: no such index [.fleet-actions]on every check-in.How does this PR solve the problem?
Treats
ErrIndexNotFoundthe same asErrNotFoundinTokenResolver.Resolve, so the caller (resolveSeqNoinhandleCheckin.go) falls back toagent.ActionSeqNogracefully. This is consistent with how every other read path in fleet-server already handles a missing.fleet-actionsindex (e.g.findActionsHits,DeleteExpiredForIndex).How to test this PR locally
Start fleet-server against a cluster where
.fleet-actionsdoes not exist, enroll an agent, and verify check-ins succeed withoutresolveSeqNoerrors in the logs.Design Checklist
Checklist
./changelog/fragmentsusing the changelog tool🤖 Generated with Claude Code
This is an automatic backport of pull request #7548 done by Mergify.