Skip to content

Label search rebuild: async path loses MDC and has no retry/observability #597

Description

@shychee

Follow-up from PR #592 review (thanks @XiaoSeS).

PR #592 fixes the core correctness issue (label changes now reliably update the search index, even on the CallerRuns fallback, via REQUIRES_NEW). Two non-blocking robustness gaps were raised in review and are tracked here:

1. MDC lost across the async hop

LabelSearchSyncService.rebuildSkill / rebuildSkills run on skillhubEventExecutor. The request MDC context (trace/request id) is not propagated to the executor thread, so rebuild logs cannot be correlated with the originating request.

Suggested fix: configure an MDC-propagating TaskDecorator on skillhubEventExecutor in AsyncConfig.

2. Async rebuild failures are log-only, no retry / no metric

On failure the rebuild only logs:

log.error("Failed to rebuild search document for skill {}", skillId, ex);

There is no retry and no metric, so a search document can stay permanently stale after a transient failure with nobody noticing.

Suggested fix: add a counter metric for rebuild failures (and optionally a bounded retry / compensation path), so stale indexes are observable.

Scope

Robustness / observability only — no correctness impact. The index write itself is already correct after #592.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/s小改动或边界明确 / Small or well-bounded change.priority/p2中优先级 / Medium priority triage bucket.triage/needs-info需要补充更多信息后才能分流 / Issue needs more detail before it can be routed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions