Skip to content

fix(workspace): count an IDE pin and this client's manifest as binding evidence - #1376

Merged
sahrizvi merged 2 commits into
mainfrom
fix/workspace-skill-sync-binding-evidence
Sep 27, 2026
Merged

sahrizvi merged 2 commits into
mainfrom
fix/workspace-skill-sync-binding-evidence

Conversation

@sahrizvi

@sahrizvi sahrizvi commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

No GitHub issue. Follow-up to #1374, from review comments that arrived after it merged.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

#1374 stays quiet when a binding lookup fails in a project that shows no sign of having a workspace. Without that check, being offline produced a warning in every opted-in repo, including repos never linked. The check missed two cases.

An IDE pin now counts. The extension can choose a workspace with ALTIMATE_PINNED_WORKSPACE_*. That choice is never written to disk. If the pinned workspace was inaccessible, or offline on its first check, the sync said nothing — including in the IDE's Refresh report. A pin for this folder now counts as evidence. A malformed pin counts too, because the extension set it and resolution fails closed on it everywhere.

Only this client's manifest counts. Previously any _workspace folder counted, including one the user or another tool created. Now only the manifest this client writes counts.

Interaction with #1373. #1373 landed while this was open. It removes the skill snapshot when a pin cannot be honoured. That removal deletes the manifest before the evidence check runs, so the pin has to count on its own. The user loses the skills and is told why. Both checks now use the same resolveWithinRoot to decide which folders a pin applies to, so they always agree. One test covers the two together.

How did you verify your code works?

  • 5 new tests:
    • a user-created _workspace folder does not count
    • a pin for this project does count
    • a malformed pin does count
    • an unhonourable pin both removes the skills and reports why
    • an unlinked project stays quiet
  • Mutation-checked: dropping the pin rule fails both pin tests, and going back to "any folder" fails the folder test.
  • Tested on top of fix(workspace): relink memory, consent before seeding, pin skills, clearer link and /workspace #1373. Workspace, skill, plugin and route suites: 1833 pass. One test fails, flushPendingSyncs … would abandon (a 5s timeout); it fails the same way on main.
  • Typecheck clean.

Screenshots / recordings

N/A. No UI change beyond when the existing warning appears.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

🤖 Generated with Claude Code


Summary by cubic

Fixes the workspace binding evidence check in skill sync so a failed lookup warns the user in two cases it previously missed.

  • An IDE pin (ALTIMATE_PINNED_WORKSPACE_*) now counts as evidence. Pins are never written to disk, so an inaccessible pin was silent before; a malformed pin counts too.
  • Only this client's manifest counts as evidence, so a _workspace folder the user or another tool created no longer triggers the warning.
  • Pin evidence is scoped with the same resolveWithinRoot as the pin purge from fix(workspace): relink memory, consent before seeding, pin skills, clearer link and /workspace #1373, so after the purge removes the manifest, the warning still fires and the user is told why.

Written for commit def6080. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved workspace checks when the server is unavailable: an unmanaged workspace folder no longer triggers an error, while a configured project workspace that cannot be verified is reported.
    • Corrected handling of invalid workspace pins, including removal of previously synced skills when a pin cannot be honored.

sahrizvi and others added 2 commits September 28, 2026 04:19
…g evidence

#1374 stays quiet when a binding lookup fails for a project with no sign of a
workspace. Two cases slipped through that check:

- An IDE pin (`ALTIMATE_PINNED_WORKSPACE_*`) is a workspace the user chose,
  but it is never written to disk. An inaccessible pinned workspace, or an
  offline first validation, was silent — including in the IDE's Refresh
  report. A pin for this tree now counts, and so does a malformed one:
  the extension set it, and resolution fails closed on it.
- Any `_workspace` folder counted, including one the user or another tool
  created. Only this client's manifest does now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1373 added its own `readPin` import and a pin purge on the same unknown
branch. Keep one import, and scope the pin evidence with the same
`resolveWithinRoot` as that purge, so the two agree on which folders a pin
speaks for. The purge removes the manifest before the evidence check; the pin
still counts, so a user loses the skills and is told why. Tested together.

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

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 177a1738-9bd2-474b-af30-6dd5eb4cd79d

📥 Commits

Reviewing files that changed from the base of the PR and between 960b936 and def6080.

📒 Files selected for processing (2)
  • packages/opencode/src/altimate/workspace/skill-sync.ts
  • packages/opencode/test/altimate/workspace/skill-sync.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Workspace binding evidence now includes IDE pins and a readable manifest. Tests cover offline binding lookups with unmanaged workspace folders and project-rooted or incomplete IDE pins.

Changes

Workspace binding evidence

Layer / File(s) Summary
Binding evidence and offline behavior
packages/opencode/src/altimate/workspace/skill-sync.ts, packages/opencode/test/altimate/workspace/skill-sync.test.ts
hasBindingEvidence checks invalid pins, project-covering pins, and readable manifests while retaining the local-binding check. Tests cover offline lookups, including an unmanaged _workspace folder, IDE pins, and removal of previously synced skills.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: anandgupta42

Merge Risk: ⚪ Minimal · up to def60

No merge-blocking issue was established for the workspace-binding evidence change. Merge after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to def60

A pin that cannot be confirmed is now reported, including after its skills are removed. One narrow case appears less visible: if a previously synced manifest becomes unreadable, an offline check may leave the skills in place without reporting that the workspace could not be confirmed.

Retained concerns

  • Low · security · inferred: A malformed manifest can suppress the failed-binding warning for a previously synced, server-bound project even though its on-disk skills remain available. The PR worsens visibility of that state, not the underlying access to the skills.
Security review details

Security Blast Radius

  • inferred — The identified change in warning visibility is scoped to a project's workspace skill snapshot. The reviewed change does not establish a new service entrypoint or broader credential authority.

Security Findings and Attack Paths

  • inferred — If a manifest is malformed while skills remain on disk, and the project has neither a relevant pin nor a local binding row, an offline binding lookup can now be quiet. Previously the existing directory caused a warning. Skill loading without a manifest check predates this PR; no end-to-end unauthorized-access path is established.

Trust Boundaries and Controls

  • observed — The evidence check treats an invalid IDE pin as relevant to every directory, while a valid pin must cover the project under resolveWithinRoot. This changes warning eligibility; it does not itself accept a workspace binding.

Resilience and Maintainability Implications

  • observed — An unknown lookup without an unhonourable pin retains the existing snapshot rather than treating network failure as an unbind. The changed evidence check determines whether that retained state is accompanied by a warning.

Hardening Proposals

  • proposed — Distinguish a missing client snapshot from an existing snapshot whose manifest cannot be read, and report the latter as an integrity or confirmation problem without treating an arbitrary directory as client-owned or deleting its contents.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: IDE pins and the client manifest now count as workspace binding evidence.
Description check ✅ Passed The description follows the required template, identifies the bug fix, explains the implementation and rationale, documents verification results, marks the checklist, and correctly states that screens…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

A rabbit checks the pin at dawn,
Then finds the manifest before moving on.
No workspace claim from an empty place,
Offline errors show their case.
Old skills hop away when pins say so.

Comment @coderabbitai help to get the list of available commands.

@kilo-code-bot

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

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/altimate/workspace/skill-sync.ts 790 A damaged or unreadable manifest makes an existing synced snapshot stop counting as binding evidence. If the cache has no row and the lookup fails, the existing skills remain discoverable but the user receives no warning. Previously the snapshot itself triggered the warning; retain evidence for an identifiable previously published snapshot without treating an arbitrary _workspace folder as owned.
Files Reviewed (2 files)
  • packages/opencode/src/altimate/workspace/skill-sync.ts - 1 issue
  • packages/opencode/test/altimate/workspace/skill-sync.test.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by gpt-sol-latest · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/opencode/src/altimate/workspace/skill-sync.ts">

<violation number="1" location="packages/opencode/src/altimate/workspace/skill-sync.ts:790">
P2: This counts any shallowly parseable `.manifest.json` as this client’s evidence, so a user or another tool can create a lookalike manifest and make an unlinked project emit offline warnings. Tighten manifest validation or ownership before using it for evidence.</violation>

<violation number="2" location="packages/opencode/src/altimate/workspace/skill-sync.ts:790">
P3: The new `readManifest` arm replaces the old `hasManagedSnapshot` lstat check, so a snapshot this client published whose manifest no longer validates (corrupt write, partial truncation) stops counting as evidence. Its skills still load from disk (discovery ignores the manifest) and `deactivate` refuses to remove an unreadable manifest, so the workspace keeps serving skills while the binding-lookup warning goes quiet. If narrowing to a fully valid manifest is deliberate, this tradeoff is worth a note; otherwise, damaged snapshots now lose their warning.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

if (pin.kind === "valid" && resolveWithinRoot(directory, pin.root) !== null) return true
// This client's manifest, not merely a `_workspace` folder: a tree the user
// or another tool created says nothing about a binding.
if ((await readManifest(directory).catch(() => null)) !== null) return true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This counts any shallowly parseable .manifest.json as this client’s evidence, so a user or another tool can create a lookalike manifest and make an unlinked project emit offline warnings. Tighten manifest validation or ownership before using it for evidence.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/opencode/src/altimate/workspace/skill-sync.ts, line 790:

<comment>This counts any shallowly parseable `.manifest.json` as this client’s evidence, so a user or another tool can create a lookalike manifest and make an unlinked project emit offline warnings. Tighten manifest validation or ownership before using it for evidence.</comment>

<file context>
@@ -772,11 +772,22 @@ async function hasManagedSnapshot(directory: string): Promise<boolean> {
+  if (pin.kind === "valid" && resolveWithinRoot(directory, pin.root) !== null) return true
+  // This client's manifest, not merely a `_workspace` folder: a tree the user
+  // or another tool created says nothing about a binding.
+  if ((await readManifest(directory).catch(() => null)) !== null) return true
   return (await readLocalBinding(directory).catch(() => null)) !== null
 }
</file context>

if (pin.kind === "valid" && resolveWithinRoot(directory, pin.root) !== null) return true
// This client's manifest, not merely a `_workspace` folder: a tree the user
// or another tool created says nothing about a binding.
if ((await readManifest(directory).catch(() => null)) !== null) return true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The new readManifest arm replaces the old hasManagedSnapshot lstat check, so a snapshot this client published whose manifest no longer validates (corrupt write, partial truncation) stops counting as evidence. Its skills still load from disk (discovery ignores the manifest) and deactivate refuses to remove an unreadable manifest, so the workspace keeps serving skills while the binding-lookup warning goes quiet. If narrowing to a fully valid manifest is deliberate, this tradeoff is worth a note; otherwise, damaged snapshots now lose their warning.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/opencode/src/altimate/workspace/skill-sync.ts, line 790:

<comment>The new `readManifest` arm replaces the old `hasManagedSnapshot` lstat check, so a snapshot this client published whose manifest no longer validates (corrupt write, partial truncation) stops counting as evidence. Its skills still load from disk (discovery ignores the manifest) and `deactivate` refuses to remove an unreadable manifest, so the workspace keeps serving skills while the binding-lookup warning goes quiet. If narrowing to a fully valid manifest is deliberate, this tradeoff is worth a note; otherwise, damaged snapshots now lose their warning.</comment>

<file context>
@@ -772,11 +772,22 @@ async function hasManagedSnapshot(directory: string): Promise<boolean> {
+  if (pin.kind === "valid" && resolveWithinRoot(directory, pin.root) !== null) return true
+  // This client's manifest, not merely a `_workspace` folder: a tree the user
+  // or another tool created says nothing about a binding.
+  if ((await readManifest(directory).catch(() => null)) !== null) return true
   return (await readLocalBinding(directory).catch(() => null)) !== null
 }
</file context>

@sahrizvi
sahrizvi merged commit a727489 into main Sep 27, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant