Context
Follow-up to #563, which introduced abort provenance and ensureTitle() background trace diagnostics on session export. Opus second-pass review flagged three P3 items that were deferred to keep that PR scoped to v1 diagnostics + #560 version fix.
Scope
Four small improvements to the diagnostic surface added in #563:
1. Log dropout when recordTitleTrace cannot find the assistant message
packages/opencode/src/session/prompt.ts polls up to 50 × 10ms for the assistant message before recording the title trace. If the message has not appeared within 500ms, the trace is silently dropped. Add a single elog.warn (or equivalent) on dropout so missing traces are observable from logs rather than silently absent from the export.
2. Either annotate or wire InterruptMeta.viaCtxAbort
The field is reserved but never set to true anywhere in v1 (the single cancel callsite explicitly sets viaCtxAbort: false). Either:
- Annotate it as reserved-for-future so the next reproduction reader does not interpret "always false" as evidence; or
- Hook
ctx.abort paths to set it correctly.
3. Add explicit title_generation_state correlation in the abort diagnostic
Currently abort.recorded_at and title_generation.completed_at are independent fields. To answer "was ensureTitle() still in flight when the main run was aborted?", a reader must join two structured records on timestamps.
Add a snapshot field to the abort diagnostic:
abort: {
...
title_generation_state: "not_started" | "in_flight" | "completed_before_abort" | "completed_after_abort"
}
so the temporal relationship is immediately visible in the export.
4. Keep title_generation.applied consistent with setTitle() success
packages/opencode/src/session/prompt.ts currently records applied: true on the success path without separately proving that sessions.setTitle(...) actually succeeded. If setTitle() fails after title generation succeeds, the export can claim the title was applied when it was not.
Update the flow so recordTitleTrace({ applied: true }) only happens when sessions.setTitle(...) succeeds, and record applied: false (with error context when available) on failure.
Acceptance
- A log line is emitted when
recordTitleTrace cannot locate the assistant message within the polling window.
InterruptMeta.viaCtxAbort either reflects an actual ctx.abort path or is annotated as reserved with a code comment.
- The
abort diagnostic block contains an explicit title_generation_state field with one of the four values above.
title_generation.applied is only true when sessions.setTitle(...) actually succeeds.
Priority
P3 (ergonomic polish for diagnostic surface; not blocking any user-visible behavior). Pick up when the diagnostic surface from #563 is needed for an actual reproduction and the missing correlation slows down RCA.
Refs
Context
Follow-up to #563, which introduced abort provenance and
ensureTitle()background trace diagnostics on session export. Opus second-pass review flagged three P3 items that were deferred to keep that PR scoped to v1 diagnostics + #560 version fix.Scope
Four small improvements to the diagnostic surface added in #563:
1. Log dropout when
recordTitleTracecannot find the assistant messagepackages/opencode/src/session/prompt.tspolls up to 50 × 10ms for the assistant message before recording the title trace. If the message has not appeared within 500ms, the trace is silently dropped. Add a singleelog.warn(or equivalent) on dropout so missing traces are observable from logs rather than silently absent from the export.2. Either annotate or wire
InterruptMeta.viaCtxAbortThe field is reserved but never set to
trueanywhere in v1 (the single cancel callsite explicitly setsviaCtxAbort: false). Either:ctx.abortpaths to set it correctly.3. Add explicit
title_generation_statecorrelation in theabortdiagnosticCurrently
abort.recorded_atandtitle_generation.completed_atare independent fields. To answer "wasensureTitle()still in flight when the main run was aborted?", a reader must join two structured records on timestamps.Add a snapshot field to the
abortdiagnostic:so the temporal relationship is immediately visible in the export.
4. Keep
title_generation.appliedconsistent withsetTitle()successpackages/opencode/src/session/prompt.tscurrently recordsapplied: trueon the success path without separately proving thatsessions.setTitle(...)actually succeeded. IfsetTitle()fails after title generation succeeds, the export can claim the title was applied when it was not.Update the flow so
recordTitleTrace({ applied: true })only happens whensessions.setTitle(...)succeeds, and recordapplied: false(with error context when available) on failure.Acceptance
recordTitleTracecannot locate the assistant message within the polling window.InterruptMeta.viaCtxAborteither reflects an actualctx.abortpath or is annotated as reserved with a code comment.abortdiagnostic block contains an explicittitle_generation_statefield with one of the four values above.title_generation.appliedis onlytruewhensessions.setTitle(...)actually succeeds.Priority
P3 (ergonomic polish for diagnostic surface; not blocking any user-visible behavior). Pick up when the diagnostic surface from #563 is needed for an actual reproduction and the missing correlation slows down RCA.
Refs
#PawWork:cf774289(Slock task feat: unify session right utility panel #32).