Skip to content

Fix agent delivery, startup, and disconnect recovery (#9) - #14

Merged
tanRdev merged 4 commits into
mainfrom
fix/issue-9-runtime-recovery
Nov 10, 2026
Merged

tanRdev merged 4 commits into
mainfrom
fix/issue-9-runtime-recovery

Conversation

@tanRdev

@tanRdev tanRdev commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Closes #9.

What changed

  • Prompt acceptance vs completion: the prompt lifecycle now resolves on the SDK's preflight acceptance signal and runs the turn in the background (mirroring Pi's RPC mode); the desktop client exempts prompt from the request timeout, so long turns no longer die at five seconds. Dead hosts still fail the prompt immediately via disconnect.
  • Disconnect recovery: the desktop client now rejects all pending requests on disconnect (new onDisconnect), and a send() pending leak is fixed. The CLI host side already rejected pendings.
  • Socket validation and bounds: the bridge validates request shape and returns error envelopes for malformed frames; a 16 MiB frame cap applies on both socket endpoints and the CLI line framing; chunk accumulation is linear. The unconsumed Pi CLI stderr is now bounded to an 8 KiB tail (the diagnostics ring buffer was already capped).
  • Startup: thread runtime status stays starting until the child process spawn event, and PiSdkAgentRuntime.bootstrap() now shares one in-flight promise (fixes duplicate sessions). No code path retries a prompt, so uncertain prompts cannot duplicate.

Verification

  • agent-host vitest: 113 passed (1 pre-existing load-sensitive flake passes in isolation and on clean main).
  • Desktop unit + 6 integration specs (27 tests) pass; typecheck clean (agent-host + desktop); contracts 79/79; import/size/biome checks clean.
  • Known environmental note: a few Electron-dependent checks cannot run on the build VM (Electron package download fails there) and fail identically on pristine main; CI should confirm.

@tanRdev
tanRdev merged commit 891019c into main Nov 10, 2026
1 check 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.

P1: Make agent delivery, startup, and disconnect recovery explicit

1 participant