Skip to content

fix: a no-op repeat add is not a mutation; tidy OpenCode remove; Cursor scope hint - #972

Merged
777genius merged 5 commits into
mainfrom
fix/p3-leftovers
Nov 17, 2026
Merged

777genius merged 5 commits into
mainfrom
fix/p3-leftovers

Conversation

@777genius

Copy link
Copy Markdown
Owner

Follow-up to #959, three small leftovers found by running the installer against real clients on Linux and macOS.

A repeated add that changes nothing no longer counts as a mutation. For OpenCode (user and project), Gemini project and Cursor project, a repeat add or an update with no changes reported mutated: true, no no_change, and printed "installed and verified" instead of "Already installed. No changes made.". Two things caused it: the attempt marker that the same command writes was cleared through a normal state update (new updated_at, changed=true), and OpenCode and Cursor rewrote their own untouched config objects while completing the setup. Now the intact objects are only verified (one shared check, also used by Gemini), and a bare attempt marker is closed without a new updated_at when the adapter reports no committed native effect. A committed effect, a move to active, a real write or an MCP approval still records updated_at and mutated: true; attempts with a pending native intent keep the full path. Tests use a moving clock and cover both outcomes for add, refresh and grouped add and update; they fail without the change in each direction.

OpenCode remove no longer leaves an empty "mcp": {}. When removal empties the mcp collection (and servers for the V2 format) that the installer created, it is removed again, so the config returns to what it was before the first add. The installer's own collection is recognised by the exact layout it writes, so a user's own empty "mcp":{} written in that same layout is also removed; that is harmless, since an empty collection means the same as no key. A differently formatted one is kept.

Cursor user scope with only cursor-agent. The "target cursor was not detected" error now says that user scope installs for the Cursor editor and suggests --scope project for cursor-agent. Detection is unchanged.

Checked with real OpenCode 1.19.4 (user and project) and Gemini 0.65.0 (project): a repeat add gives mutated: false, no_change: true and an unchanged state file; after a repair that really restores a removed entry it reports mutated: true. Tests of the touched packages pass and lint (changed lines plus size gate) is clean.

Not covered: the OpenCode namespace collision check no longer runs on the intact repeat path, and Gemini and other formats keep an empty mcpServers after remove.

A repeated add or update re-runs prepared setup completion for Gemini
project, OpenCode and Cursor project installs. OpenCode and Cursor
rewrote their intact owned objects and reported a committed effect, and
closing the completion's own native attempt marker counted as a
lifecycle change that rewrote updated_at. The result was mutated=true
and no_change=null although nothing changed.

- Verify intact owned objects instead of rewriting them, through one
  shared check that Gemini already applied for project setups.
- Report a written Cursor MCP approval as a native effect, so a real
  approval still counts as a change.
- Close a bare attempt marker after an unchanged outcome without a new
  timestamp; the binding returns to its exact predecessor.
- Report such a completion as no change for single and group targets.

A completion that reaches Active or writes anything still reports a
mutation.
Adding the first OpenCode MCP server creates the "mcp" collection when
the config has none. Removing the last owned server left that object
behind, empty and in the writer's own layout, so remove did not restore
the config that preceded the add.

A removal now also drops the collection, and the V2 "servers" object
inside it, when it is empty and still has the exact layout the kernel
writes for a collection it creates. Any other layout, including a
user's own empty "mcp", is preserved. Other native config codecs are
unchanged.
Cursor user scope installs the package for the Cursor editor, so a host
with only cursor-agent fails with `target "cursor" was not detected`
while doctor reports the agent surface as detected. The error now says
that only cursor-agent was found and that `--scope project` installs
project skills and MCP servers for it. Detection is unchanged; the
agent surface id becomes one shared constant.
…arker

Closing a bare native attempt marker without a new updated_at and
without reporting a change is right only when the adapter wrote
nothing. A committed effect over an unchanged lifecycle and ownership,
such as a settled Claude project call or a written Cursor approval,
also took that path, so refresh and resume lost the mutation and
updated_at stayed stale. A committed effect now records both again;
the unchanged repeat stays silent.

The completion tests run with a moving clock, so a missing or an
unwanted updated_at rewrite is visible, and cover a committed effect
over the same lifecycle for single add, group add/update and refresh.
A user's own empty "mcp" written in exactly the writer's layout is
pruned too, which is harmless because an empty collection configures
no server. Removal restores the pre-add shape only for documents the
writer did not otherwise reformat.
@777genius
777genius marked this pull request as ready for review November 17, 2026 03:54
@strix-security

Copy link
Copy Markdown

Strix is installed on this repository, but we couldn't run this PR security review because this workspace's trial has ended. Add a card to resume code reviews here.

So far, Strix has reviewed 392 pull requests, surfaced 113 security issues (1 critical/high) and blocked 3 risky merges across this workspace.

@777genius
777genius merged commit 9f29efc into main Nov 17, 2026
56 of 62 checks passed
@coderabbitai

coderabbitai Bot commented Nov 17, 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 45 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 ac8784a and 16bf3e5.

Files selected for processing: 28

  • cli/internal/agentpluginscli/add_targets.go
  • cli/internal/agentpluginscli/preflight.go
  • cli/internal/agentpluginscli/undetected_target_hint_test.go
  • install/integrationctl/agentplugins/adapters/nativeconfig/document.go
  • install/integrationctl/agentplugins/adapters/nativeconfig/kernel.go
  • install/integrationctl/agentplugins/adapters/nativeconfig/opencode_prune_test.go
  • install/integrationctl/agentplugins/clients/cursor/detect.go
  • install/integrationctl/agentplugins/clients/cursor/prepared_setup.go
  • install/integrationctl/agentplugins/clients/cursor/project_lifecycle.go
  • install/integrationctl/agentplugins/clients/cursor/project_mcp_approval.go
  • install/integrationctl/agentplugins/clients/cursor/project_mcp_approval_test.go
  • install/integrationctl/agentplugins/clients/cursor/project_mcp_completion.go
  • install/integrationctl/agentplugins/clients/cursor/project_mcp_observation.go
  • install/integrationctl/agentplugins/clients/cursor/project_mcp_observation_test.go
  • install/integrationctl/agentplugins/clients/gemini/intact_projection.go
  • install/integrationctl/agentplugins/clients/opencode/activate.go
  • install/integrationctl/agentplugins/clients/opencode/intact_completion_test.go
  • install/integrationctl/agentplugins/clients/shared/native_lifecycle.go
  • install/integrationctl/agentplugins/domain/clients_runtime.go
  • install/integrationctl/agentplugins/installer/opencode_host_test.go
  • install/integrationctl/agentplugins/providers/opencode_native_test.go
  • install/integrationctl/agentplugins/usecase/apply_prepared_setup.go
  • install/integrationctl/agentplugins/usecase/existing_prepared_setup_test.go
  • install/integrationctl/agentplugins/usecase/group_activation_outcome.go
  • install/integrationctl/agentplugins/usecase/group_prepared_setup_test.go
  • install/integrationctl/agentplugins/usecase/host_preparation_test.go
  • install/integrationctl/agentplugins/usecase/lifecycle_observation.go
  • install/integrationctl/agentplugins/usecase/manual_remote_lifecycle_test.go
  • 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

@777genius
777genius deleted the fix/p3-leftovers branch November 17, 2026 03:54
777genius added a commit that referenced this pull request Nov 17, 2026
Preserve owner #972 no-op completion and native cleanup behavior while
moving the exact Cursor scope/surface predicate out of generic CLI code.
Add boundary cases without changing hint text, target eligibility,
public contracts, lint budgets, or native ownership checks.

The composed predecessor failed TestClientIDBudgetDoesNotGrow; the
corrected tree passes domain/architecture and CLI hint regressions.
Full lint, CLI recovery, vet, and generated checks pass. Local Core
retains only the preceding 28 top-level / 46 total failure baseline;
current-source hosted Core and native E2E remain required.
777genius added a commit that referenced this pull request Nov 17, 2026
Preserve the project-scope suggestion without client identity branching in generic CLI. Keep the hint private, observational and non-authoritative; add host-surface regression checks. Restore shrink-only archtest ratchet after #972.
777genius added a commit that referenced this pull request Nov 17, 2026
…ncy (#976)

Catalog object reads are bounded at 6 instead of 2; reads stay read-only and the canonical aggregate budget is unchanged. test-core is red on main since #972 (TestClientIDBudgetDoesNotGrow) and is unrelated to this change.
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