Skip to content

fix(cli): fall back when systemd scope launch fails - #715

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/resource-scope-fallback
May 2, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/resource-scope-fallback

Conversation

@Sinity

@Sinity Sinity commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary

Handle systemd-run --user --scope launch failures as unavailable resource isolation rather than exiting the original command with the systemd-run status.

Problem

The resource boundary work from #711 made auto mode prefer transient systemd scopes for heavy foreground maintenance. A nonzero systemd-run exit is not the same as successful re-exec inside a scope: in auto mode it should fall through to process-local demotion, and in explicit scope mode it should report an unavailable scope with the diagnostic.

Solution

  • Capture systemd-run output and treat nonzero return codes as ScopeLaunchUnavailableError.
  • Preserve the existing SystemExit(0) path when scope launch succeeds.
  • Add a focused test for explicit scope-mode launch failure and diagnostic propagation.

Verification

  • ruff check polylogue/maintenance/resources.py tests/unit/maintenance/test_resources.py
  • ruff format --check polylogue/maintenance/resources.py tests/unit/maintenance/test_resources.py
  • mypy tests/unit/maintenance/test_resources.py
  • pytest -q tests/unit/maintenance/test_resources.py
  • devtools verify --quick
  • pre-push hook: devtools verify --quick

Ref #708

Treat nonzero systemd-run exits as unavailable scope launches instead of exiting the original foreground command with the same failure code. In auto mode this lets the process-local nice/ionice fallback run; in explicit scope mode the user gets a structured unavailable report with the systemd-run diagnostic.

Ref #708
Copilot AI review requested due to automatic review settings May 2, 2026 16:45
@coderabbitai

coderabbitai Bot commented May 2, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 30 minutes and 4 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 765a573b-cf9b-4e33-9c89-f3e0407d0597

📥 Commits

Reviewing files that changed from the base of the PR and between 863e73c and c949744.

📒 Files selected for processing (2)
  • polylogue/maintenance/resources.py
  • tests/unit/maintenance/test_resources.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/resource-scope-fallback

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
Review rate limit: 0/1 reviews remaining, refill in 30 minutes and 4 seconds.

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

@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Polylogue Proof Pack

Refs: origin/master..HEAD
Changed paths: 2

Affected Domains

  • none with affected claims

Focused Gates

  • none

Required PR Gates

  • devtools verify --quick — full PR gate remains explicit
  • devtools verify — full PR gate remains explicit

Optional Confidence Gates

  • devtools build-package — deployment readiness gate; run when packaging or release confidence matters
  • nix flake check — deployment readiness gate; run when packaging or release confidence matters

Known Gaps

  • none for domains with affected claims

Oracle / Cost

  • oracle mix: {}
  • cost tier: {}
  • stable affected obligations: 0
  • agent judgment cells: 0

@Sinity
Sinity merged commit 9029a37 into master May 2, 2026
13 of 17 checks passed
@Sinity
Sinity deleted the feature/fix/resource-scope-fallback branch May 2, 2026 16:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c949744f6c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread polylogue/maintenance/resources.py Resolved
Comment thread polylogue/maintenance/resources.py Resolved
@Sinity
Sinity removed the request for review from Copilot May 2, 2026 17:08
Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Handle `systemd-run --user --scope` launch failures as unavailable resource isolation rather than exiting the original command with the `systemd-run` status.

## Problem

The resource boundary work from #711 made `auto` mode prefer transient systemd scopes for heavy foreground maintenance. A nonzero `systemd-run` exit is not the same as successful re-exec inside a scope: in `auto` mode it should fall through to process-local demotion, and in explicit `scope` mode it should report an unavailable scope with the diagnostic.

## Solution

- Capture `systemd-run` output and treat nonzero return codes as `ScopeLaunchUnavailableError`.
- Preserve the existing `SystemExit(0)` path when scope launch succeeds.
- Add a focused test for explicit scope-mode launch failure and diagnostic propagation.

## Verification

- `ruff check polylogue/maintenance/resources.py tests/unit/maintenance/test_resources.py`
- `ruff format --check polylogue/maintenance/resources.py tests/unit/maintenance/test_resources.py`
- `mypy tests/unit/maintenance/test_resources.py`
- `pytest -q tests/unit/maintenance/test_resources.py`
- `devtools verify --quick`
- pre-push hook: `devtools verify --quick`

Ref #708
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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