Repository navigation
fix(opencode): atomically install status plugin entrypoints - #24610
Conversation
313a75f to
a63e5eb
Compare
47096a5 to
65b5778
Compare
a63e5eb to
4713bae
Compare
b68ac71 to
08fbcfc
Compare
|
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
📒 Files selected for processing (13)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change adds shared atomic writers for canonical and overlay OpenCode plugins, with canonical writes resolving symlinks and overlay writes targeting the supplied path. TUI installation now selects behavior by ownership. Windows file-operation retries are shared, and legacy plugin writes can grant an ACL and retry after a Windows permission denial. Priority: ⬆️ High Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The plugin installation changes appear ready to merge after normal checks; no specific remaining failure is established. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Atomic replacement improves plugin reload safety. However, Windows recovery can grant broader permissions to a linked directory outside managed plugin storage, and those permissions can remain after installation fails. Exposure depends on local filesystem control and the application's existing permission-changing authority. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
|
Pullfrog stalled The agent stopped emitting events for 125s and was killed by the activity-timeout watchdog. The model produced no output at all before the stall — the request was sent but nothing came back. This is usually transient; re-running often succeeds. Recent agent stderr
|
|
Pullfrog stalled The agent stopped emitting events for 125s and was killed by the activity-timeout watchdog. The model produced no output at all before the stall — the request was sent but nothing came back. This is usually transient; re-running often succeeds.
|
Preserves all 11 reviewed PR source/test blobs exactly; main owns the workflow package-variable contract fix.
|
Updated to |
There was a problem hiding this comment.
Important
One Windows regression: the legacy shared-plugin refresh lost its Protected-DACL EPERM recovery. Details inline.
Reviewed changes — no prior Pullfrog review existed, so this run reviewed the full 11-file PR against main (1fc24d3114), head 0a6f9ad687:
- Extracted the Windows retry helpers into
src/shared/windows-retry-file-operations.tsand re-exported them fromcodex-accounts/fs-utils.ts. - Added
opencode-plugin-atomic-write.tswithresolveCanonicalPluginWritePath(follows dotfile symlinks, including danglingreadlinkSyncchains) plus temp-file + rename writers that preserve the target's mode via an explicitchmodSync. - Routed OpenCode installs through the atomic writers in
hook-service.ts, relayplugin-overlay.ts, andopencode-canonical-config.ts;writeOpenCodeTuiPlugingained anownershipflag so overlay entries detach mirrored links. - Added focused tests for atomic temp writes, canonical/overlay symlink behavior, dangling chains, loops, rename-failure cleanup, and umask-restricted permission retention.
- Merged current main (
0a6f9ad687); the merge does not touch the PR's 11 source/test blobs.
The atomic-write, symlink-resolution, and permission-preservation logic is otherwise correct and the new tests exercise real failure modes.
ℹ️ Nitpicks
- The manual
visited/40-depth loop guard inresolveCanonicalPluginWritePath(src/shared/opencode-plugin-atomic-write.ts:45-66) is unreachable: a real cycle makesrealpathSync.nativethrowELOOP(re-thrown at line 40), and a dangling chain cannot form a cycle. The'throws on symlink loop'test (src/shared/opencode-plugin-atomic-write.test.ts:261) therefore passes via Node's nativeELOOP, not the guard it appears to cover. - Every symlink case is
skipIf(process.platform === 'win32'), sorealpathSync.native/readlinkSynchandling of Windows junctions and symlinks is unverified despite being a supported target.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Keep the shared canonical writer and restore one main-side Windows permission retry for legacy userData server and TUI repairs. Credit pullfrog for identifying the lost backstop in the PR 24610 review.
Keep reviewed atomic plugin replacement and Windows permission recovery unchanged while retaining current process scheduling and redraw fixes. Credit pullfrog for the permission-recovery finding.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — re-reviewed the two commits pushed since Pullfrog's prior review (0a6f9ad6), which restore the Windows ACL backstop flagged there:
- Restored per-write ACL recovery for legacy
userDataplugin writes via the new main-sidewriteLegacyOpenCodePluginWithAclRetrywrapper: on win32 +isPermissionErrorit grants the canonical destination directory (or the nearest existing ancestor after a deniedmkdir) and retries the writer once, rethrowing the original error if the grant or retry fails. - Routed both legacy writes through it — the TUI copy write and the canonical server write in
hook-service.ts— whilewriteCanonicalOpenCodePluginAtomicallystays the only bytes writer. - Added
hook-service-legacy-acl.test.tscovering EPERM/EACCES retry ordering, deniedmkdir, TUI-before-server recovery, non-win32 and unrelated-errno passthrough, grant/retry failure preserving the original error with temp cleanup, canonical symlink target repair, and the current/absent-install no-op path.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

ELI5
OpenCode could read Orca's status plugin while it was being rewritten. Install complete files with an atomic rename so a reload sees either the old or new plugin.
What Changed
Canonical server and TUI plugin files now use a sibling temporary file and rename, preserving user symlinks and target permissions. An explicit chmod before rename retains existing permissions even when the process umask is stricter. Temporary overlay entries use atomic replacement that detaches mirrored user links without modifying their targets. Native and relay installation use the same bounded Windows retry operations; Codex keeps its existing retry behavior through a mechanical extraction. Legacy userData server/TUI writes also retain the main-side Windows permission repair: grant the canonical directory (or its existing parent after denied creation), then retry once through the same atomic writer.
Why
Removing the existing file or writing directly into it exposes missing or incomplete source. Atomic rename retains the old working file if replacement fails and cleans up the temporary file. This ports Ahmed Nagy's #24131 with canonical relay symlink preservation and TUI installation coverage.
Linked Issue
Fixes #24121
Visual Proof
N/A — filesystem installation has no visual UI change. Private raw PTY captures show real OpenCode 2.0.16 reloading during concurrent rewrites. A concurrent reader observed 4,524 incomplete reads with direct writes and zero with atomic writes; neither run caught an OpenCode loader exception, so the evidence establishes file integrity rather than a reproduced loader outage.
Testing
macOS: real installed OpenCode 2.0.16 standalone reload stress with isolated config/data/state and a private model endpoint. Seven focused suites passed (107 tests), plus an isolated child-process umask regression (10/10 atomic and permission tests), covering canonical and overlay symlinks, permissions, failed replacement cleanup, TUI no-op timestamps, installers, existing Codex retries and session binder.
pnpm tc:node, changed-code quality and all relay bundle builds passed. Windows/Linux execution and live SSH need CI or host testing; shared helpers preserve platform checks and avoid an in-place Windows fallback.Review
Credits: original atomic implementation and tests by Ahmed Nagy (@AhmedNAgy25), preserved as commit author. The missing-store fix is merged; this PR targets main. The Windows permission recovery review finding is credited to @pullfrog. #24124 contains unrelated SSH retry work and should remain open for independent review.
Agent skill upstream boundary
Checklist
Current review correction
Head
a92d0dabd08f7917a337e5cef56b911f017bb58dretains the reviewed correction9acea30efbe0cd3a8554d1328fe8b7327b9a78d5against named main84a4e8a9b0a1a0bd938528aa2dc6e49636917a47. All13 atomic/permission-repair paths match reviewed source, and every unrelated main entry and mode is unchanged. The generated plugin order, canonical writer, symlink behavior and SSH retry layering are preserved.144 focused tests across9 files, Node typecheck and the13-file changed-code gate pass on the prepared head, including32 mocked Windows ACL cases. Installed OpenCode2.0.16 privately loaded both repaired legacy variants and canonical plugins on macOS; this proves real plugin loading with controlled local credentials, and does not claim physical Windows execution. Fresh full-head CI runs after this update.