Skip to content

fix: pr-bug-scan validated finding from #6136 - #6227

Merged
AmethystLiang merged 3 commits into
mainfrom
bot/pr-bug-scan-6136-1782271607
Jun 24, 2026
Merged

AmethystLiang merged 3 commits into
mainfrom
bot/pr-bug-scan-6136-1782271607

Conversation

@buf0-bot

@buf0-bot buf0-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Automated fix-PR from pr-bug-scan for parent #6136.

Fixer status: FIXED_WITH_CODE_PROOF
Summary: removeProject now also drops lastVisitedAtByWorktreeId entries by repo-id mapping when the repo id is fully removed (no sibling host), catching unhydrated worktree timestamps.
Blocked proof link: repos.ts:2332-2339 prune loop only deleted entries in worktreeIdSet (empty for unhydrated repos); it now also deletes entries whose getRepoIdFromWorktreeId(id)===projectId when repoIdFullyRemoved, so worktrees.ts:3394-3397 can no longer defer them forever.
Typecheck: skipped

Proof (from validator)

  • C1 — proof_type: code_analysis
    • trigger: removeProject(projectId) for an SSH/remote repo that is disconnected at removal time (worktreesByRepo[projectId] and detectedWorktreesByRepo[projectId] empty/absent) but which has persisted lastVisitedAtByWorktreeId entries from a prior connected session.
    • observable: lastVisitedAtByWorktreeId retains entries for the removed repo's worktrees indefinitely; they are never dropped by removeProject and are permanently deferred by pruneLastVisitedTimestamps, so they persist in saved session state for the rest of the session and across reloads.
    • path:
      • repos.ts:2225-2228 removeProject routes SSH repo through window.api.repos.remove (target.kind === 'local'), so removal succeeds even while disconnected
      • repos.ts:2239 worktreeIds = getKnownRepoWorktreeIds(get(), projectId, ownerHostId)
      • repos.ts:200-208 getKnownRepoWorktreeIds reads only worktreesByRepo[projectId] and detectedWorktreesByRepo[projectId]; both empty for an unhydrated repo, so it returns []
      • repos.ts:2316 worktreeIdSet = new Set(worktreeIds) is empty
      • repos.ts:2332-2339 the prune loop deletes a lastVisitedAtByWorktreeId entry only if worktreeIdSet.has(id); with an empty set, nothing is deleted
      • repos.ts:2340 repo is removed from s.repos

Generated by pr-bug-scan (proof-machine architecture). Human approval required before merge.

orca-bug-scan-bot and others added 3 commits June 23, 2026 20:32
removeProject now also drops lastVisitedAtByWorktreeId entries by repo-id mapping when the repo id is fully removed (no sibling host), catching unhydrated worktree timestamps.
Verify that removing an unhydrated runtime repository successfully drops
its associated worktree entries from the persisted visit history.
@AmethystLiang
AmethystLiang merged commit d993336 into main Jun 24, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix: address pr-bug-scan validated finding from stablyai#6136

removeProject now also drops lastVisitedAtByWorktreeId entries by repo-id mapping when the repo id is fully removed (no sibling host), catching unhydrated worktree timestamps.

* test: cover unhydrated SSH timestamp cleanup

* Test dropping visit timestamps for removed runtime repos

Verify that removing an unhydrated runtime repository successfully drops
its associated worktree entries from the persisted visit history.

---------

Co-authored-by: orca-bug-scan-bot <[email protected]>
Co-authored-by: Jinjing <[email protected]>
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