Skip to content

refactor(vscode): share terminal directory blocking - #13644

Merged
marius-kilocode merged 2 commits into
mainfrom
dedupe-a-git-file-entries
Sep 1, 2026
Merged

refactor(vscode): share terminal directory blocking#13644
marius-kilocode merged 2 commits into
mainfrom
dedupe-a-git-file-entries

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The terminal and script-terminal managers duplicate the same reference-counted directory barrier used during worktree cleanup.

Why This Change Was Made

Share only that barrier through the existing PTY cleanup module. Keep each manager’s maps, directory normalization, SDK calls, and error handling separate. Remove only duplication exception 83aaa96c32fb3894.

User Impact

No behavior change is intended. Blocking starts synchronously, waits for the current creation snapshot, and releases each lease at most once. The complete PR removes 17 net lines across four files, including 5 net production lines. No test code is added.

Evidence

  • Duplication report: 35 → 34 pairs, 684 → 669 lines, 4688 → 4561 tokens. Only the target fingerprint disappeared.
  • 115 existing cleanup, terminal, routing, and architecture tests passed after removing the added tests.
  • Typecheck, lint, knip, build:check, duplication and annotation guards, formatting, and diff checks passed.
  • Visible isolated VS Code launch failed before UI verification: electronApplication.evaluate: Resulting promise was garbage collected. The isolated profile and harness were cleaned up.
  • Manual follow-up: in a disposable repository, create a blank Agent Manager worktree, open its terminal, then delete that worktree. Confirm its terminal closes and an unrelated local terminal stays usable.

No changeset is needed for this internal behavior-preserving refactor.

@kilo-code-bot

kilo-code-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • packages/kilo-vscode/src/agent-manager/ScriptTerminalManager.ts
  • packages/kilo-vscode/src/agent-manager/pty-cleanup.ts
  • packages/kilo-vscode/src/agent-manager/terminal-manager.ts
  • packages/kilo-vscode/tests/unit/pty-cleanup.test.ts
  • script/kilocode-duplication-allowlist.json
Previous Review Summary (commit fb0781d)

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

Previous review (commit fb0781d)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • packages/kilo-vscode/src/agent-manager/ScriptTerminalManager.ts
  • packages/kilo-vscode/src/agent-manager/pty-cleanup.ts
  • packages/kilo-vscode/src/agent-manager/terminal-manager.ts
  • packages/kilo-vscode/tests/unit/pty-cleanup.test.ts
  • script/kilocode-duplication-allowlist.json

Reviewed by grok-4.6 · Input: 122.1K · Output: 6.2K · Cached: 154.2K

Review guidance: REVIEW.md from base branch main

if (!count || count === 1) this.blocked.delete(target)
else this.blocked.set(target, count - 1)
}
return block(target, this.blocked, this.creates.get(target))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

a bit weird an async without any await in it, I think in this case it's TS dictating the async nature, maybe worth awaiting or removing the async declaration? I'd be good with it's OK as it is as answer though

@WebReflection WebReflection left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor comment but maybe it's already readable / clean enough as it is, I usually prefer not having async if there is no await in the body but technically peaking I think the JS engine might optimize that anyway: approved!

@marius-kilocode
marius-kilocode merged commit ff9d04b into main Sep 1, 2026
33 checks passed
@marius-kilocode
marius-kilocode deleted the dedupe-a-git-file-entries branch September 1, 2026 09:28
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