Skip to content

fix(cli): restrict session PR linking to CLI backends - #14679

Merged
marius-kilocode merged 3 commits into
mainfrom
remove-link-pr-feature-vscode
Sep 30, 2026
Merged

marius-kilocode merged 3 commits into
mainfrom
remove-link-pr-feature-vscode

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The backend session PR-link recorder and five-minute poller ran on IDE backends even though VS Code, Agent Manager, and JetBrains use their own worktree PR integrations. Hiding link_pr alone left automatic recording, storage migration, heartbeat ingestion, and remote link commands active.

Why This Change Was Made

Use one live CLI-only condition for the entire backend mechanism: tool exposure and execution, automatic create/push evidence, stored-link operations, polling, migration and heartbeat enrichment, remote set_pr_link, and the explicit link/status/unlink commands. Disable the feature by backend client, not session platform, because Agent Manager and mobile-controlled sessions share the hosting backend.

User Impact

CLI backends retain session PR links, including remote/mobile control and hosted Cloud Agent backends using the default CLI client. VS Code, Agent Manager, JetBrains, ACP, and other non-CLI backends do not activate this mechanism, including when controlled from mobile. Their existing PR integrations and normal session sharing, ingestion, and remote commands remain unchanged. Existing PR-link records are preserved rather than deleted by disabled clients.

Evidence

Regression coverage verifies disabled clients with existing links and pending migration records, no PR polling or ingestion, unchanged ordinary heartbeats and part ingestion, and remote rejection before callbacks or extra heartbeats. All 329 tests across the 12 affected suites pass together, and package typecheck, lint, formatting, and annotation checks pass.

Isolated source backends confirm link_pr appears only for CLI, while CLI, VS Code, and JetBrains backends can still create sessions. The source CLI status command works and a non-CLI invocation returns an explicit unsupported error.

The session PR link that link_pr stores is only read by CLI and remote
sessions. VS Code, JetBrains, and other clients detect a worktree's PR
from its branch and never read the stored link, so the tool had no effect
there. Gate the tool to the cli client and cover the gating with tests.
@kilo-code-bot

kilo-code-bot Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review of commit eb7b4896bc (only change since the prior review at 154a8427c5). The sole changed file re-scopes the PR-link storage fixtures from AppRuntime to a locally compiled LayerNode group. LayerNode.compile returns a plain Layer blueprint, so each Effect.runPromise(... .pipe(Effect.provide(layer))) builds and releases fresh services with no shared state or resource leak; Storage.node's dependencies (FSUtil, Git → spawner) are satisfied by the group, and no production code changed. No new issues.

Files Reviewed (1 file)
  • packages/opencode/test/kilocode/sessions/pr-link-client.test.ts
Previous Review Summaries (2 snapshots, latest commit 154a842)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 154a842)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (15 files)
  • .changeset/vscode-drop-link-pr-tool.md
  • packages/opencode/src/cli/cmd/pr.ts
  • packages/opencode/src/kilo-sessions/kilo-sessions.ts
  • packages/opencode/src/kilo-sessions/pr-link-poller.ts
  • packages/opencode/src/kilo-sessions/pr-link.ts
  • packages/opencode/src/kilo-sessions/remote-sender.ts
  • packages/opencode/src/kilocode/tool/link-pr.ts
  • packages/opencode/src/kilocode/tool/registry.ts
  • packages/opencode/test/cli/pr-status.test.ts
  • packages/opencode/test/kilocode/kilo-sessions.test.ts
  • packages/opencode/test/kilocode/sessions/pr-link-client.test.ts
  • packages/opencode/test/kilocode/sessions/pr-link-evidence.test.ts
  • packages/opencode/test/kilocode/sessions/pr-link.test.ts
  • packages/opencode/test/kilocode/sessions/remote-sender.test.ts
  • packages/opencode/test/kilocode/tool/link-pr.test.ts

Previous review (commit 9076f03)

Status: No Issues Found | Recommendation: Merge

Gate of link_pr to the cli client verified against the actual consumers: the stored session link is advertised via the remote heartbeat (kilo-sessions.ts) and read by CLI (cli/cmd/pr.ts), while VS Code, JetBrains, desktop, run, and acp never read it (no link_pr/linkPr/prLink reads in packages/kilo-vscode/ or packages/kilo-jetbrains/). Flag.KILO_CLIENT defaults to "cli" when unset (packages/core/src/flag/flag.ts:153) and is only overridden by acp, the VS Code server manager, and JetBrains, so remote/cloud sessions retain the tool. Automatic PR detection (remote-sender.ts, pr-link.ts) is unaffected. Registry test expectations and the new gating test are consistent with the gate.

Files Reviewed (5 files)
  • .changeset/vscode-drop-link-pr-tool.md
  • packages/opencode/src/kilocode/tool/registry.ts
  • packages/opencode/test/kilocode/chart-tool-gating.test.ts
  • packages/opencode/test/kilocode/tool-registry-indexing.test.ts
  • packages/opencode/test/kilocode/tool/link-pr.test.ts

Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

@marius-kilocode marius-kilocode changed the title fix(opencode): offer the link_pr tool to CLI sessions only fix(cli): restrict session PR linking to CLI backends Sep 30, 2026
@marius-kilocode
marius-kilocode merged commit c98f874 into main Sep 30, 2026
33 checks passed
@marius-kilocode
marius-kilocode deleted the remove-link-pr-feature-vscode branch September 30, 2026 10:43
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.

2 participants