Skip to content

fix(cli): keep doctor snapshots consistent and read-only - #1015

Merged
777genius merged 4 commits into
mainfrom
fix/doctor-consistent-observation-f53
Nov 19, 2026
Merged

777genius merged 4 commits into
mainfrom
fix/doctor-consistent-observation-f53

Conversation

@777genius

@777genius 777genius commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Doctor could read state, journals and owned/native integrity at different moments during a concurrent operation. Taking the ordinary mutation lock made the snapshot coherent but created/chmodded paths and rewrote lock metadata, which broke the read-only contract.

Changes

  • Keep the complete local doctor observation within the existing mutation-lock interval; release it before optional Directory access and output.
  • Open an existing regular lock read-only on the same OS mutex, verify identity around the observation, and release/close idempotently. Do not create paths, chmod them or rewrite lock metadata.
  • When the lock is absent, verify continued absence after observation. Creation by a first writer invalidates the whole snapshot and requires a fresh read.
  • Preserve the five-second acquisition/retry budget and 25ms cancellable wait. Observation uses its parent context: a coherent longer read can finish, while an invalidated read cannot reacquire after the retry budget.
  • Require the explicit read-only capability, preserve cancellation/corruption/release errors, and leave writer semantics and public JSON intact.

The last update also makes the failing OpenCode collision E2E diagnosable. On the previous head, the macOS native run passed initial installation and version update but did not offer the expected MCP tool after same-version refresh. Existing output did not identify the reason.

The same native invocation now uses supported debug log flags. It retains the selected C config file, redacted native diagnostics and capped fixed method/stage/405 facts for non-POST MCP requests. These are test diagnostics only. All 17 original assertions, the 90-second timeout, cwd/environment, one native invocation and existing supervision are preserved. The 128 KiB limit applies to retained output after CombinedOutput; it is not a live process-output cap. A selected-file snapshot is not an effective native configuration observation.

Current head: d83fc3591ac4b7ba82699ab737eaf066b37d4a3f, tree 56c4c1b659fe1981bfd3d376e8494182486dca5b, parent df6e8b52b322f2e478066ce04461b67dd49be494. The diagnostic follow-up changes two E2E files, preserving all 8,119 other parent leaves.

Verification

  • The byte-identical final process-lock implementation passed 9 top-level / 12 total focused tests with zero failures/skips on pinned Go 1.26.11. Coverage includes existing bytes/modes, writer exclusion, absent-lock invalidation, cancellation, identity and idempotent release.
  • Root and independent reviews accepted the snapshot and acquisition-budget behavior. The original read-only production E2Es and complete tree assertions remain unchanged.
  • On parent df6e8b52, all three terminal jobs passed. The macOS run includes the CLI command suites and terminal selection/review/resilience harness. The prior local CLI compile was killed before tests began; it remains unqualified.
  • Root and independent source/privacy reviews accepted the OpenCode diagnostics. On the exact final tree, 2 top-level / 7 total inert controls passed with zero failures/skips, natural process-group closure and all 8,121 source leaves unchanged. These controls cover supported argv, redaction before truncation, escaped paths, fixed HTTP facts and safe selected-file snapshots.
  • The actual OpenCode failure in job 135508442931 remains open. The diagnostic change does not assert a fix or waive that failed native result.
  • Final-head lint, core, read-only production E2Es, terminal matrix and genuine native results remain required in checks.

Release Impact

No release, new state engine, feature flag, relaxed assertion, lint exemption, frozen VS Code change or added workflow.

Wait briefly for active mutations and collect local installation, journal and
integrity findings consistently. Release before Directory requests and output,
while preserving read-only state and existing recovery diagnostics.
@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.

@coderabbitai

coderabbitai Bot commented Nov 19, 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 39 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 f53f07b and d83fc35.

Files selected for processing: 7

  • cli/internal/agentpluginscli/read.go
  • cli/internal/agentpluginscli/read_snapshot.go
  • cli/internal/agentpluginscli/read_snapshot_test.go
  • install/integrationctl/agentplugins/adapters/processlock/read_only.go
  • install/integrationctl/agentplugins/adapters/processlock/read_only_test.go
  • repotests/agentplugins_opencode_collision_diagnostic_test.go
  • repotests/agentplugins_opencode_collision_native_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 changed the title fix(cli): keep doctor observations consistent during installation fix(cli): keep doctor snapshots consistent and read-only Nov 19, 2026
@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.96947% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.36%. Comparing base (f53f07b) to head (d83fc35).
⚠️ Report is 44 commits behind head on main.

Files with missing lines Patch % Lines
...ctl/agentplugins/adapters/processlock/read_only.go 74.00% 6 Missing and 7 partials ⚠️
cli/internal/agentpluginscli/read_snapshot.go 89.33% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1015      +/-   ##
==========================================
+ Coverage   63.29%   63.36%   +0.06%     
==========================================
  Files        2267     2274       +7     
  Lines      136179   136562     +383     
==========================================
+ Hits        86196    86534     +338     
- Misses      37568    37587      +19     
- Partials    12415    12441      +26     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@777genius
777genius merged commit 11f9863 into main Nov 19, 2026
92 of 99 checks passed
@777genius
777genius deleted the fix/doctor-consistent-observation-f53 branch November 19, 2026 13:36
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