Skip to content

fix: disable FFF background scans in managed OpenCode engines - #298

Merged
johannmachemer merged 1 commit into
devfrom
codex/disable-fff-background-reads
Oct 20, 2026
Merged

johannmachemer merged 1 commit into
devfrom
codex/disable-fff-background-reads

Conversation

@johannmachemer

Copy link
Copy Markdown
Collaborator

Summary

An ordinary chat can make the bundled OpenCode engine read project files while FFF initializes, even when the agent calls no tools. On OneDrive this can trigger unwanted downloads.

Set OPENCODE_DISABLE_FFF=true for LegalWork-managed engines: desktop/embedded server, standalone server, host orchestrator, and container orchestrator. Keep the reported execution environment consistent with the child process.

Why

FFF is an optional backend for OpenCode's filesystem-search service. Filename/folder suggestions retain its existing ripgrep + fuzzy-search fallback. The agent's built-in glob and grep tools already use ripgrep directly; explicit read also works without FFF.

Issue

Related upstream reports: FFF automatically downloading OneDrive files, OpenCode scanning OneDrive at startup.

Scope

  • Disable FFF at each managed engine launch, including inherited/caller environment overrides in the server launcher.
  • Add a process-level regression and a bundled-engine integration test for filename/folder suggestions and actual agent glob, grep, and read calls.
  • Run the integration test in the existing Linux/macOS shipped-engine CI step.

Out of scope

Explicit agent content reads/searches, Git snapshots, and LegalWork's separate document-content search/sync can still read files. Externally managed OpenCode servers are outside this launch policy.

Testing

Ran

Set LEGALWORK_TEST_OPENCODE_BIN to the bundled OpenCode 1.18.29 executable for engine tests.

  • pnpm --filter legalwork-server exec bun test src/managed-opencode.test.ts src/managed-opencode.search.e2e.test.ts src/embedded.test.ts — 7 passed, 33 assertions.
  • pnpm exec bun test --preload ./apps/server/test-preload.ts --timeout 180000 apps/server/src/scheduled-tasks/engine.test.ts apps/server/src/managed-opencode.search.e2e.test.ts — 2 passed, 109 assertions.
  • pnpm --filter legalwork-server exec node node_modules/typescript/bin/tsc -p tsconfig.json --noEmit — passed.
  • pnpm --filter legalwork-orchestrator exec node node_modules/typescript/bin/tsc -p tsconfig.typecheck.json — passed.
  • Additional native macOS read-trace reproduction through the actual LegalWork server and bundled engine — 4 passed, 19 assertions.
  • git diff --check — passed.

Result

The process regression failed before the fix: the child inherited OPENCODE_DISABLE_FFF=false. It passes after the fix and verifies the execution details report the effective value.

Native read tracing with synthetic fixtures:

Action After fix
Ordinary chat, no tools, 40 text files 0/40 document files read (40/40 before)
Filename/folder suggestions and filename-only glob Successful results; no document content reads
Explicit single-file read Only the requested document read
Agent content grep Expected positive matches returned

The trace is not exhaustive for native child-process grep reads; no zero-read claim is made for content search.

CI status

Pending GitHub checks at PR creation. Local checks above passed.

Manual verification

  1. Restart a LegalWork-managed engine and check execution details for OPENCODE_DISABLE_FFF=true.
  2. Type @ followed by a filename or folder name; suggestions should still appear.
  3. Ask the agent to find a file, search a clause, and read it. The committed bundled-engine test exercises these tools with a local model fixture, without paid model calls.

Evidence

The native read trace and engine integration checks above cover background file access. No UI video/screenshot was captured because the behavior is background I/O. Windows OneDrive placeholder hydration has not been tested; the reproduced fix is removal of FFF's automatic content reads on macOS.

Risk

Filename ranking/performance may differ with the fallback. Existing engine processes need a restart for the launch policy to take effect.

Rollback

Revert this commit to restore FFF initialization.

Contribution rights

DCO sign-off included. No third-party source code copied and no new dependencies added.

@johannmachemer
johannmachemer force-pushed the codex/disable-fff-background-reads branch from 238b157 to bbf1831 Compare October 20, 2026 07:36
@johannmachemer
johannmachemer enabled auto-merge (squash) October 20, 2026 07:36
@johannmachemer
johannmachemer merged commit a2bf4c0 into dev Oct 20, 2026
14 of 15 checks passed
@johannmachemer
johannmachemer deleted the codex/disable-fff-background-reads branch October 20, 2026 07:43
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