fix: handle index_not_found in token resolver to avoid spurious checkin errors - #7548
Conversation
…in 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>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
TL;DRThe failing Remediation
Investigation detailsRoot CauseFrom the provided artifact, this is currently infrastructure/observability gap in CI logs, not a confirmed code regression:
Because the artifact lacks the upstream error lines, there is not enough evidence to attribute this failure to the PR code changes. Evidence
Verification
Follow-up
What is this? | From workflow: PR Buildkite Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
|
Tick the box to add this pull request to the merge queue (same as
|
|
@Mergifyio backport 9.5 9.4 8.19 |
✅ Backports have been createdDetails
|
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