Skip to content

fix(cli): propagate caller cancellation through lifecycle orchestration #2151

Description

@cristim

Summary

PR #2139 makes caller cancellation terminal in the engine-version query, but the CLI orchestration does not propagate a cancelable invocation context into that query.

Current behavior

At reviewed head 7a4ba460d5950333b6a0b60efd6234e1d64dbf81, cmd/main.go:382 creates context.Background(). cmd/multi_service.go:764 also invokes queryMajorEngineVersions with context.Background(), then converts any query error into an empty lifecycle map. cmd/multi_service_helpers.go similarly warns and substitutes an empty map on query failure. The query's repaired cancellation contract therefore does not establish CLI-wide SIGINT cancellation handling.

Steps to verify

Trace the command context through the CSV and recommendation paths to queryMajorEngineVersions. Exercise a canceled parent context with realistic local SDK fixtures and assert that orchestration stops instead of treating missing lifecycle data as a completed query. No live purchase is needed.

Expected behavior

Propagate a cancelable invocation context to API fan-out and treat caller cancellation/deadline expiry as terminal at orchestration boundaries. Keep deliberately recoverable provider errors separate.

Proposed fix

Reuse the existing shutdown/signal handling in cmd/multi_service.go when threading the invocation context from cmd/main.go into the CSV and recommendation paths. Review filterAndAdjustRecommendations and the lifecycle query caller in cmd/multi_service_helpers.go before changing signatures. Add failing-first tests through those actual paths for cancellation, deadline expiry, and active-context provider errors.

Severity: medium. References: #1325, PR #2139. This is an existing orchestration gap, separate from the narrowly repaired query function.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions