Skip to content

chore(server): trim fork Git readers, OpenCode copy inference, and stale docs - #303

Merged
pandec merged 3 commits into
devfrom
chore/audit2-server-core-trims
Nov 25, 2026
Merged

pandec merged 3 commits into
devfrom
chore/audit2-server-core-trims

Conversation

@pandec

@pandec pandec commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Several fork-only server pieces duplicated upstream logic or described behavior that has changed. This trims them and fixes git-annex worktree detection (audit A7).

  • T2: The README bullet now states the real fork difference: every watch_pull_request watch keeps the thread working until the PR merges or closes, or the agent unwatches it. PullRequestWatchReactor.ts matches upstream again.
  • T3: Removed the dead isSameDirectory helper and its two tests.
  • T17 / A7: Removed the hand-written .git parsers (readGitCommonDir, readCheckedOutBranch). Worktree switch and Claude workspace follow now ask Git for the top level, common directory and branch through GitVcsDriver.execute. Archive worktree removal uses upstream's isLinkedWorktree. Linked git-annex worktrees are now accepted. Validation stays fresh, and subdirectories and other clones are still rejected. A detached checkout still reports no branch. Upstream detectRepository is only on the registry-level VcsDriver, so execute avoids new wiring.
  • T18 skipped: The two canonicalization helpers in workspaceLease.ts handle errors differently. The fork's walks up on any realPath error; upstream's only on NotFound. Sharing one would change one caller's fallback.
  • T23: The OpenCode driver keys session_message rows by lineage (opencode:<origin session>:<seq>). A fork whose parent is gone still resolves to that parent. This removes the shared token/timestamp hash inference in UsageService and the supersededKeys plumbing. A row already counted under its message ID from the message table still counts once. Accepted risks: older cached OpenCode rows keyed by message ID double count until retention, and so do copies whose parent and grandparent are both deleted.
  • T7: Removed the unused _flavor parameter of resolveDesktopBuildIconAssets and its flavor-only assertion.
  • Docs: docs/user/usage.md now says OpenCode and Antigravity also read each configured account's environment.

Checks: vp check, vp run typecheck, focused tests in apps/server (worktree switch, follow, archive removal, UsageService), provider-opencode usage, and scripts build-desktop-artifact. Reviewed by Astra and Opus; findings fixed.

Done by Claude Opus 5.5 in Claude Code (T3 Code).

…ale docs

- README: PR watch bullet states the real fork difference (hold until merge/close/unwatch)
- PullRequestWatchReactor: drop the redundant fork summary
- git/Utils: remove dead isSameDirectory and the hand-written Git readers
- worktreeSwitch: detect top level and common dir through GitVcsDriver; accept git-annex worktrees
- ArchiveWorktreeRemoval: use the shared linked-worktree predicate
- OpenCode usage: key session messages by lineage; drop shared copy inference and supersededKeys
- build-desktop-artifact: drop the unused _flavor parameter
- docs/user/usage.md: OpenCode and Antigravity also read account environments
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f266bf2 and d5ff8e0.

Files selected for processing: 18

  • README.md
  • apps/server/src/git/Utils.test.ts
  • apps/server/src/git/Utils.ts
  • apps/server/src/orchestration-v2/ArchiveWorktreeRemoval.test.ts
  • apps/server/src/orchestration-v2/ArchiveWorktreeRemoval.ts
  • apps/server/src/orchestration-v2/PullRequestWatchReactor.ts
  • apps/server/src/orchestration-v2/SessionWorkspaceFollow.test.ts
  • apps/server/src/orchestration-v2/SessionWorkspaceFollow.ts
  • apps/server/src/orchestration-v2/ThreadWorktreeSwitchScheduler.ts
  • apps/server/src/orchestration-v2/worktreeSwitch.ts
  • apps/server/src/usage/UsageService.test.ts
  • apps/server/src/usage/UsageService.ts
  • docs/user/usage.md
  • packages/provider-core/src/server/usage.ts
  • packages/provider-opencode/src/server/usage.test.ts
  • packages/provider-opencode/src/server/usage.ts
  • scripts/build-desktop-artifact.test.ts
  • scripts/build-desktop-artifact.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@pandec
pandec merged commit 62ec883 into dev Nov 25, 2026
3 checks passed
@pandec
pandec deleted the chore/audit2-server-core-trims branch November 25, 2026 08:56
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.

1 participant