Skip to content

Force the Containment Signal in test_install's In-Process Registration Checks - #2465

Merged
ptr727 merged 1 commit into
developfrom
fix/2462-registration-containment-override
Oct 7, 2026
Merged

ptr727 merged 1 commit into
developfrom
fix/2462-registration-containment-override

Conversation

@ptr727

@ptr727 ptr727 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

On a host without a systemd user manager, every Windows and macOS host among them, 11 TestRegistration cases in host-setup/agent-safety/claude/test_install.py failed (#2462).

  • Each case installs through run(), which forces AGENT_SAFETY_CONTAINMENT_OVERRIDE=1 on the installer subprocess, so the install registers the containment prefix.
  • The case then calls install.registration_problems() in-process, with no override set. That call judged containment against the host's real capability and reported the forced prefix as stale.
  • TestRegistration.setUp now patches the same override into os.environ for each case, so the in-process check judges containment the same way the install did. The patch is undone in each case's cleanup.

Verification

  • Reproduced on Linux by exporting AGENT_SAFETY_CONTAINMENT_OVERRIDE=0 to the test process, which makes the in-process judgment match a host that cannot contain. Before the fix, TestRegistration failed exactly the 11 cases Force the Containment Signal in test_install's In-Process Registration Checks #2462 lists. After it, all 26 pass with the outer signal at 0, at 1, and unset.
  • The whole test_install.py suite passes, all 137 tests, both with the outer signal at 0 and on this host's real signal.
  • ruff and the prose gate are clean, and the local strict review raised no finding.
  • The native Windows run is still to come, and the maintainer runs it.

Fixes #2462

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Test setup now applies the safety-containment configuration consistently and cleans up environment changes after each test. This helps keep test runs isolated and repeatable without changing the app’s user-facing behavior.

…n Checks

TestRegistration installs through run(), which forces
AGENT_SAFETY_CONTAINMENT_OVERRIDE=1 on the subprocess, and then calls
install.registration_problems() in-process with no override set. On a
host without a systemd user manager, every Windows and macOS host among
them, that call judged the forced containment prefix as stale, and 11
cases failed.

The class now sets the same override in os.environ for each case, so the
in-process check judges containment exactly as the install did.

Fixes #2462

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 7, 2026 02:40
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1f082ea2-bbce-4760-8fb1-9013feb82476
📥 Commits

Reviewing files that changed from the base of the PR and between e93b673 and 551e993.

📒 Files selected for processing (1)
  • host-setup/agent-safety/claude/test_install.py

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


📝 Walkthrough

Walkthrough

The TestRegistration setup now sets AGENT_SAFETY_CONTAINMENT_OVERRIDE to "1" and registers cleanup to stop the environment patcher.

Changes

Registration test setup

Layer / File(s) Summary
Containment override setup
host-setup/agent-safety/claude/test_install.py
TestRegistration.setUp patches AGENT_SAFETY_CONTAINMENT_OVERRIDE to "1" and registers cleanup to stop the patcher.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 551e9

The change aligns in-process registration checks with the installer’s forced-containment mode. Native Windows execution remains pending, so that platform-specific acceptance result is not yet confirmed; no code failure is otherwise established.

🚥 Pre-merge checks | ✅ 3 | ❌ 1 | ❓ 1

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive Issue #2462 requires in-process registration_problems() checks to use the same containment override as the installer, and requires test_install.py to pass natively on Windows. The change summary r… Provide the result of the native Windows test_install.py run to determine whether the remaining acceptance criterion passes.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: forcing the containment signal for in-process registration checks.
Out of Scope Changes check ✅ Passed The reported change is limited to setting and cleaning up the containment override in TestRegistration.setUp in test_install.py. This directly supports issue #2462. No unrelated changes are report…
Full details: Linked Issues check

Explanation

Issue #2462 requires in-process registration_problems() checks to use the same containment override as the installer, and requires test_install.py to pass natively on Windows. The change summary reports that TestRegistration.setUp sets AGENT_SAFETY_CONTAINMENT_OVERRIDE="1" and cleans it up, which addresses the mismatch. The PR description says native Windows validation is pending, so the Windows acceptance criterion is not established. The diff could not be read because the repository could not fetch a required object.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.47%. Comparing base (e93b673) to head (551e993).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2465   +/-   ##
========================================
  Coverage    58.47%   58.47%           
========================================
  Files           16       16           
  Lines         8062     8062           
========================================
  Hits          4714     4714           
  Misses        3348     3348           
Flag Coverage Δ
python-3.13 58.47% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Aligns in-process registration checks with the containment override used by installer subprocesses, preventing false test failures.

Changes:

  • Applies AGENT_SAFETY_CONTAINMENT_OVERRIDE=1 during TestRegistration.
  • Restores the environment after each test.
File Description
host-setup/​agent-safety/​claude/​test_install.py Synchronizes registration-test containment behavior with installer execution.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ptr727

ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit 4d99637 into develop Oct 7, 2026
13 checks passed
@ptr727
ptr727 deleted the fix/2462-registration-containment-override branch October 7, 2026 03:14
@ptr727

ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

Native Windows check at 4d9963793b38d8eed9472868b0e752bfac2ba5f7 (the squash commit, whose tree is this PR's head tree): test_install.py ran 137 tests, OK with 22 skipped, exit 0. The 11 TestRegistration failures from #2462 no longer appear.

ptr727 added a commit that referenced this pull request Oct 7, 2026
…'s In-Process Registration Checks (#2466)

## Summary

Promotes #2465 to `main`. On a host without a systemd user manager,
every Windows and macOS host among them, 11 `TestRegistration` cases in
the agent-safety install suite failed. Each case installs through a
subprocess that forces the containment signal on. The in-process
`registration_problems()` check that follows read the host's real
capability instead, and judged the forced prefix as stale.
`TestRegistration` now sets the same signal for each case. Only the test
changes, and the installer is unchanged.

On Linux, forcing the in-process signal off reproduced exactly the 11
failures, and with the fix the whole suite passes (137 tests) with the
signal forced off and on the host's real signal. The native Windows run
is the maintainer's, and its result goes on #2465.

Closes #2462

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants