Summary
A codebase-wide search for catch (OperationCanceledException) returns zero hits, confirming that cooperative cancellation is not implemented anywhere in cdidx. This is the umbrella reason behind several other filed issues (MCP handlers without CancellationToken, IndexCommandRunner.RunFullScan not cooperative, DbWriter backfill loops not cooperative, GitHubIssueReporter.TryCreateIssueAsync swallowing OperationCanceledException).
Evidence
cdidx search "OperationCanceledException" --lang csharp returns "No results found" against the full repo (main @ 2ee912d).
- A few sites pass a
CancellationToken along (e.g. ConsoleUi.StartSpinner), but none catch the exception or honour it cleanly.
Impact
- Ctrl-C,
--timeout, and MCP $/cancelRequest all degrade to "wait for the next file/row".
- No safety net for long jobs (indexing a monorepo, backfill, deep impact analysis).
- Tests cannot reliably wrap a cdidx call in a budgeted timeout.
Proposed direction
This is the design-level umbrella; once the per-site issues are fixed individually, the entry points (CLI dispatcher in ProgramRunner, MCP dispatcher in McpServer) should:
- Own a top-level
CancellationTokenSource.
- Wire
Console.CancelKeyPress to it.
- Plumb the token through every long-running call path.
- Catch
OperationCanceledException at the entry point exactly once and exit with a documented code (suggest CommandExitCodes.Cancelled = 130 to match POSIX).
Repro env
- Branch:
main @ 2ee912d (release v1.21.0)
Summary
A codebase-wide search for
catch (OperationCanceledException)returns zero hits, confirming that cooperative cancellation is not implemented anywhere incdidx. This is the umbrella reason behind several other filed issues (MCP handlers withoutCancellationToken,IndexCommandRunner.RunFullScannot cooperative,DbWriterbackfill loops not cooperative,GitHubIssueReporter.TryCreateIssueAsyncswallowingOperationCanceledException).Evidence
cdidx search "OperationCanceledException" --lang csharpreturns "No results found" against the full repo (main@ 2ee912d).CancellationTokenalong (e.g.ConsoleUi.StartSpinner), but none catch the exception or honour it cleanly.Impact
--timeout, and MCP$/cancelRequestall degrade to "wait for the next file/row".Proposed direction
This is the design-level umbrella; once the per-site issues are fixed individually, the entry points (CLI dispatcher in
ProgramRunner, MCP dispatcher inMcpServer) should:CancellationTokenSource.Console.CancelKeyPressto it.OperationCanceledExceptionat the entry point exactly once and exit with a documented code (suggestCommandExitCodes.Cancelled = 130to match POSIX).Repro env
main@ 2ee912d (release v1.21.0)