Repository navigation
Conversation
There was a problem hiding this comment.
Approve with nits (2 P2, 2 P3)
Scope: base main, merge base 53f7d21a, 1 commit, 23 files reviewed (local-daemon only). Helper skills loaded: coderbook, ponytail-review, karpathy-guidelines. The review ran in a separate session.
Findings
P2
1. Every Operation start now rewrites directory DACLs on Windows, and the PR body does not state the added cost on the user message → provider_ready path
internal/workspace/context_capabilities.go:24, internal/workspace/runtime_home.go:118,122, internal/workspace/operation_temp.go:34
ConfigureClaudeContextHome(called fromprovider/executor.go:455at Operation start),claimRuntimeHomeandPrepareOperationTempnow callprivatefs.EnsureDiron long-lived directories on every call.- On Windows,
EnsureDiralways walks and pins every ancestor (pinParents). It then callsSetSecurityInfowith anOICIDACL (privatefs_windows.go:504), even when the directory is already private.SetSecurityInfopropagates inheritable ACEs to existing children. For<home>/.claude, those children include everything the Claude CLI stores there: projects, transcripts and snapshots. - So each Claude Operation start re-walks a tree that keeps growing. The fast path in
adoptClaudeCredentialadds two moreProtectFileancestor walks. - These paths live under
StateDirectory, whichmain.go:130already protects with an owner-only DACL. Their children inherit it, andvalidateDescriptor(privatefs_windows.go:195) accepts inherited ACEs. On Windows, the rewrite adds cost there but no protection. - AGENTS.md requires PRs on this path to state any added file walk. The body does not.
- I could not measure the size of the cost: there is no Windows host here.
- Fix: in Windows
EnsureDir, return early whenvalidateHandle(file, "directory", true)already passes.ProtectFilealready does this atprivatefs_windows.go:544. Then state the remaining per-Operation work in the PR body.
2. The probe temp-root allocation is duplicated
internal/workspace/claude_credentials.go:186-205 and internal/workspace/codex_probe.go:27-46
- These two blocks are near-identical. Each picks
PrepareOperationTemp(baseDir)oros.MkdirTemp+privatefs.EnsureDir, and builds aremoveRoot. Any future change to where probes live, or how they are cleaned up, has to be made twice. - Fix: extract one helper, e.g.
probeTempRoot(baseDir, prefix string) (root string, remove func(), err error), and call it from both.
P3
3. Optional parameters are modeled as variadics, and the Claude probe bypasses the policy table
internal/provider/protocol_probe.go:234-244, 380-393; internal/workspace/claude_credentials.go:181; internal/workspace/codex_probe.go:19
baseDir ...stringandoptions ...probeOptionsare variadics, yet every non-test caller passes exactly one value.probeRuntimeAuthenticationnow hard-codesruntimeType == "claude"and callsprobeClaudeAuthenticationIn. TheauthenticationProbeentry indetection_policy.go:31now only serves the!= nilchecks.- Fix: make these plain parameters. Pass
tempBasethrough the probe function signature (or the policy), not through a Claude-only branch.
4. A test comment carries an issue number and history
internal/workspace/claude_credentials_windows_test.go:27
- The comment says "... before the WHI-897 fix". AGENTS.md forbids issue numbers and history in comments.
- Fix: describe only the ACL state being simulated.
Verified as fine
ProtectFilesafety (Unix): it opens the file withO_NOFOLLOW, then checks the owner, that it is a regular file, andNlink == 1on the open handle. Only then does it callfchmod(privatefs_unix.go:83-107). Symlinks, hard links, directories and foreign-owned files are refused.ProtectFilesafety (Windows): it opens throughopenHandlewithFILE_FLAG_OPEN_REPARSE_POINT, so ancestors are pinned. It rejects reparse points, directories and multi-link files beforeSetSecurityInfo(privatefs_windows.go:538-580).ProtectDirectorybehavior is unchanged: it still ignoresErrNotExist, which the old privateprotectFileswallowed internally (privatefs_windows.go:528).writePrivateRuntimeFilewrites atomically:privatefs.WriteFile(..., false)writes an owner-only temp file, syncs it and renames it into place (privatefs.go:35-75). The priorProtectFilestep is needed becauseWriteFilerefuses a loose existing target (privatefs.go:44-47).clicredential.writeAtomickeeps the same semantics: temp, sync, rename, then directory sync. The parent directory was already created byprivatefs.EnsureDir(store.go:276).- Probe temp dirs are cleaned up: they now go under
operation-tmp, whichPruneOperationTempssweeps at startup (main.go:147). Each dir is lock-held while in use and removed onClose(operation_temp.go:80-90).releaseis wrapped insync.Once, so repeated release calls are safe. TempBasereaches every probe and invoke path: discovery (main.go:178), model invoke (main.go:465) and the auth refresh inruntime_monitor.go:340-352. CLI-side discovery (computerconfig/runtime_discovery.go:68) passes noTempBaseand falls back to%TEMP%, whichEnsureDirhardens.- The fast-path repair does not retire a resident Claude process: it is covered by
TestClaudeCredentialsRepairLegacyLoosePermissionsOnUnchangedFastPath, and on Windows byTestClaudeCredentialsRepairLegacyInheritedWindowsACLOnUnchangedFastPath. - No CJK in added lines or in the commit message. No contracts, env vars or cross-app imports touched.
Process notes
- The branch is 10 commits behind
main.mainrequires up-to-date branches, so it needs a rebase. - The commit author is
yunhe <>with an empty email, so the commit is not linked to a GitHub account. - One commit, no merge commits, no fixup commits.
CI
- All checks pass, including
check (computer-go)andcheck (computer-go-windows). The other checks were skipped by path filters. check (computer-go)runs the daemon's Go unit tests without-race.- I ran focused tests locally on Linux, without
-race:go test -count=1 -p 4 ./internal/platform/privatefs ./internal/linger/clicredential ./internal/workspace -run 'ProtectFile|PrivateFile|PrivateModes|Claude|CodexProbe|WritePrivateRuntime|OperationTemp|RuntimeHome'. All three packages passed. - Not verified: the real cost of Windows DACL propagation (finding 1). The PR body also lists Windows 11 QA as pending.
Automated review by Claude Code
Automated review of adcba2a by Claude Code.
bf4c62b to
777658b
Compare
There was a problem hiding this comment.
Approve with nits (1 P2, 1 P3)
Scope: follow-up on adcba2a, reviewing head 777658b. Base main, merge base 4ef3f8f7, 1 commit, 41 files. Helper skills: coderbook, ponytail-review, and karpathy-guidelines were not loaded in this headless run; the review applied their criteria from the review brief. Ran in a separate session. The PR was rebased after the previous review, so I reviewed the full merge-base diff, not an incremental one.
Previous findings
- P2 – EnsureDir rewrote the DACL on every Operation: Resolved.
privatefs_windows.go:480now returns early whenvalidateHandle(file, "directory", true)passes, and the PR body describes the steady-state overhead. - P2 – Duplicated Claude/Codex probe temp-root code: Resolved. Both probes now call
probeTempRoot(internal/workspace/operation_temp.go:96) fromclaude_credentials.go:190andcodex_probe.go:24. - P3 – Variadic param and Claude special case bypassing the policy table: Resolved.
probeRuntimeandprobeRuntimeAuthenticationnow take aprobeOptionsstruct. The Codex shortcut is gone, andtempBasereaches every probe throughruntimeDetectionPolicy.authenticationProbe(detection_policy.go:15). The remainingruntimeType != "claude"check atprotocol_probe.go:374was already in the base branch. - P3 – Issue number and history in a test comment: Resolved. The comment in
claude_credentials_windows_test.gonow only describes the simulated ACL state, and the diff adds noWHI-references.
Findings
P2
internal/provider/native/claude_mcp_config.go:26,internal/provider/native/antigravity_hook.go:131,internal/daemon/playground_tools.go:214: the PR addsprobeTempRoot(internal/workspace/operation_temp.go:96) to share the "ifbaseDiris set, usePrepareOperationTemp; otherwise useos.MkdirTempplusprivatefs.EnsureDir" branch. It then writes the same branch three more times, each with slightly different cleanup. If the rule changes later (for example, another Windows ancestor check, or the sealed-subtree unlock), it has to be updated in four places. Fix: export the helper (for exampleworkspace.PrivateTempRoot(baseDir, prefix) (string, func(), error)) and use it at all four sites.- In
claudeWriteMCPConfig, the extraos.MkdirTemp(parent, ...)inside an already-freshOperationTempadds nothing; the config file can go straight into the temp root. - With one cleanup func, the
closeOpTemp != nilbranches in the error paths go away.
- In
P3
cmd/linger-computer-daemon/main.go:152:maincallsnative.ConfigureAntigravityHookTempBase(operationTempBase)and defersCloseAntigravitySharedHookEndpoint().Daemon.Run(internal/daemon/daemon.go:318-326) configures the same<StateDirectory>/operation-tmpagain, then closes the endpoint and resets the base on exit.mainpassesStateDirectorytodaemon.Options(main.go:457), so themain.gopair is redundant. Keep the lifecycle inDaemon.Runonly.
Verified as fine
privatefs.WriteFile(path, data, false)is still an atomic temp-file write, sync, and rename (internal/platform/privatefs/privatefs.go:49-75). The switch inwritePrivateRuntimeFileandclicredential.writeAtomickeeps crash atomicity and adds the owner-only check on any existing target.ProtectFileruns beforeWriteFilebecauseWriteFilerefuses an existing loose file throughCheckPath(path, "file", true)(privatefs.go:45). This ordering is what lets legacy loose credentials repair themselves.- The Unix
ProtectFile(privatefs_unix.go:83) opens withO_NOFOLLOWand checks owner UID, regular-file type, andNlink == 1on the fd beforefchmod. - The Windows
ProtectFilechecks reparse point, directory, and link count on the handle beforeSetSecurityInfo(privatefs_windows.go:550-559). - Every caller of the now-exported
ProtectFiletoleratesErrNotExist:ProtectDirectory(privatefs_windows.go:531),writePrivateRuntimeFile(context_capabilities.go:66),protectClaudeCredentialFiles(claude_credentials.go:137), andclicredential/store.go:315. - Windows
EnsureDirfast path:validateDescriptorwithownerOnly=truerejects every effective allow ACE for any SID other than the user, SYSTEM, or Administrators (privatefs_windows.go:220-237). A directory that inheritedCodexSandboxUsers:(OI)(CI)(M)therefore still fails validation and gets rewritten. - The sealed Antigravity hook subtree can still be removed.
Closeunlocks it beforecloseTemp(antigravity_hook.go:233-237). After a crash,RemoveTaskTempDirretries throughmakeOwnerWritableon Unix (task_temp.go:81-90), and on Windows sealing is a no-op (antigravity_hook.go:194). - Production passes
TempBaseandStateDirectoryeverywhere (main.go:192,457,467,481), so the OS-temp fallbacks are only reached in tests. - The new
releaseOnceguards make probe release idempotent:claude_credentials.go:192andcodex_probe.go:28. - No CJK characters in added lines or in the commit message.
Process notes
- The branch is 5 commits behind
main.mainrequires up-to-date branches, so it needs a rebase. - The commit author is
yunhe <>with an empty email, so the commit is not linked to a GitHub account. - No merge commits and no fixup commits.
CI
All checks that ran passed: check (computer-go), check (computer-go-windows), check (desktop), check (web), repository-gate, and CodeQL. The rest were skipped as not affected. I also ran focused tests locally on linux/amd64 with -count=1, and all passed:
internal/platform/privatefs,internal/linger/clicredential,internal/workspace: filtered with-run 'Protect|EnsureDir|Claude|Codex|Probe|OperationTemp|TaskTemp|Store|Write'internal/provider/native,internal/daemon: filtered with-run 'Antigravity|MCP|TempBase|AgentCLI|Playground'
The Windows-only tests (*_windows_test.go) are covered only by check (computer-go-windows). The PR body still lists verification on a real Windows 11 host as pending.
Automated review by Claude Code
Automated review of 777658b by Claude Code.
777658b to
8b509df
Compare
There was a problem hiding this comment.
Approve with nits (2 P3)
Scope: follow-up on 777658b. Base main, merge-base 4ef3f8f7, 1 commit, 41 files reviewed in full against the merge base. The 6 files changed since the previous review got a closer look. Ran in a separate session. Helper skills coderbook, ponytail-review and karpathy-guidelines were not loaded in this run; the review follows the linger-pr-review checklist directly.
Previous findings
- P2: private temp-dir allocation copied four times. Resolved.
probeTempRootis now the exportedworkspace.PrivateTempRoot(internal/workspace/operation_temp.go:98). Claude and Codex probes,prepareAgentCLIConfig(internal/daemon/playground_tools.go:214),newAntigravityHookEndpoint(internal/provider/native/antigravity_hook.go:129) andclaudeWriteMCPConfigall call it. - P3: hook temp base configured and closed in two places. Not resolved.
cmd/linger-computer-daemon/main.go:152-153still callsConfigureAntigravityHookTempBaseand defersCloseAntigravitySharedHookEndpoint.Daemon.Rundoes the same atinternal/daemon/daemon.go:318-326.
Findings
P3
apps/computer/local-daemon/internal/provider/native/claude_mcp_config.go:29:claudeWriteMCPConfigdecides whether to create alinger-mcp-*subdirectory by checking whetherfilepath.Base(root)already has that prefix. That check is really asking which branchPrivateTempRoottook (theos.MkdirTempfallback orPrepareOperationTemp). It works today, but it couples this file to the directory names another package chooses. If either prefix changes, the layoutclaudeRemoveMCPConfigexpects changes silently. Simpler: alwaysMkdirTemp(root, claudeMCPDirPrefix)(a nested dir in the fallback case is harmless), or havePrivateTempRootreturn the final directory.apps/computer/local-daemon/internal/provider/native/antigravity_hook.go:222:Closenow callsremoveRoot(), which returns nothing. If the hook directory can't be removed,Closereturns nil. The oldcloseTemperror was passed intoerrors.Join, and the no-root branch still joinsos.RemoveAll's error. On Windows a sealed hook subtree that fails to delete now goes unreported. Have thePrivateTempRootcleanup returnerror, or log it.
Verified as fine
privatefs.WriteFile(path, data, false)is still atomic: it writes a temp file, syncs it, then renames (internal/platform/privatefs/privatefs.go:49-75). Replacing the hand-writtenCreateTemp/RenameinwritePrivateRuntimeFileandclicredential.writeAtomickeeps the old crash semantics.- Unix
ProtectFile(privatefs_unix.go:82-107) opens withO_NOFOLLOW, then checks owner, regular file andNlink == 1beforeChmod. A symlinked or hard-linked credential is refused, not followed. - Windows
ProtectFileand the newEnsureDirfast path rely onvalidateHandle(privatefs_windows.go:144-162), which rejects reparse points, the wrong type and multi-link files before it trusts the DACL. The fast path returns only after the full owner-only check passes. ProtectDirectorystill tolerates files that vanish:ErrNotExisthandling moved fromprotectFileto the caller (privatefs_windows.go:531).- Every production caller passes a real temp base: discovery/runtime_monitor through
options.TempBase, protocol probe throughoptions.tempBase, Claude runtime throughprofile.TempBase, and live card throughd.operationTempBase().main.go:192,467,481setsTempBase: operationTempBase. The%TEMP%fallback is only reached when the base is empty. - The fallback cleanup
RemoveTaskTempDir(internal/workspace/task_temp.go:61-102) works on a directory without a lock marker, and thesync.Oncewrappers make every cleanup idempotent. adoptClaudeCredentialrepairs loose ACLs on unchanged-content paths without retiring the resident process (internal/workspace/claude_credentials.go:97-129).- No CJK in added lines or the commit message.
Process notes
origin/mainis 9 commits ahead of the merge base and merge state is BLOCKED, so a rebase is likely needed before merge.- Single commit, no merge or fixup commits.
CI
All checks pass, including check (computer-go), check (computer-go-windows), check (desktop), repository-gate and CodeQL. I ran no tests locally: the changes since the previous review are temp-dir plumbing with no new concurrency, and the Windows job covers the new Windows tests. CI runs Go tests without -race. The PR's own manual Windows 11 and Linux host checks are still listed as pending in its description.
Automated review by Claude Code
Automated review of 8b509df by Claude Code.
8b509df to
9c5dad9
Compare
There was a problem hiding this comment.
Approve with nits (2 P3)
Scope: follow-up on 8b509df. Base main, merge-base 4ef3f8f7; 1 commit, 42 files in the PR (3 changed since the previous review: clicredential/store.go, store_test.go, store_windows_test.go). Helper skills loaded: coderbook, ponytail-review, karpathy-guidelines. Ran in a separate session.
Previous findings
- Not resolved: P3 MCP config dir layout keyed on the basename prefix (
apps/computer/local-daemon/internal/provider/native/claude_mcp_config.go:29). Unchanged. - Not resolved: P3
AntigravityHookEndpoint.Closedrops the temp-root removal error (apps/computer/local-daemon/internal/provider/native/antigravity_hook.go:222).removeRootstill returns nothing, so a failed removal still yieldsnil.
Findings
P3
apps/computer/local-daemon/internal/provider/native/claude_mcp_config.go:29: carried over from the previous review. Whether a subdirectory gets created depends on whetherPrivateTempRootreturned a directory named withclaudeMCPDirPrefix. That ties this code to howPrivateTempRootnames its directories. Fix: always create theclaude-mcp-subdirectory, or havePrivateTempRootreturn the final directory.apps/computer/local-daemon/internal/provider/native/antigravity_hook.go:222: carried over. WhenremoveRootfails,Closereturnsnil. The oldos.RemoveAllpath joined that error into the result. Fix: make the cleanup returnerroranderrors.Joinit inClose.
Verified as fine
- New since
8b509df:Store.LookupandStore.Currentnow runprivatefs.EnsureDiron the agent directory andprivatefs.ProtectFileon the credential, state and profile files (internal/linger/clicredential/store.go:155-183,:202-228,:301-325). This repairs loose permissions left by older builds. A file that disappears betweenLstatandProtectFilestill maps toErrNotInstalledor "not stored", not to an error. All three callers (internal/daemon/context_view.go:113,internal/daemon/playground_tools.go:348,internal/daemon/agent_runner.go:105) already handle these results. ProtectFilerejects foreign-owned files, files with more than one hard link and directories before it changes any permission. It is a no-op when the file is already private (Unixinternal/platform/privatefs/privatefs_unix.go:83-107, Windowsprivatefs_windows.go:541-581). On the steady-stateLookuppath it therefore only opens and checks handles and writes nothing.writeAtomicandwritePrivateRuntimeFilestill publish through a temp file plus rename (internal/platform/privatefs/privatefs.go:53-75), so the switch toprivatefs.WriteFile(..., false)keeps the writes atomic.- Over the whole PR:
PrivateTempRootputs probe, MCP and hook directories under the lock-trackedoperation-tmpwhen a base directory is set, and its fallback hardens the directory withEnsureDir(internal/workspace/operation_temp.go:98-117). I found no P0/P1 in the unchanged code. - No CJK in the added lines or in the commit message.
Process notes
mergeStateStatusis DIRTY: the branch conflicts withmainand needs a rebase.- The commit author is
yunhewith an empty email, so the commit is not linked to a GitHub account. - The PR body says Windows host verification is still pending. The Windows-only tests (
store_windows_test.go,temp_base_windows_test.go,playground_tools_windows_test.go,privatefs_windows_test.go) have not run anywhere I can see.
CI
Only CodeQL has reported (pass); Analyze (actions) is pending. Because of the merge conflict, none of the other checks have run. I ran go test -count=1 -p 4 on ./internal/linger/clicredential/ ./internal/platform/privatefs/ ./internal/workspace/ ./internal/provider/native/ on Linux and all passed, plus GOOS=windows go vet on clicredential and privatefs with no findings.
Automated review by Claude Code
Automated review of 9c5dad9 by Claude Code.
…ecret peers - Add privatefs.ProtectFile on Unix and Windows (refusing symlinks, reparse points, hardlinks, directories, and foreign-owned files before applying owner-only permissions / protected DACL). - Short-circuit Windows privatefs.EnsureDir when validateHandle already passes so steady-state Operation starts do not rewrite directory DACLs or propagate ACEs across child files. - Update writePrivateRuntimeFile to protect parent dir and target file via privatefs and atomically publish with privatefs.WriteFile. - Harden all Claude configRoot entry points (ConfigureClaudeContextHome, ClaudeProbeEnvironment, ClaudeModelInvokeEnvironment) and configureClaudeCredentials with privatefs.EnsureDir. - Export workspace.PrivateTempRoot and reuse it across ClaudeProbeEnvironment, CodexProbeEnvironment, claudeWriteMCPConfig, newAntigravityHookEndpoint, and prepareAgentCLIConfig so all private temporary directories stay under the daemon's lock-tracked operation-tmp directory (never depending on system %TEMP% ACLs on Windows), with an idempotent, read-only-safe hardened OS-temp fallback; pass probe options and tempBase explicitly through runtimeDetectionPolicy. - Self-heal legacy exposed .credentials.json and .linger-auth-source.sha256 files on unchanged fast-paths without retiring healthy resident Claude processes. - Self-heal legacy exposed TeamHub CLI credential directories and files (agentDirectory, profile.json, state.json, credential) across clicredential.Store Lookup, Current, and Put via privatefs.EnsureDir and privatefs.ProtectFile while keeping permission/ownership/link refusals non-retryable. - Allow RemoveTaskTempDir to sweep read-only crash-abandoned subtrees on Unix. - Harden peer secret/config writers in local-daemon: PrepareOperationTemp, claimRuntimeHome, openProjectionRoot (Windows Codex auth.json copies), clicredential.Store.writeAtomic, claudeWriteMCPConfig, newAntigravityHookEndpoint, and runAgentCLI.
9c5dad9 to
f780546
Compare
There was a problem hiding this comment.
Approve (0 findings)
Follow-up on 9c5dad9. Merge base 6a511c15; 1 commit and 42 files reviewed. The branch was rebased since the last review, so I compared the two versions with git range-diff.
Previous findings
- Resolved: the MCP config directory no longer depends on the basename prefix.
claudeWriteMCPConfignow always creates aMkdirTempsubdirectory (internal/provider/native/claude_mcp_config.go:28). - Resolved: the hook endpoint
Closeno longer drops the temp-root removal error.removeRootnow returnserrorandClosejoins it in (internal/provider/native/antigravity_hook.go:227).TestAntigravityHookEndpointCloseJoinsRemoveRootErrorcovers it.
Verified as fine
writePrivateRuntimeFilestill publishes atomically. It callsprivatefs.WriteFile(..., false), which writes a temp file and renames it into place (internal/platform/privatefs/privatefs.go:35-73). CallingProtectFilefirst is needed becauseWriteFilerejects an existing file whose permissions are loose (privatefs.go:44).- The new Windows
EnsureDirfast path only skips the DACL rewrite whenvalidateHandlepasses.validateHandlealready rejects reparse points, the wrong object type and non-owner-only descriptors (privatefs_windows.go:144-169). - Every
PrivateTempRootcaller gets a cleanup that is safe to call more than once. With a base directory, the root is lock-tracked throughOperationTemp.Close(internal/workspace/operation_temp.go:72-90), andmain.go:146-152and:192passTempBaseto discovery, the monitor, model invoke and the Antigravity hook.
Process notes
- The commit author
yunhehas no email, so the commit is not linked to a GitHub account.
CI: check (computer-go), check (computer-go-windows) and check (desktop) were still pending; the other checks passed or were skipped. I ran the focused local-daemon tests myself; they passed:
go testonprivatefs,clicredential,workspace(Claude/Codex/temp tests) andprovider/native(Antigravity/MCP tests).TestCodexWarmMCPReadiness, which this PR doesn't touch, failed once on its 50ms timeout under host load and passed on rerun.GOOS=windows go veton the touched packages was clean.
Automated review by Claude Code
Automated review of f780546 by Claude Code.
Summary
Fixes WHI-897 (P0 security: Claude
.credentials.jsonand peer daemon secrets written without owner-only Windows DACL, inheritingCodexSandboxUsers:(OI)(CI)(M)from%TEMP%).Root Cause
writePrivateRuntimeFile(context_capabilities.go) used plainos.CreateTemp+os.Renameinstead ofprivatefs, inheriting parent Windows ACEs.ConfigureClaudeContextHome,ClaudeProbeEnvironment,ClaudeModelInvokeEnvironment, andconfigureClaudeCredentialsusedos.MkdirAll(..., 0o700)withoutprivatefs.EnsureDir, and probes wrote temp dirs into%TEMP%.adoptClaudeCredentialreturned early on unchanged fast paths without tightening pre-existing loose ACLs/modes left by older builds.Changes
internal/platform/privatefs/privatefs_{unix,windows}.go:privatefs.ProtectFile(path)that rejects symlinks, reparse points, hardlinks, directories, and foreign-owned files before applying0o600(Unix) or protected owner-only DACL (Windows), with a fast-path no-op when already private.privatefs.EnsureDirwhenvalidateHandle(file, "directory", true) == nil, avoiding redundantSetSecurityInfoDACL rewrites and recursive child ACE propagation on steady-state Operations (TestWindowsEnsureDirSkipsRewriteWhenAlreadyPrivate).internal/workspace/{context_capabilities,claude_credentials,operation_temp,task_temp,codex_probe}.go&internal/provider/{detection_policy,discovery,protocol_probe,runtime_monitor,model_invoke,executor}.go&cmd/linger-computer-daemon/main.go:writePrivateRuntimeFiletoprivatefs.EnsureDir+privatefs.ProtectFile+ atomicprivatefs.WriteFile(..., false).probeTempRoot(baseDir, prefix)forClaudeProbeEnvironmentandCodexProbeEnvironment, moving probes into daemon's lock-tracked<StateDirectory>/operation-tmp(auto-swept on crash byPruneOperationTemps) with explicittempBaseplumbing viaruntimeDetectionPolicy.authenticationProbe.configRootentry points withprivatefs.EnsureDirand added legacy self-healing inadoptClaudeCredentialso pre-existing loose.credentials.jsonand marker files are tightened in place without retiring healthy resident Claude processes.operation-tmprelocation:PrepareOperationTemp,claimRuntimeHome,openProjectionRoot/CodexProbeEnvironment(Windows Codexauth.json), andclicredential.Store.writeAtomic.newAntigravityHookEndpoint(ConfigureAntigravityHookTempBase),claudeWriteMCPConfig(Profile.TempBase), andrunAgentCLI(Daemon.operationTempBase()) out of system%TEMP%into the daemon's already-validated private<StateDirectory>/operation-tmp(with.operation_lock+ crash sweep + cleanup of sealed read-only hook subtrees), preventing WindowspinParents(ancestor permits another user) regressions when%TEMP%carries non-whitelisted SIDs such asLOCAL SERVICE.TestWindowsPrivateTempDirsAvoidSystemTempWithNonWhitelistedSID,TestWindowsRunAgentCLIAvoidsSystemTempWithNonWhitelistedSID) and cross-platform tests verifying all three paths avoid system%TEMP%and clean up properly.Remaining Per-Operation Overhead (Steady State)
Once directories and credential files are private, each Operation performs only metadata/handle validation (
O(depth)handle opens +GetSecurityInfochecks inEnsureDironconfigRoot, plus handle validation inProtectFileon.credentials.jsonand.linger-auth-source.sha256— zeroSetSecurityInfowrites, zero recursive child ACE propagation, and zero file rewrites on unchanged credentials).Review Updates
EnsureDirfast-path skip + overhead note), P2-2 (sharedprobeTempRoot), P3-3 (explicit non-variadic params & policy-driventempBase), P3-4 (zero issue numbers in code comments).%TEMP%pinParentsregression onnewAntigravityHookEndpoint,claudeWriteMCPConfig, andrunAgentCLIby relocating all three into private<StateDirectory>/operation-tmpwith WindowsLOCAL SERVICE%TEMP%regression tests.main(4ef3f8f7).Verification
darwin/arm64):internal/platform/privatefs,internal/workspace,internal/linger/clicredential,internal/provider,internal/provider/native,internal/daemon, andgo vet ./...all PASS.GOOS=windows GOARCH=amd64(go test -con all 6 modified packages +go build ./...+go vet ./...) andGOOS=linux GOARCH=amd64(go build ./...+go vet ./...) all PASS.CodexSandboxUsersandLOCAL SERVICEACLs on%TEMP%) and Linux regression on118.