Skip to content

test: arm owned deadlines before synchronous launch - #836

Open
agenteinstinct1-max wants to merge 13 commits into
dev-vibecodedfrom
fix/arm-owned-deadline-before-launch-828
Open

agenteinstinct1-max wants to merge 13 commits into
dev-vibecodedfrom
fix/arm-owned-deadline-before-launch-828

Conversation

@agenteinstinct1-max

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

Copy link
Copy Markdown
Collaborator

Issue for this PR

Closes #838. Refs #828. This is a narrow correction, not completion of #828 or #442 and not an explanation of the historical #740 CI failure.

Type of change

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

What does this PR do?

Register the owned deadline before synchronous launch work and clear it when launch throws. Await PluginInternal.ready before listing commands in the HTTP handler. Add a mounted HTTP regression using the real API, production handlers and middleware, and location services, with a controlled readiness gate.

Published head: 047f727, tree 4d665026fe25938a3ce6fe1d0896c291017644f7. This normal integration has parents 804abb7 and base 32c33f4 after #840. All four changed-file blobs are identical to the prior PR head. No timeout, budget, assertion, skip or workflow is relaxed. Synchronous JavaScript is not made preemptible.

How did you verify your code works?

Actual local integrated-tree runs on Bun 1.3.14: command-readiness 1 pass / 5 expectations; owned-deadline 10 pass / 45 expectations. Earlier fix-off controls fail on the removed readiness await and timer ordering. The earlier processor 44/1 result used the wrong default 5000ms invocation and is retracted; the repository's unchanged 30000ms command yielded 45 pass / 325 expectations on the earlier integrated tree. That is not new-head CI proof.

The same independent Arena review inspected the complete four-file patch against the current base and returned CLEAN, with no integration must-fix. It verified unchanged patch-id and blobs and the disjoint #840 base delta: https://arena.ai/agent/01a1c89d-fb30-7ae6-8f25-2dc4247e3a11 . Source review is not runtime qualification.

Fresh exact-047f727 CI is now running after publication. Prior 804 Linux success and Windows diff-viewer failures, and #840's separate green jobs, are not a green claim or causal exoneration for this head. Linux, Windows, typecheck and policy checks must pass before merge. No local compiler success is claimed.

Screenshots / recordings

Not applicable: no UI change.

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.

@kilo-code-bot

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

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 0
Files Reviewed (3 files)
  • README.md - 0 issues
  • packages/script/test/readme.test.ts - 0 issues
  • packages/tui/test/cli/tui/diff-viewer-file-tree.test.tsx - 0 issues

Previous WARNING on packages/tui/test/cli/tui/diff-viewer-file-tree.test.tsx:56 (deadline timing) is resolved — the captureFrameWithin(app, performance.now() + 40 * 25) call was replaced with captureFrame(app), removing the deadline calculation entirely. Remaining previous findings were on unchanged lines and are out of scope for this incremental review per the changed-lines-only rule.

Previous Review Summaries (9 snapshots, latest commit d6217d7)

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

Previous review (commit d6217d7)

Status: 5 Issues Found | Recommendation: Address before merge

Overview

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

CRITICAL

File Line Issue
packages/tui/test/cli/tui/diff-viewer-file-tree.test.tsx 230 Test expects specific error message but captureSettledFrame throws different message

WARNING

File Line Issue
packages/tui/test/cli/tui/diff-viewer-file-tree.test.tsx 56 Deadline set after renderOnceSettled doesn't account for time already spent

SUGGESTION

File Line Issue
packages/tui/test/cli/tui/diff-viewer-file-tree.test.tsx 17 RENDER_BUDGET_MS is a magic number without explanation
packages/tui/test/cli/tui/diff-viewer-file-tree.test.tsx 248 Redundant final check in waitForFileTreeMount — loop condition already guarantees mounted is true
packages/tui/test/cli/tui/diff-viewer-file-tree.test.tsx 327 Mounted component has naming collision between onMount prop and SolidJS onMount function
Files Reviewed (1 file)
  • packages/tui/test/cli/tui/diff-viewer-file-tree.test.tsx - 5 issues

Fix these issues in Kilo Cloud

Previous review (commit e762471)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • packages/core/test/lib/owned-deadline.ts
  • packages/opencode/test/lib/owned-deadline.test.ts
  • packages/server/src/handlers/command.ts
  • packages/server/test/command-readiness.test.ts

Previous review (commit 047f727)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • packages/tui/test/cli/tui/diff-viewer.test.tsx

Previous review (commit 804abb7)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/tui/src/routes/session/index.tsx
  • packages/tui/test/cli/tui/activity-padding.test.tsx

Previous review (commit 1e83c80)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • packages/server/test/command-readiness.test.ts - 0 issues

Previous review (commit 103817e)

This review did not finish. The model reached its output limit before it
could write the review — a reasoning model can spend the whole budget thinking.
Re-run the review, or lower the model's thinking effort, and it should get
further. Any inline comments below are from an earlier review.

Previous review (commit 103817e)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • packages/core/test/lib/owned-deadline.ts - timer arming reordered before fiber launch; catch-block timer cleanup added
  • packages/opencode/test/lib/owned-deadline.test.ts - new ordering regression test added; spy restored in finally
  • packages/server/src/handlers/command.ts - command.list now awaits PluginInternal.ready before listing
  • packages/server/test/command-readiness.test.ts - new test for command readiness; typing fix for test middleware

Previous review (commit c704c73)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (8 files)
  • packages/opencode/src/session/processor.ts - doom loop guard rewritten to check across generation steps using step-start boundaries; prior-step paging added; repair placeholders excluded
  • packages/opencode/test/session/processor-effect.test.ts - new doom loop guard tests added
  • packages/opencode/test/session/prompt.test.ts - doom loop test rewritten for sequential steps; same-batch test added
  • packages/server/src/handlers/command.ts - command.list now awaits PluginInternal.ready before listing
  • packages/server/test/command-readiness.test.ts - new test for command readiness
  • packages/tui/src/context/local.tsx - selectionUpdate now accepts status parameter; retry backoff counts as running; attempts map deduplicates pushes
  • packages/tui/test/cli/tui/dialog-agent-effort.test.tsx - new model selection propagation tests
  • packages/tui/test/context/local.test.ts - updated tests for status parameter; new retry backoff tests

Previous review (commit 9a0fca0)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/core/test/lib/owned-deadline.ts - timer arming reordered before fiber launch; catch-block timer cleanup added; all lifecycle paths verified leak-free
  • packages/opencode/test/lib/owned-deadline.test.ts - new ordering regression test added; spy restored in finally

Reviewed by free · Input: 43.8K · Output: 9.9K · Cached: 160.4K

@github-actions

Copy link
Copy Markdown

Thanks for updating your PR! It now meets our contributing guidelines. 👍

app.renderer.destroy()
}

expect(thrown).toEqual(new Error("Timed out waiting for DiffViewerFileTree to mount"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CRITICAL: Test expects specific error message but captureSettledFrame throws different message

The test at line 230 expects "Timed out waiting for DiffViewerFileTree to mount" but captureSettledFrame (called at line 223) throws "Timed out waiting for DiffViewerFileTree frame to settle" when its deadline expires. If the theme discovery never resolves but the component mounts (e.g., ThemeProvider renders children before discovery completes), the timeout would occur in captureSettledFrame and the test would fail with a mismatched error message.

Suggested change
expect(thrown).toEqual(new Error("Timed out waiting for DiffViewerFileTree to mount"))
expect(thrown instanceof Error).toBe(true)
expect(["Timed out waiting for DiffViewerFileTree to mount", "Timed out waiting for DiffViewerFileTree frame to settle"]).toContain(thrown.message)

try {
await renderOnceSettled(app)
const lines = visibleLines(await captureFrame(app))
const lines = visibleLines(await captureFrameWithin(app, performance.now() + 40 * 25))

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: Deadline set after renderOnceSettled doesn't account for time already spent

The deadline passed to captureFrameWithin is calculated as performance.now() + 40 * 25 (line 56), but this occurs AFTER renderOnceSettled(app) completes. renderOnceSettled performs two renders with a 25ms delay between them, consuming measurable time that isn't accounted for in the capture deadline. This could cause premature timeouts on slower systems.

Consider setting a single deadline at test start and passing it through both renderOnceSettled and captureFrameWithin.

buildFileTree,
} from "../../../src/feature-plugins/system/diff-viewer-file-tree-utils"

const RENDER_BUDGET_MS = 25 + 40 * 25

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: RENDER_BUDGET_MS is a magic number without explanation

const RENDER_BUDGET_MS = 25 + 40 * 25 evaluates to 1025ms but the derivation isn't documented. The components (25ms initial delay + 40 iterations * 25ms) suggest it's related to the render loop timing in captureSettledFrame and waitForFileTreeMount. Adding a comment explaining the calculation would improve maintainability.

if (remaining <= 0) throw new Error("Timed out waiting for DiffViewerFileTree to mount")
await new Promise((resolve) => setTimeout(resolve, Math.min(25, remaining)))
}
if (!mounted()) throw new Error("Timed out waiting for DiffViewerFileTree to mount")

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: Redundant final check in waitForFileTreeMount — loop condition already guarantees mounted is true

The while (!mounted()) loop only exits when mounted() becomes true (either via the break after renderWithin or by throwing on timeout). The final if (!mounted()) throw ... check at line 248 is therefore unreachable and can be removed.

Suggested change
if (!mounted()) throw new Error("Timed out waiting for DiffViewerFileTree to mount")
}

}

function withTheme(component: () => JSX.Element) {
function Mounted(props: { onMount?: () => void; children: JSX.Element }) {

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: Mounted component has naming collision between onMount prop and SolidJS onMount function

The Mounted component at lines 327-330 uses onMount both as a prop name (props.onMount) and as the SolidJS lifecycle function imported from solid-js. While technically valid due to different scopes, this creates confusing code. Consider renaming the prop to onMountCallback or similar.

Suggested change
function Mounted(props: { onMount?: () => void; children: JSX.Element }) {
function Mounted(props: { onMountCallback?: () => void; children: JSX.Element }) {
onMount(() => props.onMountCallback?.())
return props.children
}

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: owned deadline timer is registered after synchronous launch begins

1 participant