Skip to content

fix(server): wait for command plugins before listing - #850

Open
agenteinstinct1-max wants to merge 3 commits into
dev-vibecodedfrom
fix/command-plugin-readiness-826
Open

agenteinstinct1-max wants to merge 3 commits into
dev-vibecodedfrom
fix/command-plugin-readiness-826

Conversation

@agenteinstinct1-max

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

Copy link
Copy Markdown
Collaborator

Issue for this PR

Closes #849. Refs #826. This addresses only the command-list readiness ordering requirement, not every CI failure or general completion of #826. The Development sidebar also links the narrow ordering issue #849.

Type of change

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

What does this PR do?

Awaits PluginInternal.ready in the mounted command-list HTTP handler before calling CommandV2.list(). Adds a controlled HTTP regression test that holds readiness, verifies no early list call, then releases readiness and checks the 200 response and command names.

This is a two-file split from work still present in #836. Its server handler and HTTP test blobs are byte-identical to the independently reviewed server files at 047f7271. The original Arena full-four-file review and current-base dependency qualification were accepted before this split. This is carried review evidence, not a claim that a new reviewer read this commit. Fresh exact-head CI and typecheck are required before merge. #836 and #838 remain open for their other work; no source is removed from them by this publication.

How did you verify your code works?

  • Qualification reported a controlled mounted-HTTP old-handler failure and fixed-handler pass (1 test, 5 assertions), plus the existing command bridge tests passing (2 tests, 15 assertions).
  • The controlled HTTP test substitutes PluginInternal and CommandV2 services behind the real mounted HTTP route. It is not a natural CI reproduction, nor proof that every Linux unit: e2e-command-bridge factory/configured command list unexpectedly empty #826 failure has the same cause.
  • Local full typecheck was terminated with SIGTERM and gave no verdict. It is not reported as passing. Fresh Linux, Windows, typecheck and policy checks must pass on this head.

Screenshots / recordings

Not applicable: server ordering and regression test only, 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.

} finally {
readyWaiterController.abort()
await readyWaiter.catch(() => {})
await Effect.runPromise(Deferred.succeed(readyGate, undefined).pipe(Effect.ignore)).catch(() => {})

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 cleanup - readyGate already succeeded on line 122

This line attempts to succeed an already-succeeded Deferred, which will fail but is caught and ignored. Since readyGate was already succeeded at line 122, this cleanup is unnecessary.

Suggested change
await Effect.runPromise(Deferred.succeed(readyGate, undefined).pipe(Effect.ignore)).catch(() => {})
await readyWaiter.catch(() => {})
if (responsePromise) await responsePromise.catch(() => {})
await web.dispose()

readyWaiterController.abort()
await readyWaiter.catch(() => {})
await Effect.runPromise(Deferred.succeed(readyGate, undefined).pipe(Effect.ignore)).catch(() => {})
if (responsePromise) await responsePromise.catch(() => {})

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 cleanup - responsePromise already awaited on line 123

The response promise was already awaited at line 123 (const response = await responsePromise), so catching it again here is unnecessary.

Suggested change
if (responsePromise) await responsePromise.catch(() => {})
await readyWaiter.catch(() => {})
await web.dispose()


const commandService = CommandV2.Service.of({
get: (name: string) => Effect.succeed(commands.find((command) => command.name === name)),
list: () =>

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: Consider using Effect.fail instead of throwing in Effect.sync

Throwing inside Effect.sync works but converts to an Effect failure. Using Effect.fail would be more idiomatic and allow proper error handling in the Effect pipeline.

Suggested change
list: () =>
list: () =>
Effect.gen(function* () {
if (!readyCompleted) yield* Effect.fail(new Error("command.list entered before PluginInternal.ready completed"))
listCalled = true
return commands
}),

@kilo-code-bot

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

Copy link
Copy Markdown

Code Review Summary

Status: 3 Issues Found | Recommendation: Address before merge

Overview

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

SUGGESTION

File Line Issue
packages/server/test/command-readiness.test.ts 131 Redundant cleanup - readyGate already succeeded on line 122
packages/server/test/command-readiness.test.ts 132 Redundant cleanup - responsePromise already awaited on line 123
packages/server/test/command-readiness.test.ts 67 Consider using Effect.fail instead of throwing in Effect.sync
Files Reviewed (2 files)
  • packages/server/src/handlers/command.ts - 0 issues
  • packages/server/test/command-readiness.test.ts - 3 issues

Fix these issues in Kilo Cloud


Reviewed by free · Input: 84K · Output: 6.9K · Cached: 517.3K

@agenteinstinct1-max agenteinstinct1-max linked an issue Nov 11, 2026 that may be closed by this pull request
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.

Command listing must await plugin readiness

1 participant