Skip to content

test(snapshot): diagnose canonical worktree timeout phases - #308

Merged
agenteinstinct1-max merged 1 commit into
dev-vibecodedfrom
instinct/303-snapshot-phase-diagnostics
Oct 13, 2026
Merged

agenteinstinct1-max merged 1 commit into
dev-vibecodedfrom
instinct/303-snapshot-phase-diagnostics

Conversation

@agenteinstinct1-max

Copy link
Copy Markdown
Collaborator

Refs #303. Does not close it.

Add elapsed-time start/done markers for the canonical-worktree snapshot test: temporary root, files, Git setup, captures and layer disposal, project ID, index assertions and cleanup.

Keep the default 5-second budget, all original assertions and cleanup. No retries, skips, production changes or claim of a confirmed root cause.

Independent Linux Bun 1.3.14 native snapshot file: 4 pass, 0 fail, 16 assertions. All phase markers complete. Windows and full types remain CI gates. This diagnostic delivery does not establish that the intermittent timeout is fixed.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@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.

@agenteinstinct1-max
agenteinstinct1-max force-pushed the instinct/303-snapshot-phase-diagnostics branch from 1960e60 to 35ad063 Compare October 13, 2026 19:43
@agenteinstinct1-max
agenteinstinct1-max force-pushed the instinct/303-snapshot-phase-diagnostics branch from 35ad063 to dc6b2aa Compare October 13, 2026 20:05
// Keep the default budget: the last start/done pair identifies the Windows
// timeout boundary, including native Git setup and scoped layer disposal.
const startedAt = Date.now()
const phase = (name: string) =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Inconsistent phase function signature vs. first test

The first test (line 20-21) defines phase as returning Effect.sync(...) for yielding inside Effect.gen. This test defines phase as a plain function calling console.error directly, requiring Effect.sync(() => phase(...)) wrappers when used in Effect.gen (lines 145, 148, 150, 154, 160, 168, 169, 176) but direct calls in async callbacks (lines 109, 111, 119, 121, etc.).

This works but creates inconsistency. Consider adding a comment explaining why this test uses a plain function (to support direct calls in Effect.promise async callbacks where yield* is unavailable).


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

testEffect(Layer.empty).live("isolates snapshot indexes by canonical Git worktree", () =>
Effect.acquireUseRelease(
Effect.promise(() => tmpdir()),
testEffect(Layer.empty).live("isolates snapshot indexes by canonical Git worktree", () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Test relies on default 5-second timeout without explicit declaration

The first test explicitly sets a 30-second timeout (line 83: }, 30_000)). This test omits the timeout argument, relying on testEffect's default (5 seconds per PR description). Given the extensive Git operations (init, config, add, commit, worktree add), this may timeout on slow CI — which appears intentional for diagnostics, but the intent is not documented in the test signature.

Consider adding an explicit timeout (or Infinity to disable) with a comment explaining the diagnostic purpose.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

),
)
(tmp) =>
Effect.promise(async () => {

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: Cleanup swallows potential disposal errors without logging

The release function uses Effect.promise(async () => { ... }) with direct phase() calls. If tmp[Symbol.asyncDispose]() rejects, the rejection becomes an Effect failure (correct), but no phase marker logs the failure before the test fails. The cleanup:done marker (line 182) only runs on success.

Consider wrapping the disposal in a try/catch to emit a cleanup:error phase marker before re-throwing, preserving diagnostic value on cleanup failures.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

yield* Effect.sync(() => phase(`${name}-capture:done`))
return captured
}).pipe(Effect.provide(snapshotLayer(tmp.path, directory)))
// Effect.provide has closed the layer scope before this marker.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Comment on layer scope closure could be more explicit

The comment // Effect.provide has closed the layer scope before this marker is accurate but terse. For future maintainers, it may not be obvious why this matters for the diagnostic (the layer:done phase measures post-scope-overhead).

Suggest: // Effect.provide closes the layer scope when the inner effect completes; this marker runs after scope teardown.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 4 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/core/test/snapshot.test.ts 179 Cleanup swallows potential disposal errors without logging

SUGGESTION

File Line Issue
packages/core/test/snapshot.test.ts 101 Test relies on default 5-second timeout without explicit declaration
packages/core/test/snapshot.test.ts 105 Inconsistent phase function signature vs. first test
packages/core/test/snapshot.test.ts 153 Comment on layer scope closure could be more explicit
Files Reviewed (1 file)
  • packages/core/test/snapshot.test.ts - 4 issues

Fix these issues in Kilo Cloud

Previous Review Summary

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

Previous review

Status: 4 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/core/test/snapshot.test.ts 179 Cleanup swallows potential disposal errors without logging

SUGGESTION

File Line Issue
packages/core/test/snapshot.test.ts 105 Inconsistent phase function signature vs. first test
packages/core/test/snapshot.test.ts 101 Test relies on default 5-second timeout without explicit declaration
packages/core/test/snapshot.test.ts 153 Comment on layer scope closure could be more explicit
Files Reviewed (1 file)
  • packages/core/test/snapshot.test.ts - 4 issues

Fix these issues in Kilo Cloud


Reviewed by free · Input: 33.4K · Output: 12.4K · Cached: 164K

@agenteinstinct1-max
agenteinstinct1-max merged commit 9d792ff into dev-vibecoded Oct 13, 2026
10 checks passed
@agenteinstinct1-max

Copy link
Copy Markdown
Collaborator Author

Independent adjudication of the cleanup warning: the release path does not swallow disposal errors.

It awaits tmp[Symbol.asyncDispose]() inside Effect.promise, with no catch/ignore. A native fault probe using the exact Effect.acquireUseRelease release shape and pinned Effect 4.0.0-beta.83 returns a failed exit containing the disposal defect. The cleanup completion marker is reached only after disposal succeeds.

The default 5-second budget is intentional here: this delivers phase diagnostics without silently changing the failure threshold or claiming its root cause is fixed. All original assertions remain. This PR references #303 and does not close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant