Skip to content

QVAC-18827 feat[bc|api]: add unloadModel autoClose option, default-off on Bare#2024

Merged
opaninakuffo merged 3 commits into
tetherto:mainfrom
opaninakuffo:feat/sdk-unload-model-auto-close
May 13, 2026
Merged

QVAC-18827 feat[bc|api]: add unloadModel autoClose option, default-off on Bare#2024
opaninakuffo merged 3 commits into
tetherto:mainfrom
opaninakuffo:feat/sdk-unload-model-auto-close

Conversation

@opaninakuffo
Copy link
Copy Markdown
Contributor

@opaninakuffo opaninakuffo commented May 13, 2026

🎯 What problem does this PR solve?

  • unloadModel calls close() unconditionally when no models/providers remain, which terminates long-lived Bare worker hosts on every routine unload.
  • Bare consumers expecting their process to outlive a model unload have to skip unloadModel or work around the auto-close.

📝 How does it solve it?

  • Adds an optional autoClose: boolean param to unloadModel.
  • Default flips by runtime via which-runtime.isBare: true on Node/Electron (preserves current behavior), false on Bare (worker survives unload).
  • Explicit autoClose: true | false always wins.
  • Client-only — the wire request schema (unloadModelRequestSchema) is unchanged, no server changes needed.
  • API reference page updated to describe the new runtime defaults.

🧪 How was it tested?

Two-runtime integration smoke against examples/quickstart.ts (load → completion → unload):

Bun (Node-like) Bare
Wall time 23.4s (self-exit) 75s (gtimeout cap)
Exit code 0 124
Token stream emitted yes yes
Model … unloaded server log yes yes
🧹 No models or providers active, automatically closing RPC connection… 1 0

Last row is the verdict: auto-close branch fires on Bun, skipped on Bare. eslint, tsc --noEmit, and bun run build all clean.

💥 Breaking Changes

Bare consumers no longer have their host process closed by unloadModel. Node/Electron behavior is unchanged.

BEFORE: (Bare)

import { unloadModel } from "@qvac/sdk";

await unloadModel({ modelId });
// RPC connection closed → Bare worker host terminated. Long-lived workers
// had to avoid unloadModel or work around the auto-close.

AFTER: (Bare)

import { unloadModel } from "@qvac/sdk";

await unloadModel({ modelId });
// Connection stays open, worker survives. Opt in to closing explicitly:
await unloadModel({ modelId, autoClose: true });

🔌 API Changes

await unloadModel({ modelId });

await unloadModel({ modelId, autoClose: true });

await unloadModel({ modelId, autoClose: false });

@opaninakuffo opaninakuffo requested review from a team as code owners May 13, 2026 11:51
@opaninakuffo opaninakuffo changed the title QVAC-18827 feat[bc]: add unloadModel autoClose option, default-off on Bare QVAC-18827 feat[bc|api]: add unloadModel autoClose option, default-off on Bare May 13, 2026
@opaninakuffo opaninakuffo added tier1 test-e2e-smoke Triggers smoke e2e test suite [Currently SDK-only] labels May 13, 2026
@github-actions
Copy link
Copy Markdown

QVAC E2E — android — running

View run
Config: suite=smoke · filter=(none) · exclude=(none)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

QVAC E2E — windows — ✅ all tests passed (91/91, 491s)

Config: suite=smoke · filter=(none) · exclude=(none)
View run · Artifacts: reports

@github-actions
Copy link
Copy Markdown

QVAC E2E — ios — running

View run
Config: suite=smoke · filter=(none) · exclude=(none)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

QVAC E2E — linux — ✅ all tests passed (91/91, 492s)

Config: suite=smoke · filter=(none) · exclude=(none)
View run · Artifacts: reports

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

QVAC E2E — macos — ✅ all tests passed (91/91, 339s)

Config: suite=smoke · filter=(none) · exclude=(none)
View run · Artifacts: reports

@opaninakuffo
Copy link
Copy Markdown
Contributor Author

review

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 13, 2026

Tier-based Approval Status

**PR Tier:** TIER1

**Current Status:** ✅ APPROVED

**Requirements:**
- 1 Team Member approval ✅ (1/1)
- 1 Team Lead OR Management approval ✅ (1/1)



---
*This comment is automatically updated when reviews change.*

@opaninakuffo
Copy link
Copy Markdown
Contributor Author

review

@opaninakuffo opaninakuffo merged commit 9db6f98 into tetherto:main May 13, 2026
18 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-e2e-smoke Triggers smoke e2e test suite [Currently SDK-only] tier1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants