| … | … | @@ -0,0 +1,809 @@ | |
| 314 | + | id: providerTurnId, | |
| 315 | + | providerThreadId: state.thread.id, | |
| 316 | + | nodeId: state.thread.ownerNodeId ?? NodeId.make(`vibe-root-${nativeTurnId}`), | |
| 317 | + | runAttemptId: null, | |
🟠 High server/adapter.ts:317
Vibe runs never attach their root turn or persist its response: provider_turn.updated sets runAttemptId to null, so routeProviderEvent rejects the start and completion updates and cannot accept the later turn.terminal; messages and turn items also use runId: null, so root-thread response events are discarded. Store the current turn input’s runAttemptId, runId, and rootNodeId, and use them in the turn projections and corresponding messages and items.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/provider-vibe/src/server/adapter.ts around line 317: |
| 2 | |
| 3 | Vibe runs never attach their root turn or persist its response: `provider_turn.updated` sets `runAttemptId` to `null`, so `routeProviderEvent` rejects the start and completion updates and cannot accept the later `turn.terminal`; messages and turn items also use `runId: null`, so root-thread response events are discarded. Store the current turn input’s `runAttemptId`, `runId`, and `rootNodeId`, and use them in the turn projections and corresponding messages and items. |
| … | … | @@ -0,0 +1,809 @@ | |
| 694 | + | providerThreadId: rollbackInput.providerThread.id, | |
| 695 | + | }); | |
| 696 | + | } | |
| 697 | + | if (rollbackInput.target.type === "provider_turn") { | |
🟠 High server/adapter.ts:697
Rolling back to a valid thread_start target returns the unchanged Vibe snapshot as success, leaving prior conversation history intact while CheckpointRollbackService restores files and marks later runs rolled back. rollbackThread only rewinds provider_turn targets, so handle thread_start with a native reset or return an error instead of reporting success.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/provider-vibe/src/server/adapter.ts around line 697: |
| 2 | |
| 3 | Rolling back to a valid `thread_start` target returns the unchanged Vibe snapshot as success, leaving prior conversation history intact while `CheckpointRollbackService` restores files and marks later runs rolled back. `rollbackThread` only rewinds `provider_turn` targets, so handle `thread_start` with a native reset or return an error instead of reporting success. |
| … | … | @@ -0,0 +1,809 @@ | |
| 539 | + | } | |
| 540 | + | state.lastRunOrdinal = turnInput.runOrdinal; | |
| 541 | + | yield* Effect.mapError( | |
| 542 | + | client.configModelWrite({ | |
🟡 Medium server/adapter.ts:542
Selecting or changing the thinking option has no effect on Vibe's reasoning effort, even though the turn and selection transition succeed. startTurn writes only modelSelection.model, and the initial sessionStart also omits modelSelection.options; map the selected thinking value to reasoningEffort in both writes.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/provider-vibe/src/server/adapter.ts around line 542: |
| 2 | |
| 3 | Selecting or changing the `thinking` option has no effect on Vibe's reasoning effort, even though the turn and selection transition succeed. `startTurn` writes only `modelSelection.model`, and the initial `sessionStart` also omits `modelSelection.options`; map the selected thinking value to `reasoningEffort` in both writes. |
| … | … | @@ -0,0 +1,809 @@ | |
| 286 | + | }); | |
| 287 | + | ||
| 288 | + | // Translate app-server notifications into V2 projection events. | |
| 289 | + | yield* client.handleUnknownServerNotification( | |
🟠 High server/adapter.ts:289
Approval and structured-question requests are rejected instead of reaching the user, so permission-gated turns cannot be answered. callback/call arrives as a server request, but this code only registers handleUnknownServerNotification; register a request handler that emits runtime_request.updated before callback/result is sent.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/provider-vibe/src/server/adapter.ts around line 289: |
| 2 | |
| 3 | Approval and structured-question requests are rejected instead of reaching the user, so permission-gated turns cannot be answered. `callback/call` arrives as a server request, but this code only registers `handleUnknownServerNotification`; register a request handler that emits `runtime_request.updated` before `callback/result` is sent. |
| … | … | @@ -0,0 +1,264 @@ | |
| 191 | + | defaultAgent: config.defaultAgent ?? undefined, | |
| 192 | + | installed: true, | |
| 193 | + | } satisfies VibeProbeResult; | |
| 194 | + | }).pipe( | |
🟡 Medium server/status.ts:194
If the app server stalls during client.initialize(), this status check never times out and keeps the refresh semaphore held, blocking subsequent status and usage refreshes. timeoutOption currently wraps only the callback, which runs after initialization; apply it to the entire Effect.scoped operation.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/provider-vibe/src/server/status.ts around line 194: |
| 2 | |
| 3 | If the app server stalls during `client.initialize()`, this status check never times out and keeps the refresh semaphore held, blocking subsequent status and usage refreshes. `timeoutOption` currently wraps only the callback, which runs after initialization; apply it to the entire `Effect.scoped` operation. |
| … | … | @@ -0,0 +1,809 @@ | |
| 396 | + | state.activeTurn = undefined; | |
| 397 | + | return; | |
| 398 | + | } | |
| 399 | + | if (method === "history/entryAdded" || method === "history/entryUpdated") { | |
🟠 High server/adapter.ts:399
history/entryUpdated notifications discard assistant text added after an entry is created, so the displayed and persisted message stays empty or stale. This handler reads record.entry, but updates contain entryId and a patch; maintain entries by ID and apply each patch before projecting the message.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/provider-vibe/src/server/adapter.ts around line 399: |
| 2 | |
| 3 | `history/entryUpdated` notifications discard assistant text added after an entry is created, so the displayed and persisted message stays empty or stale. This handler reads `record.entry`, but updates contain `entryId` and a `patch`; maintain entries by ID and apply each patch before projecting the message. |
| … | … | @@ -0,0 +1,136 @@ | |
| 79 | + | const history = yield* client.sessionHistoryList({ sessionId, limit: 100 }); | |
| 80 | + | const reply = [...history.items] | |
| 81 | + | .reverse() | |
| 82 | + | .map((item) => entryText(item as HistoryEntryLike)) | |
🟠 High server/textGeneration.ts:82
When a turn fails before producing an assistant reply, this code can return the user's prompt as generated output; if the prompt contains JSON, decodeJsonReply can report those input values as a successful result. entryText ignores entry.role, and waitForTurnTerminal treats failed and interrupted turns as successful completion. Filter history to assistant messages and propagate non-completed terminal statuses as errors.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/provider-vibe/src/server/textGeneration.ts around line 82: |
| 2 | |
| 3 | When a turn fails before producing an assistant reply, this code can return the user's prompt as generated output; if the prompt contains JSON, `decodeJsonReply` can report those input values as a successful result. `entryText` ignores `entry.role`, and `waitForTurnTerminal` treats failed and interrupted turns as successful completion. Filter history to assistant messages and propagate non-completed terminal statuses as errors. |
| … | … | @@ -0,0 +1,346 @@ | |
| 160 | + | ), | |
| 161 | + | ); | |
| 162 | + | ||
| 163 | + | const failTermination = (error: VibeError.VibeAppServerError) => | |
🟠 High src/protocol.ts:163
When stdio terminates or the output writer fails, outstanding request() calls remain suspended indefinitely, and later calls can enqueue requests and wait forever as well. failTermination completes only termination; it never fails entries in pending, and request() does not check termination before waiting. Fail and clear pending requests on termination, and reject or race subsequent requests against termination.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/vibe-app-server/src/protocol.ts around line 163: |
| 2 | |
| 3 | When stdio terminates or the output writer fails, outstanding `request()` calls remain suspended indefinitely, and later calls can enqueue requests and wait forever as well. `failTermination` completes only `termination`; it never fails entries in `pending`, and `request()` does not check termination before waiting. Fail and clear pending requests on termination, and reject or race subsequent requests against termination. |
| … | … | @@ -0,0 +1,621 @@ | |
| 562 | + | sessionId: input.sessionId, | |
| 563 | + | callbackId: input.callbackId, | |
| 564 | + | result: input.result, | |
| 565 | + | }); | |
🟠 High src/client.ts:561
Every callbackResult call is rejected, leaving the pending callback unresolved and the turn blocked. This sends callbackId at the top level and the answer directly as result, but the protocol requires result to contain { callbackId, output }; nest both fields in that envelope.
| 1 | return yield* requestRaw("callback/result", { |
| 2 | sessionId: input.sessionId, |
| 3 | result: { |
| 4 | callbackId: input.callbackId, |
| 5 | output: input.result, |
| 6 | }, |
| 7 | }); |
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/vibe-app-server/src/client.ts around lines 561-565: |
| 2 | |
| 3 | Every `callbackResult` call is rejected, leaving the pending callback unresolved and the turn blocked. This sends `callbackId` at the top level and the answer directly as `result`, but the protocol requires `result` to contain `{ callbackId, output }`; nest both fields in that envelope. |
| … | … | @@ -0,0 +1,809 @@ | |
| 763 | + | driver: VIBE_PROVIDER, | |
| 764 | + | providerSessionId, | |
| 765 | + | providerSession: state.session, | |
| 766 | + | events: Stream.fromPubSub(events), | |
🟠 High server/adapter.ts:766
If vibe-app-server exits during an accepted turn, the runtime event stream remains open and emits no terminal event, leaving ProviderSessionManager.startEventPump waiting indefinitely on the dead session. Stream.fromPubSub(events) is never connected to client or child-process termination; propagate that termination into the stream or explicitly fail the active turn and session.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/provider-vibe/src/server/adapter.ts around line 766: |
| 2 | |
| 3 | If `vibe-app-server` exits during an accepted turn, the runtime event stream remains open and emits no terminal event, leaving `ProviderSessionManager.startEventPump` waiting indefinitely on the dead session. `Stream.fromPubSub(events)` is never connected to client or child-process termination; propagate that termination into the stream or explicitly fail the active turn and session. |
| … | … | @@ -0,0 +1,346 @@ | |
| 235 | + | Stream.runForEach( | |
| 236 | + | Effect.fnUntraced(function* (chunk) { | |
| 237 | + | let start = 0; | |
| 238 | + | let remainder = ""; | |
🟠 High src/protocol.ts:233
Responses split across Stream.decodeText() outputs are silently dropped, leaving the matching request() call pending forever. Because remainder is reset inside each runForEach callback, the next chunk is parsed without the preceding fragment; keep remainder outside the callback so partial lines survive chunk boundaries.
| 1 | - yield* options.stdio.stdin.pipe( |
| 2 | + let remainder = ""; |
| 3 | + yield* options.stdio.stdin.pipe( |
| 4 | Stream.decodeText(), |
| 5 | Stream.runForEach( |
| 6 | Effect.fnUntraced(function* (chunk) { |
| 7 | let start = 0; |
| 8 | - let remainder = ""; |
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/vibe-app-server/src/protocol.ts around lines 233-238: |
| 2 | |
| 3 | Responses split across `Stream.decodeText()` outputs are silently dropped, leaving the matching `request()` call pending forever. Because `remainder` is reset inside each `runForEach` callback, the next chunk is parsed without the preceding fragment; keep `remainder` outside the callback so partial lines survive chunk boundaries. |
| … | … | @@ -0,0 +1,621 @@ | |
| 496 | + | }); | |
| 497 | + | }), | |
| 498 | + | sessionHistoryList: Effect.fn("VibeAppServerClient.sessionHistoryList")(function* (input) { | |
| 499 | + | return yield* typed("session/history/list", PageResult, { | |
🟠 High src/client.ts:499
Both sessionHistoryList and sessionTurnsList send cursor and limit as top-level fields, so the server rejects these requests instead of returning history or turns. The protocol requires pagination under page; send { sessionId, page: { cursor, limit } } from both wrappers.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/vibe-app-server/src/client.ts around line 499: |
| 2 | |
| 3 | Both `sessionHistoryList` and `sessionTurnsList` send `cursor` and `limit` as top-level fields, so the server rejects these requests instead of returning history or turns. The protocol requires pagination under `page`; send `{ sessionId, page: { cursor, limit } }` from both wrappers. |
| … | … | @@ -0,0 +1,346 @@ | |
| 220 | + | if (isJsonRpcNotification(message)) { | |
| 221 | + | return Effect.asVoid( | |
| 222 | + | Effect.andThen( | |
| 223 | + | Queue.offer(notificationQueue, message), | |
🟡 Medium src/protocol.ts:223
Callback-only consumers retain every incoming notification in the unbounded notificationQueue, so memory grows for the lifetime of the protocol even though onNotification handles each message. The request branch similarly retains callback-handled requests in requestQueue; avoid queueing messages when no stream consumer is active, or otherwise bound the retained queue.
🤖 Copy this AI Prompt to have your agent fix this:
| 1 | In file @packages/vibe-app-server/src/protocol.ts around line 223: |
| 2 | |
| 3 | Callback-only consumers retain every incoming notification in the unbounded `notificationQueue`, so memory grows for the lifetime of the protocol even though `onNotification` handles each message. The request branch similarly retains callback-handled requests in `requestQueue`; avoid queueing messages when no stream consumer is active, or otherwise bound the retained queue. |