Root span ends before command completes for generator-based commands.
What happens
The CLI wraps command execution in a Sentry.startSpanManual root span (cli.command op) in src/lib/telemetry.ts:208. For commands using the async *func generator pattern (like plan and explain), the root span appears to end before the generator is fully consumed — resulting in traces with only a single span and sub-millisecond duration despite the command running for much longer.
Evidence
Trace for a sentry issue plan invocation that showed progress spinners and polled for a solution:
- Trace:
b7f06e739b304d96afd6fe58801d3c26
- Project:
sentry/cli (project id 4510776311808000)
- Event:
168087f80b3e438794a36cd4067f8b7f
- Observed: 1 span, 2.457ms duration, no child spans (HTTP calls, polling)
- Expected: full command lifecycle including
getAutofixState, triggerSolutionPlanning, and polling loop
Impact
- CLI command performance data is unreliable — traces don't capture actual duration or child operations
- Debugging Seer/autofix integration issues from Sentry is impossible without accurate traces
Likely cause
The cli.command root span wraps the callback return in startSpanManual, but the generator-based command pattern (async *func + yield CommandOutput) may resolve the callback promise before the generator is fully drained. The span's finally block calls span.end() at that point.
References
src/lib/telemetry.ts:208 — startSpanManual root span
src/commands/issue/plan.ts — async *func generator pattern
src/lib/command.ts — command runner that consumes the generator
Action taken on behalf of Burak Yigit Kaya.
Root span ends before command completes for generator-based commands.
What happens
The CLI wraps command execution in a
Sentry.startSpanManualroot span (cli.commandop) insrc/lib/telemetry.ts:208. For commands using theasync *funcgenerator pattern (likeplanandexplain), the root span appears to end before the generator is fully consumed — resulting in traces with only a single span and sub-millisecond duration despite the command running for much longer.Evidence
Trace for a
sentry issue planinvocation that showed progress spinners and polled for a solution:b7f06e739b304d96afd6fe58801d3c26sentry/cli(project id4510776311808000)168087f80b3e438794a36cd4067f8b7fgetAutofixState,triggerSolutionPlanning, and polling loopImpact
Likely cause
The
cli.commandroot span wraps thecallbackreturn instartSpanManual, but the generator-based command pattern (async *func+yield CommandOutput) may resolve the callback promise before the generator is fully drained. The span'sfinallyblock callsspan.end()at that point.References
src/lib/telemetry.ts:208—startSpanManualroot spansrc/commands/issue/plan.ts—async *funcgenerator patternsrc/lib/command.ts— command runner that consumes the generatorAction taken on behalf of Burak Yigit Kaya.