Skip to content

fix(runtime): preserve repeated tool executions and repair Gemini Live setup - #1819

Merged
vastsa merged 2 commits into
vastsa:mainfrom
Seraph-x:fix/tool-repeats-and-gemini-live
Oct 22, 2026
Merged

vastsa merged 2 commits into
vastsa:mainfrom
Seraph-x:fix/tool-repeats-and-gemini-live

Conversation

@Seraph-x

Copy link
Copy Markdown
Contributor

Fixes #1815
Fixes #1812

Problems and fixes

Repeated tool executions (#1815). Providers can reuse a tool-call ID for independent executions. The request guard treated every later occurrence as replay, discarding real results and leaving the model to repeat an unchanged request. The parent runtime also journals results by ID, so changing only the guard was insufficient.

  • Normalize conflicting IDs before Pi executes or journals a streamed response.
  • Keep identity reservations across compaction, restored history, and delegate model fallback.
  • Make request cleanup pair-aware: retain completed same-ID pairs under distinct request-local IDs, while still removing pending snapshots and duplicate results.
  • Keep Responses call/result IDs aligned without reusing an old item ID, including when no duplicate was dropped.

Gemini Live setup (#1812). Work-bound calls sent additionalProperties: false, which Gemini's Schema rejects. The adapter then reported the rejection as a network error and left setup waiting.

  • Omit the unsupported keyword only for Gemini; preserve OpenAI's schema and strict Host argument validation.
  • Reject failed setup immediately, classify protocol closes separately, and report the first socket failure once.
  • Keep close code/reason in the existing redacted provider log. IPC connection rejections and call views expose only public error codes.

Two focused fix commits; relevant runtime, logging, and E2E specifications are synchronized in both maintained documentation locales.

Verification

Candidate: 4d5bb44cdf12724348b62d7eecd0b13e453f3668
Base main: fc8d396ce266b1b5cbd5d29e1feeee4825af1ed8

On macOS arm64 with Node 24.18.0, matching the project's CI major and documented Electron Node runtime:

  • Full agent-runtime suite: 103 files, 1,421 tests passed.
  • All Desktop Live Voice tests: 56 passed.
  • Full voice-runtime suite: 10 files, 52 tests passed.
  • Agent-runtime and Desktop TypeScript checks passed.
  • Desktop production build passed; repeated builds also passed on Node 26.
  • Biome lint, style-token, architecture (including both added files), agent-policy sync, and Pi patch-check tests passed.
  • Documentation checks: 86 locale pairs / 583 pages; diff and PR-base checks passed.

Reproducible suite commands (from each package directory, using the installed toolchain):

# packages/agent-runtime
node node_modules/vitest/vitest.mjs run --maxWorkers=2 --testTimeout=60000
# apps/desktop
node --test --test-concurrency=2 --test-timeout=60000 test/live-voice-*.test.mjs
# packages/voice-runtime
node node_modules/vitest/vitest.mjs run --testTimeout=60000

Regression evidence and repeated checks:

  • Temporarily restored untouched upstream implementations, ran the new regressions, and restored the candidate: four tool-call regressions failed on upstream; Gemini schema and socket-failure regressions also failed as expected.
  • The parent prompt-path test and the delegate's real local HTTP fixture verify two actual executions and both results in the next request.
  • Real Pi Responses conversion and Chat Completions payload capture verify unique paired IDs and intact results.
  • Identity tests cover trimmed context, restored IDs, collisions, metadata, cancellation, and done/result consistency.
  • Two independent review passes found and resolved the compaction identity and IPC diagnostic-leak gaps.
  • An additional Node 26 full run passed all 1,421 tests. Two other Node 26 runs failed the unchanged extensions/managed-exec.test.ts one-second readiness poll; that test and implementation are byte-identical to upstream. No assertion or timeout was relaxed. Its isolated Node 24 run and the final Node 24 full suite passed.

Limits and compatibility

NOT RUN: full test:e2e:live-voice Electron/Host journey. The fixture cannot start because no Rust host binary is available; this machine also lacks Cargo and an installed Electron runtime binary. The adapter/service/local-transport checks above do not certify the complete Electron journey, real Gemini account access, or physical audio devices.

Existing host dependencies were reused through workspace links. Missing dependencies were installed once from the lockfile in the primary checkout; the temporary Node 24 archive was verified against the official checksum. No real provider, paid request, or user profile was used.

No database migration, permission change, IPC DTO change, or dependency/lockfile update. Previously discarded historical results cannot be reconstructed by this fix. Please review through the normal repository gates.

Repeated provider IDs were mistaken for replayed history, dropping real
results and freezing the outgoing request. Assign execution IDs before
Pi journals each response and retain completed pairs at the request
boundary. Keep identity reservations across compaction and model fallback.

Fixes vastsa#1815
Gemini rejects the additionalProperties keyword in its setup Schema.
Use its supported schema subset while keeping OpenAI and Host validation
strict. Reject failed setup immediately and retain the first socket
failure's diagnostics in the provider log without exposing them over IPC.

Fixes vastsa#1812
Copilot AI balanced review requested due to automatic review settings October 22, 2026 11:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vastsa
vastsa merged commit b3baac3 into vastsa:main Oct 22, 2026
@Seraph-x
Seraph-x deleted the fix/tool-repeats-and-gemini-live branch October 24, 2026 02:12
@Seraph-x
Seraph-x restored the fix/tool-repeats-and-gemini-live branch October 24, 2026 02:15
@Seraph-x
Seraph-x deleted the fix/tool-repeats-and-gemini-live branch October 24, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants