Skip to content

diag(TEMP): stderr trace through plugin shutdown + forceFlush#77

Merged
Alezander9 merged 1 commit into
mainfrom
alex/v4-shutdown-hook-diagnostics
May 17, 2026
Merged

diag(TEMP): stderr trace through plugin shutdown + forceFlush#77
Alezander9 merged 1 commit into
mainfrom
alex/v4-shutdown-hook-diagnostics

Conversation

@Alezander9
Copy link
Copy Markdown
Member

@Alezander9 Alezander9 commented May 17, 2026

Temporary diagnostic instrumentation to localize why the bcode-laminar turn parent span still isn't landing in cloud V4 traces after v0.1.8-rc1 and rc2.rc2 trace 5a5bfaf8-dfa6-9678-d497-f1ef6ac3fde4: still top_span_landed=False, total_cost=0, 1 orphan parent (00000000-0000-0000-454f-11815e103257) referenced by all session.llm children. Same shape as rc1.Adds process.stderr.write calls in:``- src/index.ts top-level finally: log pluginShutdownHooks.size, per-hook invocation success, forceFlush start/done/timeout`- `bcode-laminar/src/plugin.ts` shutdown: log span count being ended, span.end() throws if any`stderr is captured by v4-worker into `bcode-output-.log` artifact. Will diff against the current 'log stops mid-stream' baseline to find which step is failing.`Once the actual fix is identified and verified, this diagnostic block must be removed before `v0.1.8` proper.


Summary by cubic

Add temporary stderr diagnostics around plugin shutdown and OpenTelemetry forceFlush to trace why parent turn spans are missing in cloud V4. Logs are captured in v4-worker’s bcode-output-<runId>.log and will be removed before v0.1.8.

  • Diagnostics
    • packages/opencode/src/index.ts: log when shutdown runs, how many plugin hooks exist, per-hook success/failure, and forceFlush start/done/reject/timeout (3s cap).
    • packages/bcode-laminar/src/plugin.ts: log how many turn spans are ended, catch and log span.end() errors, and mark shutdown complete.

Written for commit ae8be3e. Summary will update on new commits. Review in cubic

rc2 still shows orphan turn parents in cloud V4 traces. The bcode log file has no shutdown-related entries because none of the relevant code paths log on success. Add stderr writes so v4-worker's bcode-output-<runId>.log artifact captures:

- whether the shutdown branch in src/index.ts's top-level finally is reached at all
- pluginShutdownHooks.size at invocation time (was rc2's fix actually populating the Set?)
- whether bcode-laminar.shutdown was invoked + how many turn spans it ended
- forceFlush start, completion, rejection, or timeout

stderr is captured by the v4-worker harness; we'll diff against the current 'log just stops mid-bus-event' baseline to localize which step is failing. Once V4 verification is settled and the actual fix is identified, this stderr diagnostic block can be removed.

TEMP - to be removed after verification.
@Alezander9 Alezander9 merged commit 537982f into main May 17, 2026
2 checks passed
@Alezander9 Alezander9 deleted the alex/v4-shutdown-hook-diagnostics branch May 17, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant