Commit Graph
7647 Commits
Author SHA1 Message Date
abeatrix ebb26349b0 fix(cli): align desktop and dashboard SDK build identities 2026-10-19 14:44:26 -07:00
abeatrix 6c860227a6 fix(cli): isolate installer probes from parent launch overrides 2026-10-19 14:44:26 -07:00
abeatrix 8a2f7e7aeb feat(cli): add pinned standalone Unix installer and release assets 2026-10-19 14:44:25 -07:00
abeatrix 8a83434321 fix(core): package every declared SDK runtime export 2026-10-19 14:44:21 -07:00
Saoud RizwanandSaoud Rizwan b24ba65ef1 test(desktop): compare native paths and tolerate Hub cleanup on Windows
The standalone plugin test compared the child's process.execPath to
realpathSync(cli), which keeps Windows 8.3 short names (RUNNER~1) while the
child reports the long path. Use realpathSync.native. The dashboard test's
cleanup could hit EBUSY while the stopped Hub released its cwd; retry it like
the startup scenario cleanup does.

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>
2026-10-19 21:42:20 +00:00
abeatrix 4554f1194e fix(core): load compiled plugin resources directly from bunfs 2026-10-19 14:04:36 -07:00
abeatrix cc56295a19 fix(core): isolate subprocess Bun mode and retain system CA trust 2026-10-19 13:01:39 -07:00
abeatrix 2895a16927 fix(core): load embedded plugin and dashboard resources 2026-10-19 12:27:34 -07:00
Saoud Rizwan 0caa1b10ab fix(llms): backfill Cline recommended model capabilities from Vercel catalog (#15181)
* fix(llms): backfill Cline recommended model capabilities from Vercel catalog

* fix(llms): consult Vercel catalog only when OpenRouter has no match

* refactor(llms): pass the models.dev catalog to Cline recommended normalization
2026-10-19 12:12:03 -07:00
Lucien 7e8d22c789 fix(vscode): settle pending questions before posting state (#14839) 2026-10-19 21:10:28 +02:00
Mikołaj Kondratekand33modeling 41e75efc53 fix(vscode): honor disabled rule toggles in SDK sessions (#14605)
* fix(vscode): persist rule toggle state for SDK loader

* fix(vscode): confine rule toggle frontmatter writes and preserve authored YAML

- Only write rule documents the SDK loader actually reads (.md, .markdown,
  .txt, or the bare .clinerules file) that resolve, through symlinks, to a
  regular file inside the scope's rules root (global Rules dir or the
  workspace .clinerules). Anything else keeps the extension-state toggle only.
- Edit the top-level `disabled` entry line by line instead of re-dumping the
  YAML block, so comments, key order, quoting, CRLF line endings and a UTF-8
  BOM survive a toggle. Re-parse before writing and leave the file untouched
  if the result would not parse. Skills share the helper and get the same.
- Reconcile extension state with frontmatter on rules refresh: toggles turned
  off before this fix are written to the file so SDK sessions honor them, and
  a file disabled by hand wins over a stale enabled toggle.

* fix(vscode): write rule toggles into every rule root the panel scans

Rebase adjustment: since the rules panel now scans both .clinerules and
.cline/rules plus every global location the shared resolver knows, the
frontmatter write and the state<->frontmatter reconcile take the same
directory lists instead of the two hardcoded roots.

* fix(vscode): make rule files authoritative for toggles after a one-time back-fill

- Match the SDK's disabled precedence: a boolean `disabled` wins, `enabled:
  false` only counts when `disabled` is absent.
- Recognize quoted frontmatter keys when editing the disabled line.
- Return written/skipped/failed from the frontmatter write; on failure the
  toggle handler reverts the state toggle and returns the reverted map so the
  panel keeps showing what the SDK loads.
- Back-fill state toggles into frontmatter once, behind a new global state
  flag; afterwards the file is the source of truth for the panel in both
  directions, so removing `disabled` from a file re-enables the rule.
- Only write files the SDK loader reads: direct children of a rule root, or
  the single legacy .clinerules file.

* fix(vscode): back-fill rule toggles per workspace and accept uppercase YAML booleans

- The one-time back-fill marker is now keyed per scope (global, and one entry
  per workspace path), so a workspace opened after another one was migrated
  still gets its pre-fix off toggles written into its rule files instead of
  having them flipped on by the file-wins reconcile.
- The enabled: false matcher accepts False and FALSE, which both YAML parsers
  in play read as boolean false, so re-enabling removes those lines too.

* fix(vscode): keep the workspace back-fill marker in workspace state

Each window holds its own copy of global state and the last writer wins per
key, so two windows migrating different workspaces could erase each other's
marker in the shared record. The global marker is a plain flag again and the
workspace marker moves to workspace state, keyed by workspace path, which is
per window and never shared.

* fix(vscode): report a rule toggle as failed when the file could not be edited safely

The frontmatter helper returns the document unchanged both when it already
carries the requested state and when it cannot be edited safely (malformed
YAML, or an edit that would not re-parse). The write wrapper treated both as
success, so the toggle handler kept the new state while the SDK kept loading
the old one. An unchanged document now counts as written only if it parses
and already matches the requested state; otherwise the handler reverts.

* fix(vscode): retry a failed rule back-fill and keep comments after inline disabled values

- A back-fill write that fails (read-only file, malformed frontmatter) keeps
  the off toggle and leaves the scope's migration marker unset, so the next
  refresh retries instead of treating the unwritten file as re-enabled.
- An entry with an inline scalar value is a single line, so an indented
  comment after `disabled: true` is no longer removed with it.

* fix(vscode): track the rule back-fill per rule instead of per scope

A scope-wide migration marker forced a choice between two failure modes: mark
the scope done after a failed back-fill (the unwritten rule turns on), or keep
the whole scope pending (a rule the user re-enabled by hand gets back-filled
again). Each rule now records whether its file is authoritative. A rule joins
that set when state and file agree, when the file disables it, when its
back-fill succeeds, or when the toggle handler writes it; only a rule whose
back-fill failed stays pending and is retried on the next refresh. The global
set lives in global state and the workspace set in workspace state, replacing
the unreleased scope markers.

Also handle an inline disabled value that continues on later lines (a flow
collection or a split quoted string) by taking lines until the entry parses.

* fix(vscode): keep global rule authority records in their own settings file

Every window caches global state and persists its whole snapshot, so a window
that started before another one back-filled a global rule kept no record of
it. After the user re-enabled that rule by editing its file, refreshing the
stale window back-filled it again. The global records now live in
settings/cline-rules-frontmatter-authority.json, re-read on every refresh and
merged on every write, so windows only ever add to them. Records for deleted
rule files are dropped on write. Workspace records stay in workspace state,
which is a separate file per workspace.

* fix(vscode): make the rule file the only source of truth for rule toggles

Drop the one-time back-fill of toggles saved before the toggle wrote
frontmatter. Telling such a toggle apart from a rule the user re-enabled by
editing its file needs per-rule history, and every place to keep it
(scope flags, global state, workspace state, a settings file) failed across
multiple windows, crashes, or hand edits. The Rules panel now shows what the
frontmatter says on every refresh, and the toggle writes it. A rule switched
off before this fix shows as on after upgrading, which is what the SDK has
been loading, and is switched off once more.

Removes the per-rule authority records, the authority settings file, and the
localClineRulesFrontmatterAuthoritative workspace key. The multi-layout
refresh test now marks its disabled fixtures in frontmatter.

* fix(vscode): verify the requested state before reporting a toggle write

The rule and skill write paths trusted the frontmatter editor's output. An
edit that left a disabling flag the editor did not recognize (for example a
legacy `enabled: false` whose value is on the next line) was written and
reported as success, so the panel showed the rule or skill as on while the
SDK still excluded it. Both paths now re-parse the edited document and treat
anything not in the requested state as a failure, so the rule toggle handler
reverts and the skill write reports false without writing.

* fix(vscode): edit rule and skill frontmatter by YAML source range

The line-based editor guessed entry boundaries from line shapes. It missed a
legacy `enabled: false` whose value sits on the next line, matched
`disabled:` lines inside multi-line string values (changing unrelated
metadata while still producing valid YAML), and dropped comments on and
around the flag.

The editor now parses the frontmatter with the SDK loader's YAML parser and
splices only the source ranges of the top-level `disabled` and `enabled`
entries. Disabling sets an existing value or appends `disabled: true`.
Enabling removes those entries, or flips the value in place when the entry
carries a comment so the comment survives. Anything the SDK would reject
(invalid YAML, duplicate keys, non-boolean flags) is left untouched, and an
edit is discarded unless every other value is unchanged and the result is in
the requested state. The Rules panel reads state with the same parser.

Declares `yaml` (already a workspace dependency through @cline/core) as a
direct dependency of apps/vscode.

* test(vscode): mock @cline/core before it is loaded in the bun harness

The preload imported the real @cline/core to read its export names and then
mocked it. Mocking an already-loaded module makes bun re-link the graph, and
that re-link leaves a slice of @cline/shared's source-tree exports undefined
(stripUtf8Bom among them) for everything under sdk/packages/core, which
resolves @cline/shared to shared/src through core's tsconfig paths. Any real
SDK function the stub re-exports then threw when called from a test.

The export names now come from a child process, cached on the built package's
mtime, the mock is registered first, and the stub and @cline/llms are imported
after it.

* fix(vscode): let the SDK parser decide a rule's enabled state

The extension kept its own copy of the SDK's rules for reading a rule file's
enabled state, and every review round found a case where the copy and the
SDK disagreed: flag precedence, uppercase booleans, non-boolean values, and
now frontmatter that is not a mapping, which the SDK loads as having no
metadata but the copy treated as unloadable. A rule starting with a markdown
divider line could not be switched off.

The Rules panel, both write paths, and the editor now ask
parseRuleConfigFromMarkdown / parseSkillConfigFromMarkdown from @cline/core,
so they cannot disagree with what the SDK loads, now or after the SDK changes.
The editor still parses the block as a YAML document, but only to locate the
source ranges it edits. A file with non-mapping frontmatter is disabled by
adding a disabled: true block above it, and re-enabling restores it exactly.
A comment-only block gets the flag appended inside it.

A file the SDK does not load at all (unparseable frontmatter, non-boolean
flag, empty body) now shows as off in the panel, since nothing from it
reaches the model; switching it on fails and reverts, with the reason logged.
The bun test stub re-exports the two parsers from the SDK source.

---------

Co-authored-by: 33modeling <33modeling@gmail.com>
2026-10-19 15:08:19 +02:00
Mikołaj Kondratek 9857d19fc4 fix(vscode): keep the session's mode in sync when Plan/Act is toggled during a session start (#15026)
* test(vscode): cover Plan/Act toggles that race a session start

A toggle that lands while a session is being started or replaced sees no
active session, flips only the setting, and leaves the session running with
the other mode's tools. These tests reproduce that and fail on main.

* fix(vscode): keep the session's mode in sync when Plan/Act is toggled during a session start

Starting or replacing a session detaches the outgoing one before the new one
is active. A toggle in that window saw no session, flipped only the setting,
and the session that finished starting kept the other mode's tools, so the UI
showed Act while every write was blocked as plan mode.

- Sessions record the mode they were built for.
- The toggle decides under the rebuild lock, after waiting for session starts
  that run outside it (new task, edited message, checkpoint restore).
- The toggle and the rebuild compare against the session's mode rather than
  the setting, which also fixes the stale mode notice the late rebuild left.

* test(vscode): release session-start waiters when the start fails

Cover a waiter that is already in place when a tracked start rejects. The
previous check only waited after the rejection, so an implementation that
rejected existing waiters would still have passed.
2026-10-19 12:43:41 +02:00
Mikołaj Kondratek 0e4b58c1c9 fix(core): explain PowerShell quote escaping in the run_commands description (#15115)
Models default to bash-style \" escaping, which PowerShell treats as the
end of a double-quoted string. Wrapped in cmd /c, the leftover text becomes
extra arguments, and in one reported case handed rmdir /s /q a bare \,
the root of the current drive.

For PowerShell shells only, tell the model that the backtick is the escape
character, to single-quote literal paths, to prefer cmdlets over cmd /c,
and to confirm recursive or forced deletes before running them.
2026-10-19 19:11:26 +09:00
Saoud Rizwan 3b1ecbb1f3 fix(llms): stop sending native Google Search on the Gemini API (#15194)
Web search became default-on in #13957, so every Gemini API request now
carries the googleSearch grounding tool. Free-tier keys have no grounding
quota on Gemini 3+ models, so each turn fails with 429 'You exceeded your
current quota' (and is retried 6 times). On Gemini 2.x the AI SDK cannot
combine googleSearch with function tools and drops every Cline tool.

Remove the web_search model-tool capability from the gemini provider
manifest. Vertex, which has no free tier, keeps native search.
2026-10-19 01:39:01 -07:00
Mikołaj Kondratek dc3d7a58c9 fix(vscode): keep keyboard focus when revealing the terminal for a command (#15061)
* fix(vscode): keep keyboard focus when revealing the terminal for a command

Every foreground run_commands execution called terminal.show() with no
argument, which makes VS Code move keyboard focus into the terminal. A user
typing in the chat input while Cline starts a command had the rest of their
keystrokes land in the shell, corrupting the running command.

Pass preserveFocus=true at both reveal sites (the per-command reveal in
runCommand and the pre-cd reveal of a reused terminal). The terminal panel
is still revealed, which is all shell-integration initialization needs.

* test(vscode): stub the command process in the reveal-only terminal test

The reveal test fed the process a never-ending stream, so its VS Code shell-execution and terminal-close listeners outlived the test. Stub run() instead; the test only checks the reveal call.
2026-10-19 07:34:47 +02:00
Tomás Barreiro 731f48462b Support MCP Resources [NO-OP] (#15165)
* Support MCP Resources

* Small fixes

* Address PR comments

* remove CreateMcpToolsOptions mcpApps option
2026-10-19 00:10:19 +02:00
Saoud Rizwan a42df8c8d5 chore(desktop): release v0.0.48 desktop-v0.0.48 2026-10-16 20:08:38 -07:00
Saoud Rizwan c718573538 chore(cli): release v3.0.73 cli-v3.0.73 sdk/sdk/v0.0.95 sdk/core/v0.0.95 sdk/agents/v0.0.95 sdk/llms/v0.0.95 sdk/shared/v0.0.95 2026-10-16 19:37:19 -07:00
Saoud Rizwan 36b80d8ce4 chore(sdk): release v0.0.95 2026-10-16 19:37:13 -07:00
Saoud Rizwan 729d6c224e fix(llms): pin OpenCode Go base URL to the shared inference root (#15154)
models.dev now lists https://opencode.ai/inference/go/openai/v1, which
only serves OpenAI routes: /messages returns 404 there, so every
Anthropic-protocol OpenCode Go model would fail after a catalog regen.
Routing appends per-model protocol endpoints to the base URL, so keep
the shared /inference/go/v1 root that serves chat, responses and
messages.
2026-10-16 19:36:11 -07:00
Mikołaj Kondratek b549ceb4bb fix(llms): send max_completion_tokens for gpt-6 ids on OpenAI-compatible endpoints (#15137)
The reasoning-era model-id matcher only covered o1/o3/o4 and gpt-5, so
gpt-6 requests (gpt-6-sol, gpt-6.1-sol, gpt-6-1-sol) kept max_tokens and
OpenAI/Azure rejected them. Widen the gpt pattern to gpt-5 through gpt-9,
keeping the version digit single so Azure's gpt-35-turbo stays out.
2026-10-16 11:14:20 -07:00
Mikołaj Kondratek 44b388b998 chore(vscode): fix integration test runner on macOS (#15088)
* chore(vscode): fix integration test runner on macOS

Bump @vscode/test-electron to 3.1.0, which resolves the macOS executable
from Info.plist. VS Code 1.110+ renamed Contents/MacOS/Electron to Code
and dropped the compatibility symlink, so 2.5.2 failed every run with
`spawn .../Contents/MacOS/Electron ENOENT`.

Also pass a short --user-data-dir on macOS. VS Code puts its IPC socket
in the user data dir, and the default .vscode-test/user-data overflows
the 103-char unix socket limit from deep checkouts such as worktrees
(`listen EINVAL ... 1.14-main.sock`). Linux and Windows keep the default.

* test(vscode): drop the macOS E2E executable fallback

@vscode/test-electron 3.1.0 resolves the macOS executable from the app
bundle's Info.plist for both Stable and Insiders, so downloadAndUnzipVSCode
now returns Contents/MacOS/Code directly and the Code / Code - Insiders
fallback never runs.
2026-10-16 11:13:15 -07:00
Bee f67e933376 fix(desktop): bake the OTLP trace exporter into desktop builds and record who launched the hub (#15135) 2026-10-16 11:11:53 -07:00
Saoud Rizwan 01b8a9724d chore(vscode): release v4.1.25 v4.1.25 2026-10-15 23:21:22 -07:00
Saoud Rizwan 98a53322f9 chore(desktop): release v0.0.47 desktop-v0.0.47 2026-10-15 23:18:46 -07:00
Mikołaj Kondratek 9098d603cc feat(webview): name the host editor in Cloud sessions copy (#15133)
* feat(webview): name the host editor in Cloud sessions copy

The Cloud sessions copy said "your editor". Name the editor the user is
actually in instead: "VS Code", "Cursor", "PyCharm" and so on.

The extension already gets the product name from the host bridge
(getHostVersion's platform); fetch it once and pass it to the webview as
hostName. The webview shortens it the way users say it (drops the
JetBrains edition, "Visual Studio Code" -> "VS Code") and falls back to
"your editor" when the host is unknown.

* fix: read the host name from HostRegistryInfo instead of a bridge call

HostRegistryInfo already holds getHostVersion's platform from startup, so
building webview state no longer waits on the host bridge. The tooltip
test now asserts the visible text instead of reusing the function it tests.

* fix(webview): fall back to "your IDE" when the host is unknown
2026-10-16 08:06:59 +02:00
Saoud Rizwan d9deb814e8 chore(cli): release v3.0.72 cli-v3.0.72 2026-10-15 22:25:46 -07:00
Mikołaj Kondratek 1faa00fa25 fix(webview): use editor-neutral wording in Cloud sessions copy (#15123)
The webview is shared with the JetBrains plugin, where "after you close
VS Code" is wrong. Say "your editor" instead in the onboarding/GitHub
cards, the Run task hint and the cloud auto-approve tooltip.
2026-10-16 07:13:55 +02:00
TheRealSpencer cd01a92faa security: dependency floor lifts for open Dependabot advisories (#15132) 2026-10-15 23:02:38 -05:00
Saoud Rizwan 2bbaa7a8d3 chore(sdk): release v0.0.94 sdk/sdk/v0.0.94 sdk/core/v0.0.94 sdk/agents/v0.0.94 sdk/llms/v0.0.94 sdk/shared/v0.0.94 2026-10-15 20:22:09 -07:00
Saoud Rizwan 5d5d2e90bf test(sdk): route OpenCode Go messages tests through minimax-m3
The model catalog no longer lists minimax-m2.7 for OpenCode Go, so the
anthropic-protocol routing cases fall back to chat/completions. Use
minimax-m3, which the catalog still serves over messages.
2026-10-15 20:22:08 -07:00
Saoud Rizwan 23791b9323 fix(desktop): pass --use-system-ca when launching the backend on the bundled CLI (#15125)
The desktop backend now runs as `BUN_BE_BUN=1 cline-cli run <bundle>`.
In that mode Bun ignores the flags baked into the CLI with
--compile-exec-argv, so the backend lost the --use-system-ca that #14462
added and went back to trusting only Bun's bundled roots on macOS and
Windows. Requests the backend makes itself (model lists from a LiteLLM or
other intranet endpoint, sign-in refresh, marketplace, cloud sessions)
failed with "unable to get local issuer certificate" behind a corporate
CA. Pass the flag on the run command, and mirror it in the startup test.
desktop-nightly-20261016020842
2026-10-15 17:25:25 -07:00
Bee ee7f4f5c66 fix(llms): retry stream errors and report terminal failures to Langfuse (#15100)
* fix: report stream failures as errors in logs and Langfuse

* fix: correlate model failures and distinguish timeout aborts

* fix: enable three stream retries with terminal error reporting

* fix(llms): close failed attempt spans and retain trace call IDs

* docs(llms): clarify request and stream retry ownership

* fix(llms): classify attempt errors before exporting finished spans

* fix(llms): preserve successful model span completion timing

* fix(llms): use camelCase for error context fields
2026-10-15 14:42:30 -07:00
Saoud Rizwan c8f808b51e test(core): expect the OpenCode Go /inference/go/v1 endpoint in routing tests (#15051)
The catalog refresh in #15047 moved OpenCode Go from /zen/go/v1 to
/inference/go/v1 and updated the llms tests, but the core routing test
still asserted the old URL, failing sdk-test on main (and therefore
sdk-publish).
2026-10-15 13:25:30 -07:00
Saoud Rizwan 90f9ba059e feat(desktop): remove the Cloud sessions settings toggle (#15110)
* feat(desktop): enable cloud sessions for everyone

Remove the Cloud sessions preview toggle from Settings and the
code-cloud-agents rollout flag that revealed it. Cloud sessions are now
on by default; CLINE_CODE_CLOUD_AGENTS=0 still turns them off for
development and tests.

* fix(desktop): keep the code-cloud-agents rollout flag as the cloud gate

Only the Settings opt-in should go away. Cloud sessions are enabled
wherever the code-cloud-agents PostHog flag is on (or the
CLINE_CODE_CLOUD_AGENTS env override forces them).
2026-10-15 13:23:49 -07:00
Mikołaj Kondratek 3834735da2 fix(webview): keep the Run task card above the Auto-approve bar in JetBrains (#15120) 2026-10-15 15:45:19 +02:00
Tomás Barreiro 48594e5a7c Log request ids (#15044)
* Log request ids on failure logs

* refactor

* Capture only the base error message

* address review comments
2026-10-15 14:13:09 +02:00
Saoud Rizwan 2ffa920b0e fix: add /v1 to host-only OpenAI Compatible base URLs once, on VS Code and JetBrains (#15108)
* fix(vscode): migrate host-only OpenAI Compatible base URLs to /v1 once

Earlier extension builds sent requests for a host-only OpenAI Compatible base
URL to <host>/v1. #15057 now uses the URL as entered, so persist the /v1 for
existing users once instead of retrying requests at runtime.

* Revert "fix(vscode): migrate host-only OpenAI Compatible base URLs to /v1 once"

This reverts commit 424bad47e8.

* fix(vscode): add /v1 to host-only OpenAI Compatible base URLs in the storage migration

Earlier SDK extension builds sent requests for a host-only OpenAI Compatible
base URL to <host>/v1. #15057 now uses the URL as entered, so add a v4 step to
the VS Code storage migration that saves the /v1 for existing users once.

* fix(vscode): don't log the OpenAI Compatible base URL in the /v1 migration

Base URLs can carry credentials (user:pass@host) or tokens in the query string.

* fix: run the OpenAI Compatible /v1 migration on JetBrains too

Move the host-only base URL rewrite out of the VS Code-only storage
migration into a host-neutral step that both extension.ts and the
standalone cline-core.ts run before initialize(). It keeps its own marker
in the shared globalState.json, set even when there is nothing to rewrite,
so it runs once across hosts and later host-only URLs stay as entered.
2026-10-15 02:15:02 -07:00
Saoud Rizwan 0474213f6c fix(vscode): keep Auto Compact and its strategy together in Feature settings (#15109)
The Cloud toggle was appended to the agent toggle list, which renders
before the Auto Compact Strategy dropdown, so it split Auto Compact from
its strategy. Render the Cloud row after Web Search instead.
2026-10-15 00:15:39 -07:00
Dominic Cooney 789f79e46d feat(core): run plugins only in workers; drop the in-process mode (#15069)
Plugin code never runs on a host's main thread. The in_process execution
mode is removed along with the fallback to it when a host shipped no
worker bootstrap: that fallback turned a loud "plugins do not load" into
a silent "plugins run inside the hub", which is the failure class behind

CLINE_PLUGIN_MODE is now `worker` (default) or `sandbox`; `in_process` is
no longer honoured.

A host that ships no bootstrap for the requested mode fails every plugin
load with PluginBootstrapMissingError, which names
CLINE_PLUGIN_BOOTSTRAP_PATH, so the cause shows in `cline config tools`,
`cline hub plugins`, and session-start warnings instead of plugins
silently dropping. The SSH remote helper is such a host today: it is
uploaded as a single file with no bootstrap beside it, so plugin tools
are reported missing there instead of running inside the remote hub.

With no plugin code in the host, the registry loses the jiti import
path, per-session module copies, AsyncLocalStorage call scoping, the
__clinePluginHost shim, and stack attribution of uncaught errors. The
daemon's uncaughtException / unhandledRejection handlers are fatal
again. The in-process registry tests that cover retained behaviour
(hook timeouts and error modes, multi-session notices, capability
checks, discovery and settings issues, command/rule/builder timeouts,
host-rejected registrations, timeout overrides, reload) move to the
worker suite.

How each host obtains the bootstrap and the SDK packages plugins
import, and embedding them in compiled binaries, is left to follow-ups.
2026-10-14 16:42:19 +09:00
Saoud Rizwan adc7b15535 fix(vscode): include attachments in ask_question answers (#15059)
* fix(vscode): include attachments in ask_question answers

Answer a pending ask_question with the user's images and attached files
in the tool result itself, as the pre-SDK extension did, instead of
dropping them. The SDK's AskQuestionExecutor may now return text and
image blocks (the same shape read_file returns), and the answer bubble
shows the attachments.

* fix(vscode): let cancel settle an ask_question answer while attachments load

Cancelling the task while an answer's attached files were still being
extracted could not release the question, so the old run (and anything
waiting for it to stop) stalled until extraction finished. Keep the
claimed resolver reachable so clearPending settles it immediately.
2026-10-14 00:17:19 -07:00
868464e4f3 fix(vscode): don't append default path to OpenAI Compatible base URL (#15057)
* fix(vscode): don't append default path to OpenAI Compatible base URL

normalizeSdkBaseUrl inherited the SDK default path (/v1) for URLs with no
path, turning https://abc.com into https://abc.com/v1. OpenAI Compatible
endpoints are user-supplied and were passed verbatim by the legacy client,
so skip default-path inheritance for this provider.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(vscode): reword base URL comment per review

Co-authored-by: Mikołaj Kondratek <19799111+mkondratek@users.noreply.github.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Mikołaj Kondratek <19799111+mkondratek@users.noreply.github.com>
2026-10-14 08:26:11 +02:00
BeeandSaoud Rizwan 83ea9a41d1 refactor: Start the desktop and SSH remote hubs through the bundled Cline CLI (#14792)
* Let hosts choose the hub daemon launcher and defer spawn-only setup

Adds setHubDaemonLauncher so an embedding process can start the hub
daemon through a bundled Cline CLI instead of its own executable, and a
beforeSpawn hook on ensureDetachedHubServer that only runs when a new
daemon is actually started.

* Add programmatic options to cline hub ensure

hub ensure/start gain --json (URL + auth token), --allow-port-fallback,
--no-connectors and --login-shell-path, and the hub command accepts
--discovery-path for a dedicated discovery record. These let the desktop
app and SSH remotes start or reuse a hub through the CLI.

Also extracts the standalone binary compile step into
script/compile-binary.ts so other packages can build the CLI binary.

* Run SSH remote hubs through the Cline CLI

SSH remotes now upload the Cline CLI binary and start or reuse the remote
hub with 'cline hub ensure --json --discovery-path ...', stopping it with
'cline hub stop'. The dedicated remote helper entrypoint is removed;
cleanup records from older releases still stop through the old flag.

* Run the desktop backend on the bundled Cline CLI

The desktop app no longer compiles its own executable. It bundles the
self-contained Cline CLI (externalBin cline-cli) plus the backend as a JS
bundle that runs on the CLI's embedded runtime. At startup the backend has
the CLI run 'hub ensure', which reuses a compatible healthy Hub or starts
one, and any Hub it starts later also goes through the CLI binary. Linux
CLI copies are bundled for SSH remotes.

* Launch the desktop backend through the bundled Cline CLI

The Tauri shell resolves the bundled cline-cli and the backend bundle
(per-platform resource layouts) and starts 'cline-cli run' on it. The
Windows installer stops users of cline-cli.exe, and also stops and removes
the backend executable of earlier releases on upgrade.

* Recognize the CLI-hosted desktop backend in cline doctor --fix

* Update desktop publish workflow and docs for the bundled Cline CLI

Telemetry selfchecks and smoke tests run the backend bundle on the
bundled CLI, and the Windows signature gate verifies cline-cli.exe.

* fix(desktop): address runtime packaging review findings

* fix(desktop): preserve failed hub cleanup and handle exited daemons

* fix(hub): distinguish missing discovery records from read failures

* fix(hub): preserve discovery recovery while enforcing strict shutdown reads

* fix(cli): do not count hub commands as CLI activations (#14870)

* fix(cli): do not count hub commands as CLI activations

The desktop app runs `cline-cli hub ensure` on every launch and the SSH
remote flow runs `cline hub ensure` on every connect. Both went through
runCli(), which captured user.extension_activated unconditionally, so each
desktop launch was double-counted as a CLI activation and every SSH remote
host (with its own distinct id) showed up as a new CLI user.

Skip the activation capture for the hub subcommand; it is plumbing other
clients invoke, not a user activation. Hub-owned task telemetry is
unaffected since the daemon path never enters runCli().

* test(cli): clear the hub command mock between main.test.ts cases

* test(cli): stop stubbing the hub command module in main.test.ts

The module-wide vi.mock("./commands/hub") replaced createHubCommand with
a no-op, so `cline hub dashboard` (routed through createHubCommand) never
reached the dashboard mock and three dashboard tests failed. Drop the
module mock and assert the activation exclusion through
`hub dashboard --no-open`, which is already mocked.

---------

Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
2026-10-13 21:58:41 -07:00
1932d5dc37 feat(vscode): Cline Cloud sessions - run tasks in a hosted sandbox from the extension (#13799)
* feat(sdk): support header-authenticated remote Hub connections

Ports the NodeHubClient resolveConnectionHeaders option from #13519 so a
client can authenticate a remote proxy's WebSocket upgrade with HTTP headers
(refreshed on every reconnect), and threads it through HubRuntimeHost and
RemoteRuntimeHost so ClineCore remote runtimes can reach Cline Cloud sandboxes.

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>

* feat(vscode): cloud session runtime, control-plane client and history integration

Adds the extension-host side of Cline Cloud sessions:
- CloudSessionsService: REST client for GitHub App status/repos/branches and
  the outer session records (create/list/status/delete/rename/history)
- CloudSessionHost: an SdkSessionHost over RemoteRuntimeHost that dials the
  sandbox Hub through the api.cline.bot proxy with the account token, maps
  outer/inner ids and re-emits events so the existing chat pipeline is reused
- SdkCloudSessionCoordinator: starts/reopens cloud tasks, keeps sandbox
  connections alive to track running/finished status, notifies on completion
  and projects cloud sessions into task history
- CloudService proto + handlers, NewTaskRequest execution target, history
  cloud fields/filter, ext-cloud-sessions feature flag

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>

* feat(vscode): cloud sessions UI — home task-target panel, running strip, history and account

- Home screen: Local | Cloud chooser above the composer with GitHub repo and
  branch pickers (prefilled from the workspace's origin remote and branch) and
  an onboarding card that walks through connecting GitHub, polling until done
- Running-in-the-cloud strip and cloud status pills in Recent/History, plus a
  Cloud Only history filter
- Task header cloud badge (repo @ branch, opens the dashboard); cloud tasks
  render inline diffs, hide checkpoint/restore and only attach images
- Account view: Cline Cloud card with GitHub connection status

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>

* fix(vscode): cloud task fixes found in manual testing

- claim the task-view generation after clearTask (which bumps it), so cloud
  task start/open is not treated as superseded and left on Thinking
- track completion from the agent done event and keep completed/failed over
  the trailing idle status so History shows Done instead of Cloud
- stop the branch picker from re-querying on every render
- readable popover text in the repo/branch pickers; hide cost chips on cloud rows

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>

* docs(vscode): cloud sessions follow-ups and test stub for org switch reset

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>

* fix(vscode): make cloud sessions Act-only

Match the desktop app and the cloud dashboard: cloud sessions are created in
Act mode regardless of the selected mode, no per-turn mode is sent, the host
refuses Plan/Act toggles while a cloud session is active, and the webview pins
the toggle to Act (disabled, with a tooltip) while a cloud task is shown or
about to start.

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>

* test(vscode): add local cloud session boundary

* fix(vscode): preserve cloud outcomes and stale-work ownership

* fix(vscode): drain cloud cleanup before account changes

* fix(vscode): build cloud sandbox config through the Cline path

* docs(vscode): clarify cloud proxy rollout boundary

* fix(vscode): close cloud picker when leaving chat

* fix(vscode): wait for cloud session before opening dashboard

* fix(vscode): keep account history in document flow

* fix(vscode): report available cloud task usage

* fix(vscode): cancel cloud tasks during provisioning

* fix(vscode): make cloud model billing explicit

* fix(vscode): hide local approvals for cloud tasks

* fix(vscode): resolve cloud prompt before session adoption

* fix(vscode): seed local cloud development profile

* fix(vscode): sanitize local cloud fixture errors

* fix(vscode): handle cloud state before hydration

* fix(core): honor proxies for remote Hub WebSockets

* fix(vscode): preserve cloud task IDs

* fix(vscode): explain cloud auto-approval

* test: repair cloud and proxy CI fixtures

* fix(vscode): resolve cloud status after restart

* fix(vscode): resolve flags for restored accounts

* fix(vscode): keep cloud tasks in the cloud and in Act mode

* test(vscode): let the local cloud fixture delay model replies

CLINE_LOCAL_CLOUD_MODEL_DELAY_MS holds the scripted reply so cancellation and navigation can be exercised while a cloud task is still thinking.

* fix(vscode): cancel a cloud task that is still provisioning

Cancelling during "Starting a cloud sandbox..." did not stop the start:

- Cancel arriving while initTask awaited remote config found no pending
  start, so the sandbox went on to provision, connect and run the prompt
  behind a "Resume Task" view, and the user paid for a sandbox they had
  cancelled. initTask now claims the cloud start before its first await.
- Cancel arriving during the readiness poll took effect only after the
  sandbox came up. createSession accepts an abort signal that stops the
  poll, so the unused record is deleted as soon as the control plane
  answers.
- clearTask (New Task) now cancels a pending cloud start too; a
  provisioning task has no SDK session for the task controller to end.

The local cloud fixture reports `ready` like the hosted control plane and
accepts CLINE_LOCAL_CLOUD_PROVISION_DELAY_MS to hold new sandboxes in
`provisioning`, so this window is reproducible. The cloud Vitest config
restores the Zod namespace export the same way vitest.config.ts does.

* fix(vscode): keep cloud status displays truthful and hosts open while in use

A status check that resolved a cloud task as idle or finished closed the
host while openCloudTask could still be reading messages or attaching
the session on that same host. Entries now count the openCloudTask calls
using them, and neither status resolution nor the idle sweep disposes a
host that is pinned or belongs to the displayed task.

Cancelling a cloud start while remote config was still loading left the
turn phase at streaming after the view had returned home. initTask no
longer sets the phase for cloud starts; the coordinator sets it once the
start is still current and its task view is installed.

useResolvedCloudStatuses kept a resolved status after history reported
a newer one, so a task resolved as running stayed "Working" after it
completed. The hook now returns statuses only for tasks history still
reports as unknown, and the running strip lists a task only while its
effective status is active or unconfirmed.

An unknown status showed a spinner labelled "Checking" for as long as
connections kept failing. It is now shown as Unconfirmed with a static
icon; only provisioning and running animate.

* test(core): run the proxy tunnel fixture with a real Node executable

When Bun runs vitest it reports its own Node-compatible shim as
process.execPath and places it first on PATH. That runtime ignores
NODE_EXTRA_CA_CERTS, so the spawned fixture failed TLS verification on
the Windows CI runner. The test now looks past the shim for an installed
Node and is skipped when none is available.

* fix(vscode): remember cloud task status across restarts

After a restart every cloud row in History showed "Unconfirmed" and
joined the running strip until a socket to each sandbox re-learned its
status, and the first status a socket reported bumped the row's
timestamp to now, reordering History (CLINE-3307, CLINE-3424,
CLINE-3418).

The coordinator now writes the last settled status it confirmed over a
live connection to global state (`cloudSessionStatuses`, keyed by
session id with the observation time) and reads it back when it first
sees a record. The remembered status is trusted only while the control
plane's `updatedAt` is no later than the observation plus a one-minute
grace, because the control plane touches `updatedAt` when a client
connects; a later touch means another client may have run the agent, so
the row falls back to unknown and is resolved live as before. Active
statuses are never remembered. Ids the account no longer lists are
pruned on every list refresh.

A connection that only learns the current status no longer counts as
activity; the row's timestamp moves only when the status changes while
connected or the user sends a follow-up.

* fix(vscode): settle account switches without blocking History

* fix(vscode): refresh stale cloud outcomes without restarting

* test(vscode): wait for cloud run cleanup before removing sandbox

* fix(vscode): reserve switch errors for account transitions

* refactor(vscode): remove unused cloud accessors and refresh notes

* test(vscode): seed expired sessions and a 402 model reply in the cloud fixture

The loopback fixture only ever served live sandboxes, so the read-only
expired path and the out-of-credits path could not be exercised without a
day's wait or real spend.

CLINE_LOCAL_CLOUD_SEED_EXPIRED=1 seeds two Personal sessions whose
sandboxes are gone: one with an archived transcript, one that answers
/history with the control plane's 404 "no history captured". Their
WebSocket upgrade returns 410 like the real proxy and /status reports
"expired". CLINE_LOCAL_CLOUD_INSUFFICIENT_CREDITS=1 makes every scripted
model reply the hosted API's 402 insufficient_credits body.

* fix(vscode): explain expired cloud sessions instead of showing an error

Opening a cloud task whose sandbox the control plane retired showed a red
error row and, when no transcript had been archived, a synthetic Done row
above it. QA read this as data loss (CLINE-3322).

The row is now an informational notice that says the sandbox was retired
after 24 idle hours and names the repository to start a new cloud task on.
It tells three cases apart: the archived conversation is shown above it;
no conversation was archived (the control plane answered 404); or the
archive could not be loaded right now, with the error. An empty transcript
is no longer rendered, so no Done row appears. The History pill reads
Archived with a tooltip explaining the retirement.

* fix(vscode): show the out-of-credits card for cloud task failures

A cloud turn that failed on the Cline API's 402 insufficient_credits
reply ended with Retry / Start New Task and no explanation (CLINE-3376).
A Hub-hosted session does not forward the agent's "error" event; the
client learns of the failure only from run.failed, which the runtime host
turns into done(reason: "error") with the failure message as its text.
The translator recorded the error outcome for that event but rendered
nothing.

done(reason: "error") now renders the same api_req_started and
api_req_failed rows as an "error" event, once per turn, so ErrorRow shows
the Buy Credits card (or the plain error) for cloud tasks as it does for
local ones. Both paths share one helper.

* fix(vscode): explain cloud sessions deleted or retired since History loaded

Opening a cloud task deleted from the dashboard showed "Could not connect
to this cloud session: Unexpected server response: 404" and left the row
in History (CLINE-3377). The Hub client reports only the HTTP status of
the refused upgrade.

A failed connection now asks the control plane for the session's status.
A deleted session shows a notice and leaves History; a session retired
since the list was fetched opens as expired, with its archived
conversation if one exists. Other failures keep the connection error.

The loopback fixture now answers an unknown session's upgrade with 404,
as the hosted proxy does, instead of 401.

* fix(vscode): only suggest cloud branches that exist on GitHub

The cloud branch picker was prefilled with the workspace's checked-out
branch even when it had never been pushed. The sandbox clones from
GitHub, so the session then failed to start (CLIENTS-109).

The workspace default is now the remote branch the checkout corresponds
to: its upstream on origin when one is configured, otherwise the same
name when origin has it. A local-only branch yields no suggestion and the
picker falls back to the repository's default branch. Branches listed
from the GitHub API were already remote.

* fix(vscode): accumulate streamed text for cloud tasks

A cloud task's reply flickered chunk by chunk and only appeared whole
when the message finished (CLIENTS-111). The translator showed each
content_start's `accumulated` text, falling back to the chunk alone. A
local session sends the running total, but a Hub-hosted session forwards
assistant.delta as a bare chunk, so each update replaced the last.

The translator now keeps the running total itself when `accumulated` is
absent, and clears it with the other per-block streaming state.

* fix(vscode): show the cloud model in the composer while Cloud is selected

With Cloud selected, or a cloud task open, the composer footer still
showed the local provider and model, e.g. anthropic:claude-opus, although
the sandbox runs a Cline model (CLIENTS-116).

The extension now reports cloudModelId in state: the model the displayed
cloud task runs on, else the one a new cloud task would start with. The
start path and the label share one function, so they cannot disagree.
The composer shows it as cline:<model> whenever it pins the mode to Act
for Cloud.

* fix(vscode): release the retained host of a deleted cloud session

When a session opened from History turns out to have been deleted, its
entry leaves the registry. A connection retained from an earlier status
check stayed open with nothing to watch; dispose it with the entry.

* fix(vscode): keep expired-session and cloud-model displays truthful

An archived cloud transcript was rendered with the final turn marked
completed, so the last reply of a task that was still running when its
sandbox retired showed as a green Done box. Retirement is not
completion; the final reply now stays a plain text row.

An archive that exists but holds no messages rendered nothing yet the
notice pointed at "the conversation above", and the History tooltip
promised a readable conversation for every Archived row. An empty
archive now reads as none, and the tooltip says to open the session to
see whether one was saved.

With a non-Cline local provider the composer showed the cached or
fallback recommendation while the start path refreshed the list first
and could pick a different model. The start now uses the model shown
when the user submitted, snapshotted before any await, and the
composer warms the recommendation cache once so the label moves from
the fallback to the live recommendation before the next submit.

* fix(vscode): confirm an account switch overtaken by its own auth update

switchOrganization confirmed a switch by re-reading the organizations
and treating an answer overtaken by a newer read as no answer. The
extension's auth refresh after the PUT starts such a newer read, so a
switch that succeeded returned false and the ClinePass switch control
asked the user to retry it.

Every read now returns the server's answer; only the newest read still
writes context state.

* fix(core): connect header-authenticated Hub sockets under Bun

The desktop sidecar runs the cloud session controller under Bun. Since
a2cefba05 the header-authenticated Hub client imported the npm `ws`
package through a `node-ws` alias so a proxy agent could be attached.
Under Bun 1.3.13, the toolchain this branch was pinned to, Bun's
node:http client never emits `upgrade`, so the npm `ws` treats the 101
as an ordinary response and connect() fails with "Unexpected server
response: 101". Cloud sessions in the desktop app could not connect.

Import `ws` directly again. Bun substitutes its own client, which reads
the proxy URL and Proxy-Authorization from the same `agent` option that
Node's `ws` uses, so one socket shape tunnels on both runtimes and the
`node-ws` dependency and its @ts-expect-error go away.

The tunnel test now runs the fixture under Bun as well as Node. Bun's
TLS client does not read NODE_EXTRA_CA_CERTS, so the Bun leg tunnels a
plain ws:// destination; it still checks the CONNECT, the upgrade and
where the credentials land. With the `node-ws` import the Bun leg fails
on 1.3.13 and the Node leg passes, which is the gap that let this ship.

* fix(vscode): retry the cloud model recommendation after a failed fetch

The composer shows the model a new cloud task will run on. When the
local provider is not Cline that is the top recommendation, warmed once
by the coordinator. A fetch that failed returned the built-in fallback
without caching it, but the coordinator kept its warm-up handle, so it
never asked again and the fallback stayed in the composer and in new
sandboxes until the extension restarted.

Release the handle when a fetch settles without filling the cache, so
the next state post retries.

* fix(vscode): stop the recommendation warm-up from polling a failing endpoint

The warm-up posted state after every fetch, including one that returned
the built-in fallback. That post reads the model again, which starts the
next fetch, so a recommendation endpoint that keeps failing was polled
without bound while Cloud was selected with a non-Cline provider.

Post state only when the fetch filled the cache. A failed fetch still
releases the handle, so the next read the user causes retries.

* fix(vscode): disable the composer while a cloud sandbox is provisioning

The composer allows sending during the streaming phase so follow-ups can
queue on a running task, and a cloud start sets that phase while the
sandbox is still provisioning. There is no session to queue on yet, so
askResponse hit the expired-session guard and answered "This cloud
session is no longer running" while the sandbox kept starting, dropping
the message.

The displayed cloud task now reports status provisioning while its start
is pending, and the composer keeps submit disabled on that status so the
draft stays in place until the sandbox is running.

* fix(vscode): re-enable the composer after a failed cloud start

The failure path posts state while the start is still pending, so the
composer kept seeing "provisioning" and stayed disabled. Post state once
more after the pending start is cleared. The askResponse guard, still
reachable through the extension API while the composer is disabled, now
says the sandbox is starting instead of that the session is gone.

* style(vscode): wrap two JSX lines the CI formatter rejects

Biome 2.4.5 on main wraps these attributes; the branch's Quality Checks
failed on them after the rebase onto that formatter version.

* test(vscode): pin the composer's provisioning status through a failed start

The displayed cloud task reports provisioning while its start is pending,
and the last state post after a failed start no longer carries it, so the
composer re-enables without waiting for an unrelated refresh.

* fix(vscode): keep a draft typed while a cloud task is provisioning

handleSendMessage cleared the composer a second time after its RPC
resolved. Every send path already clears the draft before the RPC, so
the second clear only ever removed text the user typed while the RPC was
pending. A local newTask resolves too quickly to notice; a cloud newTask
resolves only after the sandbox is provisioned, so the draft the disabled
composer was holding for the user vanished when the sandbox came up.

* fix(vscode): follow main's rename of the sign-in retry field

#14628 replaced pendingClineAuthRetryPrompt with pendingClineAuthRetry.
The cloud coordinator's clearTask callback and the cloud branch of
initTask still cleared the old field, which no longer exists.

* fix(vscode): tear down cloud sessions when ClinePass switches the account

Selecting the ClinePass provider switches the active account to Personal
by calling switchAccount directly. The Account view's organization switch
runs the same call inside resetCloudSessions, which detaches the displayed
cloud task and its authenticated hosts and drains pending cleanup before
the account changes. Without that, an organization cloud task stayed on
screen after the account became Personal, and a still-pending DELETE could
use the new account's credentials.

Route the ClinePass switch through the same reset, and only when an
organization is active: every API configuration update passes through
this path, and the reset would otherwise clear a displayed cloud task for
a model change that switches nothing.

* fix(vscode): page History's Cloud Only filter after filtering

The Cloud Only filter ran on a page already cut from the merged
local-and-cloud list, and hasMore was computed from that page. With more
than a page of newer local tasks the first page came back empty while
cloud tasks existed further down, and hasMore said there was nothing more.

When Cloud Only is on, list the whole history, filter, then apply offset,
limit and hasMore to the filtered records.

* fix(vscode): stop reporting a model change the cloud sandbox never made

CloudSessionHost.updateSessionModel called an optional method that
RemoteRuntimeHost does not have, then recorded the new model anyway.
Choosing a different local model while a cloud task was displayed made
the composer name that model while the sandbox kept running on the one
it was started with.

The Hub protocol has no command to change a running session's model, so
drop the method. The lifecycle already treats a host without it as
unable to switch, and the composer keeps naming the model the sandbox
was started on.

* fix(vscode): hide a cloud task's cost until the sandbox reports usage

The task header decided whether to show the cost badge from the local
provider's cost display setting. For a cloud task with no usage yet that
showed $0.0000, which reads as a confirmed zero for a charge that is not
known. Cloud tasks now show the badge only when the sandbox has reported
usage; local tasks keep the provider-based decision.

* fix(vscode): do not offer to open a cloud task's files in the local editor

Cloud edits render through DiffEditRow, whose file name and open icon
call openFileRelativePath. The path is relative to the sandbox's
/workspace, so clicking opened an unrelated local file or failed. The row
now takes canOpenFile; ChatRow passes false for cloud tasks, which drops
the click action and the open icon and leaves the path as plain text.

* fix(vscode): keep the cloud repository and branch choice truthful

Two ways the stored cloud target could name something the current
account cannot start a sandbox on:

- The repository selection persists across account changes. When the new
  account has no accessible repositories the panel showed onboarding, but
  the old URL stayed stored, so the composer still treated the target as
  ready to submit. Clear the stored repository once the account's list
  is known and does not contain it.

- The workspace branch was persisted from the local remote-tracking ref
  without checking GitHub. A branch deleted on GitHub but not pruned
  locally was suggested and submitted, and provisioning failed. Start on
  the repository's default branch and ask GitHub for the workspace branch
  by name; the unfiltered branch list is paginated, so its first page
  cannot decide. Suggest the branch only if GitHub returns it and the
  default branch is still selected, so a branch the user has since chosen
  stays.

* fix(vscode): reconcile retained cloud connections with the account's list

Two ways a cloud session's record and its connection could disagree:

- A list refresh kept any entry that still had a host, so a task deleted
  from the dashboard stayed in History with an open authenticated
  connection, and a 401 cleared the entries without closing their hosts.
  An entry whose record has left the list, or every entry on a 401, is now
  dropped and its host closed. The displayed task is the exception in both
  cases: its host stays so that opening it can explain a deletion, and so
  that signing in again after a 401 leaves a task that can continue.

- When a sandbox retires after History was listed, its WebSocket rejects
  with 410 while /status may answer 200 with status "expired". The probe
  treated every successful /status as "not expired", so the task opened
  to a connection error instead of the retirement notice. A 200 that says
  expired now counts as retirement, like a 410.

* fix(vscode): subscribe monitored cloud tasks to their Hub event stream

The Hub streams a session's events only to clients subscribed to it, and
the runtime host subscribes when it first sends a command for that
session. A connection opened only to resolve a History row's status sent
none: it listed sessions, read the status, and then waited on an event
stream that was never opened. A turn finished by another client left the
row on Running and the completion notification never fired.

Listing the task's pending prompts after discovery sends that first
command and opens the stream.

* test(vscode): keep the local cloud fixture alive when a client drops its socket

An extension host that reloads or exits closes its bridged WebSocket
without a close frame. The bridge attached no "error" listener to either
side, so ws raised an unhandled error and the fixture process exited,
taking every sandbox with it. Terminate the failed socket instead.

* Own the account boundary in switchAccount

Four paths changed the active account (the Account view, ClinePass
selection and two remote-config paths) and only one of them tore down
the previous account's cloud task and connections first. Each caller
had to remember to wrap the switch, and two did not.

switchAccount now runs every change inside a boundary the controller
installs once (the cloud coordinator's reset), and serialises switches:
one requested while another is in flight waits for it and then decides
against the account as it is then. A caller that read a stale account
cannot skip a needed switch or repeat one that just happened, so the
ClinePass gate and the Account view's pending-switch map are gone.

* Resolve the cloud task target in the extension

The task-target panel computed the whole stored target from five
effects (account repositories, workspace remote, GitHub branch check,
repository click, Local/Cloud click), each writing the result back.
Any two could interleave and the later write won: a branch check that
landed after the user clicked Local flipped the target back to Cloud.

The extension now stores only what the user chose, one field per
choice (Local/Cloud, a repository, a branch), and resolves the rest on
every state post: the stored repository if this account can reach it,
else the workspace's, else the first; the user's branch, else the
workspace branch once GitHub confirms it exists, else the default.
Nothing derived is written, so no lookup can override a click, and a
repository chosen under another account is never submitted. Failed
lookups retry after 30 seconds; the GitHub connection is cached per
account and shared with the Account view.

The webview panel renders the resolved view and sends each click as
one choice.

* test(vscode): keep the cloud fixture alive when the Hub socket fails early

The fixture's session proxy attached its error handler to the upstream
Hub socket only after "open". An error during the handshake was
unhandled and exited the fixture process, which the extension then saw
as "Timed out connecting to hub after 8000ms". Attach the handler at
construction for both sides of the bridge.

* Refresh aged cloud-target inputs and always restore the server account

The task-target resolver cached repositories and the workspace checkout
for as long as the account and directory stayed the same. Repository
access changes in the browser and the checkout changes in the terminal,
and neither notifies the extension, so the picker could keep offering a
revoked repository or suggesting the previous branch. A loaded input now
ages out (repositories after 60 s, the checkout after 10 s): a read past
that returns the cached answer and reloads behind it.

switchAccount skipped the request when the cached account already
matched. The server's active account is shared by every client on the
login, so another client may have moved it. The request is now always
sent; only the cloud teardown is gated on the cached account changing.

* Retry a failed cloud start instead of declaring the session gone

A cloud task whose sandbox never came up shows "Failed to start the cloud
session" with Retry / Start New Task, but Retry appended "This cloud
session is no longer running" and the footer then stayed disabled: the
webview holds its recovery claim until the turn phase advances, and the
refusal never advanced it.

The coordinator now hands the failed input to the controller, which keeps
it as the same pending start retry a "Sign in to Cline" error uses. Retry
runs the cloud task again on the same repository and branch; a prompt
typed into the composer starts one with that prompt. Refusing a response
to a session that is gone sets the turn phase, so the footer releases
its claim either way.

The task-header tooltip no longer doubles its full stop when the task
has no repository. The local cloud fixture starts a sandbox's Hub when
the session becomes ready rather than on the first socket upgrade, so a
cold start cannot outlast the client's connect timeout.

* test(vscode): let the cloud fixture refuse session sockets

CLINE_LOCAL_CLOUD_REFUSE_SOCKETS=1 answers every session socket upgrade
with 503, so a cloud start fails after its sandbox is ready and the
footer's Retry path can be exercised by hand.

* Replace the carried-forward transcript when the new epoch's snapshot lands

Retrying a failed cloud start appended the new attempt below the old
one instead of replacing it. The new task's first partials reach the
webview before the debounced state snapshot of the new epoch; the
reducer deliberately carries the old rows forward on a lone newer-epoch
partial, but then treated the snapshot as same-epoch and merged, so the
old rows were never removed. The replica now remembers that it carried
rows forward, and the first snapshot at that epoch replaces them while
keeping the newer-epoch partials already held.

A prompt typed after a failed start also left its optimistic bubble
below the new task row: the bubble is user_feedback, but a restart is
confirmed by a task row. Any user-authored row with the same text and
attachments now confirms the bubble.

* test(vscode): keep the cloud scope fixture complete

Supply the failed-start callback required by the cloud retry path and
assert that the coordinator hands it the failed task and original input.
Check the fixture keys against the options interface before casting its
partial service doubles, so a new required option fails typechecking.

* fix(vscode): send Cancel to the task on screen, not a cloud start left behind (#14794)

A cloud start stays pending after the user opens another task from
History. Cancel always cancelled that pending start first, so cancelling a
running task (cloud or local) cleared its view instead, and a cloud turn
kept running in its sandbox. Only cancel the pending start when its own
view, or no task, is on screen.

* fix(vscode): delete cloud sandboxes left provisioning by a reload or quit (#14791)

* fix(vscode): delete cloud sandboxes left provisioning by a reload or quit

A terminating extension host cannot reach the network (VS Code's fetch
resolves proxies through the window it is detaching from), so the cleanup
DELETE a reload or quit triggers during provisioning never leaves the
process and the sandbox is orphaned. Record each provisioning sandbox in a
per-extension-host file under the Cline data directory until its task
starts or its cleanup is confirmed, and let the next extension host delete
records whose owner has exited.

* fix(vscode): recover abandoned cloud starts only when it is safe

Address review of the abandoned-start journal:

- Keep a record until the control plane confirms the sandbox is gone. A
  401, 429 or 5xx no longer erases it; only a successful DELETE or a 404
  under the account and endpoint that started it settles it.
- Keep a record until the sandbox has started the first turn, not just
  until the send was queued. Recovery connects to a sandbox before
  deleting it and leaves one that already holds a conversation, in case the
  host exited after the turn was accepted but before recording that.
- Name each journal by pid and extension-host lifetime and refresh it while
  it has records, so an earlier lifetime of this pid, or a pid reused by
  another process, reads as abandoned instead of being skipped or
  overwritten.
- Run recovery as one scope operation of the account that started the
  sandboxes: an account change waits for a DELETE in flight and stops the
  rest, nothing runs after disposal, and reset and dispose cancel the
  recheck timer.

* fix(vscode): never recover a cloud start that may still be live

- A sandbox's saved transcript stays empty until the first turn's
  iteration ends, so recovery could delete a task whose first turn was
  running. Treat any Hub session status other than idle as a turn the
  sandbox has taken.
- Drop the journal heartbeat. A missed refresh does not prove the owner
  exited (it may be paused in a debugger or asleep), so a journal whose
  pid is alive is never taken; a pid reused by another process only
  delays recovery until that process exits.
- Bound the sandbox inspection with a timeout and stop awaiting its
  detach, so an unresponsive sandbox cannot hold the account scope.

* refactor(vscode): simplify abandoned cloud start recovery

Drop the record right before the first prompt is sent instead of waiting
for the sandbox to report turn acceptance. A surviving record then means
the prompt never left the extension host, so its sandbox holds no user
work and recovery can just DELETE it. This removes the turn-acceptance
tracking in CloudSessionHost and the sandbox inspection (connect, status
check, transcript read, timeout) that recovery needed to tell an orphan
from a live task.

Also fail the start when the record cannot be written, so its normal
cleanup DELETE runs while the host can still reach the network, and treat
only ESRCH as proof that a journal's owner has exited.

* fix(vscode): fail a cloud start whose pending record cannot be dropped

Recovery deletes any recorded sandbox without inspecting it, so the record
must be gone before the first prompt is sent. If dropping it fails, fail the
start instead of sending; its normal cleanup then deletes the sandbox. After
a confirmed deletion a leftover record is harmless, so that path only logs.

* fix(vscode): preserve provisioning tasks opened from History (#14793)

Keep a pending cloud start alive when its own History row is opened,
reject older selections, and relist its sandbox when startup settles.
Carry the task-view fence across clearTask instead of claiming again.

Retain abandoned-start journaling from the target branch and verify its
record survives own-row reopening until immediately before the first send.

* fix(vscode): keep a failed cloud start's images when Retry is clicked

The webview's Retry response omits images, which protobuf decodes as an
empty list, so `images ?? retry.images` dropped the attachments and the
retried sandbox ran on the text prompt alone. Fall back to the failed
start's images unless the response actually carries some.

* fix(vscode): stop sending the account token into cloud sandboxes (#14970)

* fix(vscode): keep cloud sessions out of Delete All History (#14967)

* fix(vscode): keep cloud sessions out of Delete All History

* fix(vscode): report the actual Delete All History count

* fix(vscode): cancel a provisioning cloud start when the account changes (#14968)

* fix(vscode): forget a remembered cloud status once the agent runs again (#14969)

* fix(vscode): forget a remembered cloud status once the agent runs again

* test(vscode): cover forgetting a remembered status on connect

* feat(vscode): resume suspended cloud sandboxes and use the SDK's cloud client (#14973)

* test(vscode): let the local cloud fixture suspend and resume sandboxes

* fix(vscode): resume suspended cloud sandboxes instead of treating them as unknown

* fix(vscode): reopen cloud tasks whose last turn failed

* refactor(vscode): talk to the cloud control plane through the SDK's CloudSessionApi

* feat(vscode): show cloud provisioning progress and dashboard renames

* refactor(core): export the cloud session system prompt

* feat(vscode): give cloud sandboxes the SDK's shared prompt and work-branch rules

* perf(vscode): keep the local model catalog out of cloud session.create

* docs(vscode): update cloud session follow-ups for the SDK alignment

* fix(vscode): reconnect from scratch after resuming a suspended sandbox

* fix(vscode): link an organization to its own GitHub connect page

* test(vscode): only auto-suspend resumable fixture sandboxes

* fix(vscode): show the resume notice when a suspended cloud task is opened from History

showTaskWithId only dismisses the History view after the open completes,
which for a suspended sandbox is after the whole resume. The notice the
coordinator posts stayed covered and History sat unchanged for the
duration. Bring the chat view forward right after the notice is posted.

* fix(vscode): keep the UI on the server's account after a slow switch (#14971)

* fix(vscode): keep the UI on the server's account after a slow switch

* fix(vscode): retract a switch error only from the newest account read

* feat(vscode): opt-in Cloud toggle in Settings behind ext-cloud-sessions (#15018)

* feat(vscode): add opt-in Cloud toggle in Settings behind the ext-cloud-sessions flag

* fix(vscode): refresh History when the Cloud toggle changes

* fix(vscode): close four cloud-session gaps found in review and QA

- A cancelled cloud start left a ghost STARTING row in History. A list during
  provisioning adds an entry for the new record before the start holds one, and
  cleanupUnusedSession only dropped the caller's entry. It now drops the entry
  by session id and invalidates History after the DELETE settles.
- A failed DELETE left entry.host pointing at a disposed host, so a reopened
  task stopped reporting status. The host is cleared before disposal.
- Switching repositories left the previous repository's branches selectable
  while the new list loaded, so a stale branch could be saved against the new
  repository. The list is cleared and the picker disabled until it loads.
- Attached files were silently dropped from a cloud start. The composer now
  refuses the send and says why.
- compile-tests could not resolve @cline/core/cloud under classic node
  resolution; tsconfig.test.json maps the subpath to the built declarations.

* docs(vscode): track cloud session follow-ups as GitHub issues instead of a checked-in file

* merge: preserve latest VS Code cloud updates with reviewed fixes

* Saoudrizwan/cloud greptile fixes 26ac (#15073)

* test(vscode): stub @cline/core/cloud for the CommonJS integration host

* fix(vscode): keep the open cloud task's model visible when Cloud is turned off

* fix(vscode): restore a cloud runtime the Hub lost after a turn reports it missing

---------

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cline Agent <cline-agent@users.noreply.github.com>
Co-authored-by: Dominic Cooney <dominic.cooney@cline.bot>
Co-authored-by: Dominic Cooney <dominiccooney@users.noreply.github.com>
Co-authored-by: Dominic Cooney <55120+dominiccooney@users.noreply.github.com>
Co-authored-by: Dominic Coon <dominic@cline.bot>
Co-authored-by: John Choi <john.choi@cline.bot>
2026-10-13 20:31:05 -07:00
Saoud Rizwan 8009be6e33 fix(desktop): ship the SDK packages plugins import in production builds (#15068)
* fix(desktop): ship the SDK packages plugins import in production builds

Plugin installs strip @cline/* dependencies because the host provides them,
and the plugin worker resolves those from node_modules beside its bootstrap.
The packaged desktop app ships only the bootstrap, so a marketplace plugin
like goal failed with "Cannot find module '@cline/sdk'" (dev builds worked
because the repo's node_modules sit above src-tauri).

Bundle self-contained @cline/sdk, core, agents, llms and shared next to the
bootstrap (one shared copy via code splitting, ~17 MB), and widen the Tauri
resource glob so the nested files are actually bundled.

* fix(desktop): ship the SDK packages' subpath exports for plugins

Plugins can import supported subpaths such as @cline/shared/storage or
@cline/core/telemetry. Bundle every runtime export of each package and write
its exports map, skipping type-only exports that have no JS.
desktop-nightly-20261014011413
2026-10-13 18:07:06 -07:00
26cea2fa8b fix: stop undici's 5-minute idle timeout killing local model requests (#15024)
* fix(lmstudio): disable undici's idle-body timeout so slow local generations aren't killed mid-stream

* fix(lmstudio): compose the bodyTimeout override onto the active dispatcher instead of replacing it

* fix(vscode): disable undici idle timeouts for local model providers

Node's fetch applies undici's default 300s headersTimeout/bodyTimeout,
each measuring time since the last byte received. Local servers
(LM Studio, Ollama) legitimately go silent for longer while processing a
large prompt (headers arrive immediately, then no body bytes until the
first token), so long requests died mid-task with
'terminated: BodyTimeoutError (UND_ERR_BODY_TIMEOUT)' even though the
server was still generating.

Route LM Studio and Ollama inference through a fetch bound to an
EnvHttpProxyAgent with headersTimeout/bodyTimeout disabled. This calls
undici's own fetch rather than global fetch because VS Code's
http.fetchAdditionalSupport patch replaces caller-supplied dispatchers
with its own default-timeout Agent. Cancellation stays with each
request's AbortSignal.

Fixes #13464

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>

* fix(vscode): disable undici idle timeouts for providers that may run a local model

Combine the two earlier drafts: dispatch through undici's own fetch so the
override survives VS Code's global fetch wrapper, and keep the env-var
proxy agent so JetBrains proxy support is unchanged. Widen the provider
set from LM Studio and Ollama to also cover OpenAI Compatible and LiteLLM,
which telemetry shows carry most of the UND_ERR_BODY_TIMEOUT failures.

The net test now exercises real undici fetch against a local server that
flushes headers and then stays silent, with a short-timeout control to
prove the silence is long enough to trip the default timer.

* test(vscode): keep the idle-timeout net test off any machine-level proxy

* chore: drop the changeset file, the repo no longer uses changesets

* fix(vscode): only skip idle timeouts when the base URL is on the local network

OpenAI Compatible and LiteLLM often point at remote corporate gateways.
On VS Code, fetchWithoutIdleTimeouts bypasses the host's proxy handling
(http.proxy, OS/PAC proxy, proxyStrictSSL), so routing those through it
would break proxied setups. Gate on the base URL as well: loopback,
private/link-local/CGNAT ranges, single-label hosts and .local/.internal
names get the idle-timeout-free fetch; remote gateways keep the
proxy-aware fetch and its dead-connection cap.

Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>

* fix(vscode): keep loopback direct in fetchWithoutIdleTimeouts, cover 0.0.0.0 and mapped IPv4

EnvHttpProxyAgent sends loopback through http_proxy whenever no_proxy is
unset, which VS Code's own resolver never does. Pick a plain Agent for
loopback hosts and the env-var proxy agent for everything else, both
with idle timeouts off. The local-network gate now also accepts 0.0.0.0
and IPv4-mapped IPv6 addresses, which Ollama and LM Studio print when
bound to all interfaces.

The net test now runs with HTTP_PROXY set and NO_PROXY unset against a
recording CONNECT proxy: loopback never touches it, an unroutable host
goes through it, and neither path has an idle timeout.

* fix(vscode): match loopback by address so IPv4-mapped IPv6 stays direct

The URL parser rewrites [::ffff:127.0.0.1] to [::ffff:7f00:1], which a
string match on "127." misses. Use a BlockList, which checks mapped
addresses against the IPv4 rules, for the loopback bypass and drop the
now-redundant unwrapping in the local-network gate.

---------

Co-authored-by: lizhe <marshal_li_b@163.com>
Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>
2026-10-13 21:44:25 +02:00
Saoud Rizwan ed469c753a chore(vscode): release v4.1.24 v4.1.24 2026-10-13 07:43:52 -07:00
Saoud Rizwan 1a25410ccd chore(desktop): release v0.0.46 desktop-v0.0.46 2026-10-13 07:40:40 -07:00
Saoud Rizwan c606894cb1 Revert "fix(vscode): preserve attachments in pending question responses (#14986)" (#15058)
This reverts commit f8997dac23.
2026-10-13 07:31:32 -07:00
Lucien f8997dac23 fix(vscode): preserve attachments in pending question responses (#14986)
* fix: preserve attachments in VS Code question responses

* fix(vscode): preserve pending question response ordering

* fix(core): preserve display text in Hub submitted prompt events
2026-10-13 15:09:05 +02:00