Skip to content

test(opencode): record phase and exit cause for workspace sync-history failures - #845

Merged
agenteinstinct1-max merged 4 commits into
dev-vibecodedfrom
diag-sync-history
Nov 11, 2026
Merged

agenteinstinct1-max merged 4 commits into
dev-vibecodedfrom
diag-sync-history

Conversation

@agenteinstinct1-max

@agenteinstinct1-max agenteinstinct1-max commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

Closes #844, which only asks for the missing measurement (phase reached and exit cause recorded when the test does not succeed). This PR does not fix or explain the underlying Windows CI failure; #830 and #841 remain open.

Development link: #844 is linked in this PR's Development sidebar (GraphQL closingIssuesReferences = #844), because "Closes" in the body is not recognized for a non-default base branch.

Integration update: head 121ad39 is an ordinary merge of the previous head 0043edf into the current dev-vibecoded tip 2ab1fca (which now contains #843). Tree 850b78dee7405e1e23d5f8652e92cc9f462b2335. The PR's own change is unchanged: workspace.test.ts blob 4de34d05b211e3460bc2468dc0b13c4d924256aa, 208 lines added, 3 changed; effect.test.ts is the one from #843. CI for this head has not finished; earlier results at 0043edf do not count for it. Local on this head: workspace.test.ts 40 pass, 0 fail, no "[workspace-sync-history]" output; effect.test.ts 4 pass.

Integration update 2: head 452fb4c (tree b806312f69976dd77eded0d1ee417127b164997b, sole parent 121ad39) adds bounded in-memory trace instrumentation to the abandoned-entry-barrier diagnostic pair only (test/lib/abandoned-entry-barrier.test.ts + test/lib/fixtures/abandoned-entry-barrier.ts, 121 lines added, 17 removed, blobs sha256 5a05faa3.../7749d767...). Measurement only: it records phase/byte counters for the Windows CI hang investigation and changes no product code and no assertion semantics.

Stated coverage limits of the new trace: dumps fire only from assertion catch sites; rejections on the Promise.all / stdin read / stdin write paths are not dumped; on the fixture gate-assertion failure path the dump fires before finalizer-end, so fixture phase C3 is absent on exactly that path. Qualified on Linux only (passing path quiet, original errors rethrown unchanged in forced-failure controls); no Windows proof - Windows is what CI measures. Not a cause fix. Closes only #844 as above; does not close or resolve #833 or #835.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Instruments the test "sync history sends the local sequence fence and replays returned events in workspace context" in packages/opencode/test/control-plane/workspace.test.ts with a small test-local helper. It records a bounded list of fixed phase labels while the test body runs. Only when the test body exits with a failure or interruption, it prints one "[workspace-sync-history]" line with: the last phase, up to 16 phase breadcrumbs, capped per-phase counts, the current fiber id, and counts of Fail, Die and Interrupt cause entries (each capped at 32) with up to 8 interrupting fiber ids. No error messages, payloads or other values are serialized. A successful run prints nothing. The reporter runs uninterruptibly and its own failure, defect or interruption cannot replace the original cause.

The record is taken at the exit of the test body, before the outer scope closes. A failure in an outer finalizer or the surrounding harness can therefore remain unreported. This is not a full cause capture.

Adds four synthetic tests for the helper: success stays quiet, failure cause and cleanup are preserved with bounded breadcrumbs and no payload serialized, a real interruption is reported and not consumed, and reporter failures do not replace the original cause.

All existing assertions in the real test, their order, text and timeouts are unchanged (208 lines added, 3 changed lines: the effect import, a return that now goes through a local const, and the closing of the test). No production code, workflow, dependency or package-script changes. Base: 32c33f4 on dev-vibecoded.

It makes no claim about the cause of the Windows failure or about any outer finalization or harness behavior.

How did you verify your code works?

Linux, Bun 1.3.14, --timeout 30000. On this base, the whole workspace.test.ts: 40 pass, 0 fail, no "[workspace-sync-history]" output. That includes the four synthetic tests and the real sync-history test. An independent source-only review of the body-exit scope found no must-fix or should-fix items.

Not verified: Windows (CI will be the first Windows run), typecheck (left to CI), and whether the failure recurs.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

if (Exit.isSuccess(exit)) return Effect.void
const cause: SyncHistoryDiagnostic["cause"] = { Fail: 0, Die: 0, Interrupt: 0, interruptors: [] }
for (const reason of exit.cause.reasons) {
cause[reason._tag] = Math.min(32, cause[reason._tag] + 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Possible typecheck failure — cause indexed by reason._tag. The accumulator only declares Fail, Die, Interrupt keys, but exit.cause.reasons may carry other tags under effect 4.0.0-beta.83 (composite, timeout, …). cause.reasons is an established pattern (test/tool/task.test.ts:2854); this indexing is not. Typecheck was left to CI — verify before merge.

for (const reason of exit.cause.reasons) {
cause[reason._tag] = Math.min(32, cause[reason._tag] + 1)
if (Cause.isInterruptReason(reason) && cause.interruptors.length < 8) {
cause.interruptors.push(reason.fiberId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Possible typecheck failure — reason.fiberId pushed into interruptors typed (number | undefined)[]. fiberId on an Interrupt reason is not an established in-repo pattern (unused elsewhere) and may be Option<number> under effect 4.0.0-beta.83. Tests pass locally, but this line may fail typecheck — verify before merge.

@kilo-code-bot

kilo-code-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/test/control-plane/workspace.test.ts 1177 Possible typecheck failure — cause indexed by reason._tag; accumulator only declares Fail, Die, Interrupt keys
packages/opencode/test/control-plane/workspace.test.ts 1179 Possible typecheck failure — reason.fiberId pushed into interruptors typed (number | undefined)[]
Files Reviewed (2 files)
  • packages/core/test/lib/effect.test.ts - 0 issues (incremental merge changes; targeted diagnostic logging)
  • packages/opencode/test/control-plane/workspace.test.ts - 2 issues (previous findings still present)

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit 121ad39)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 121ad39)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/test/control-plane/workspace.test.ts 1177 Possible typecheck failure — cause indexed by reason._tag; accumulator only declares Fail, Die, Interrupt keys
packages/opencode/test/control-plane/workspace.test.ts 1179 Possible typecheck failure — reason.fiberId pushed into interruptors typed (number | undefined)[]
Files Reviewed (2 files)
  • packages/core/test/lib/effect.test.ts - 0 issues (incremental merge changes; targeted diagnostic logging)
  • packages/opencode/test/control-plane/workspace.test.ts - 2 issues (previous findings still present)

Fix these issues in Kilo Cloud

Previous review (commit 0043edf)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/test/control-plane/workspace.test.ts 1177 Possible typecheck failure — cause indexed by reason._tag; accumulator only declares Fail, Die, Interrupt keys
packages/opencode/test/control-plane/workspace.test.ts 1179 Possible typecheck failure — reason.fiberId pushed into interruptors typed `(number
Files Reviewed (1 file)
  • packages/opencode/test/control-plane/workspace.test.ts - 2 issues

Fix these issues in Kilo Cloud


Reviewed by free · Input: 18.7K · Output: 287 · Cached: 17.5K

agenteinstinct1-max and others added 3 commits November 11, 2026 07:07
…barrier diagnostic

Diagnostic-only change to the 845 Windows CI hang probe pair. Not a cause
fix; no product code changed.

Known coverage limits, stated explicitly:
- Trace dumps fire only from assertion catch sites. Rejections on the
  Promise.all / stdin read / stdin write paths are not dumped.
- On the fixture gate-assertion failure path the dump fires before
  finalizer-end, so fixture phase C3 is absent on exactly that path.
- Qualified on Linux only; no Windows proof. Windows behavior is the CI
  question this instrumentation exists to measure.

Does not close or resolve any issue.
@agenteinstinct1-max
agenteinstinct1-max merged commit 09f2e72 into dev-vibecoded Nov 11, 2026
8 checks passed
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.

test: record phase and exit cause when workspace sync-history test fails in Windows CI

1 participant