Skip to content

test(config): guard every agent home in tests - #47837

Open
noter wants to merge 1 commit into
stablyai:mainfrom
codeious:ac/01-f1-agent-home-guard
Open

noter wants to merge 1 commit into
stablyai:mainfrom
codeious:ac/01-f1-agent-home-guard

Conversation

@noter

@noter noter commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Tests must never write into the agent folders in your real home directory. This adds the remaining agent folders to the guard that stops that.

What Changed

Standalone. Rebased onto main at 3d3d28c; it has no dependencies and can merge on its own. Commit fa1715fc87.

  • Adds .factory, .grok, .pi, .omp, .hermes and .commandcode to the real-home write guard in config/scripts/test-runtime/environment/vitest-real-agent-home-write-guard.ts.
  • Clears those agents' inherited home and config overrides (including Droid's FACTORY_HOME_OVERRIDE) before tests choose their own homes.
  • No runtime, wire, storage, desktop or mobile change.

Why

Later PRs in this stack test Droid, which keeps its state under ~/.factory. Without the guard, a test that resolves a home from an inherited variable could write into the developer's real folders.

Linked Issue

Fixes #47824

Visual Proof

N/A: test configuration only.

Testing

Local macOS only.

  • ORCA_CODE_QUALITY_BASE=stablyai/main pnpm check:changed passed on this commit after the rebase (format, oxlint, typecheck, tests importing the change, selected ratchets).
  • Full unit suite (pnpm test --maxWorkers=6) on this branch: 1308 test files passed, 3 failed, 15 skipped. The failing files also fail on main at 3d3d28c on this machine: agent-cli-update-timeout (timing), bot-upcoming-copy (locale), worktree-removal-real-git (temp-dir cleanup).
  • Golden E2E journeys ran on the previous stack tip (main at 59f3122): 8 passed, 4 skipped (Windows-only), and golden-fresh-profile-terminal failed the same way on main. Not rerun after the rebase.

Not run: Linux, Windows, or SSH remote hosts.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

Changed test files:

  • None. No test meets the repo's bar for this change.

Performance

None, because this only runs in test setup.

Risk

Level: Low

Only test runs are affected: a test that still points at one of these real folders now fails instead of writing there. Back out with a plain revert.

AI Disclosure

Review

Self-reviewed this PR's single commit for correctness, security, and performance. Merge order:

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Considered security, macOS/Linux/Windows paths, SSH remote hosts, mobile compatibility, folder workspaces, and performance. Execution coverage is limited to the checks listed under Testing.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Merge message

test(config): guard every agent home in tests

Tests could write into real agent homes that the guard did not
cover. Add .factory, .grok, .pi, .omp, .hermes and .commandcode to
the real-home write guard and clear their inherited home overrides.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The test runtime write guard now includes .factory, .grok, .pi, .omp, .hermes, and .commandcode among protected home-directory entries. It also adds agent-specific inherited path variables, including FACTORY_HOME_OVERRIDE, to the variables whose absolute values become protected roots.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 8c330

This change extends the test write guard to cover more agent home directories and their override variables. It affects test setup only, and no actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "test(config): guard every agent home in tests" matches the main change: the PR adds six agent home directories (.factory, .grok, .pi, .omp, .hermes, .commandcode) to the real-home write gua…
Linked Issues check Passed Issue #47824 requires the real-home write guard to cover .factory, .grok, .pi, .omp, .hermes, and .commandcode, and to clear inherited home and config overrides, including `FACTORY_HOME_OV…
Out of Scope Changes check Passed The reviewed whole-PR diff touches only config/scripts/test-runtime/environment/vitest-real-agent-home-write-guard.ts. Every added entry is an agent home folder or an inherited home or config overri…
Description check Passed The description follows the repository template closely. It includes ELI5, What Changed, Why, Linked Issue (Fixes #47824), Visual Proof (N/A with reason), Testing with platform coverage, Performance w…
Full details: Title check

Explanation

The title "test(config): guard every agent home in tests" matches the main change: the PR adds six agent home directories (.factory, .grok, .pi, .omp, .hermes, .commandcode) to the real-home write guard and clears their inherited home overrides. It is conventional-commit style, concise, and specific. The phrase "every agent home" is slightly broad, since the guard covers only the listed agents, but the title still reflects the primary change.

Full details: Linked Issues check

Explanation

Issue #47824 requires the real-home write guard to cover .factory, .grok, .pi, .omp, .hermes, and .commandcode, and to clear inherited home and config overrides, including FACTORY_HOME_OVERRIDE. The diff of config/scripts/test-runtime/environment/vitest-real-agent-home-write-guard.ts (merge base 59f3122 to head 8c3306e) adds all six folders to AGENT_HOME_ENTRIES. It adds GROK_HOME, PI_CODING_AGENT_DIR, PI_CONFIG_DIR, OMP_CODING_AGENT_DIR, ORCA_PI_SOURCE_AGENT_DIR, ORCA_PI_CODING_AGENT_DIR, ORCA_OMP_CODING_AGENT_DIR, HERMES_HOME, and FACTORY_HOME_OVERRIDE to INHERITED_STATE_ENV. The issue names no override variable for .commandcode, so none is required. The change is test setup only, as the issue requests. No coding requirement is unmet. The issue does not ask for new tests, and the PR states that no test files changed.

Full details: Out of Scope Changes check

Explanation

The reviewed whole-PR diff touches only config/scripts/test-runtime/environment/vitest-real-agent-home-write-guard.ts. Every added entry is an agent home folder or an inherited home or config override listed in issue #47824. The PR description and the raw summary report no runtime, wire, storage, desktop, or mobile changes. No change in the reviewed diff is unrelated to the linked issue.

Full details: Description check

Explanation

The description follows the repository template closely. It includes ELI5, What Changed, Why, Linked Issue (Fixes #47824), Visual Proof (N/A with reason), Testing with platform coverage, Performance with a completed line, Risk with level and back-out plan, Review, Agent skill upstream boundary, Notes, and Checklist. The AI Disclosure section was left as the template placeholder, which is acceptable for a conditional section. The main gaps are that the 'Changed test files' section says no tests were added, and the local checklist items for lint, typecheck, and pnpm test are not checked. The author states that check:changed passed and gives full test-suite results, so the gaps are minor. The 'Fixes #' line is filled in. The 'Why' section explains the motivation but gives little comparison with alternatives, which the template asks for.

  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1a46fadf-24dd-4080-bb2d-7f18b69efd0f
Commits

Reviewing files that changed from the base of the PR and between 50f0c54 and 8c3306e.

Files selected for processing: 1

  • config/scripts/test-runtime/environment/vitest-real-agent-home-write-guard.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This was referenced Nov 23, 2026
Add the remaining agent home folders (.factory, .grok, .pi, .omp, .hermes,
.commandcode) to the real-home write guard and clear their inherited
home/config overrides, including Droid's FACTORY_HOME_OVERRIDE, before
tests pick their own homes.

No runtime, wire, storage, desktop, or mobile behavior changes.
@noter
noter force-pushed the ac/01-f1-agent-home-guard branch from 8c3306e to fa1715f Compare November 26, 2026 11:29

This branch has not been deployed

No deployments
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.

[Feature]: Guard every agent home folder in tests

1 participant