Skip to content

fix: Route lane tests and builds through declared pueue operations - #37

Merged
Sinity merged 2 commits into
masterfrom
feature/packet/sinnix-xsk3
Sep 4, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/packet/sinnix-xsk3

Conversation

@Sinity

@Sinity Sinity commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Route every new agentctl pueue launch through a transient systemd scope named for its declared pool, with fixed pool resource budgets and recursive-worker guards. Route Sinnix heavy check entry points through declared bulk operations and keep agent conversation parallelism at six.

Problem

Managed lane tests and Nix workloads could remain descendants of the conversational agent scope, bypassing pueue pool admission and resource isolation. The incident snapshot recorded four lanes consuming about 3.1 GiB together and a Nix child reaching about 1.89 GiB RSS inside the agent cgroup.

Solution

  • sinnixd-queue-run wraps new launches in sinnixd-pueue-<pool>-<job>.scope under sinnixd-pueue-<pool>.slice.
  • Fixed agent, pytest, bulk, normal, and interactive slices declare CPU, IO, memory, and swap policy; pytest and bulk use zero swap and pressure handling.
  • Queue workers export SINNIXD_QUEUE_WORKER=1 and operation identity; managed lane wrappers submit checks to their declared pueue operations.
  • Cancellation and timeout stop the transient scope, while launch inputs without a pool remain readable for historical jobs.

Verification

  • python -m pytest -q pkgs/sinnixd/test_queue_run.py::test_a_declared_pool_runs_the_child_in_its_named_systemd_scope pkgs/sinnixd/test_launch.py::test_cancel_kills_the_task_and_signals_the_recorded_process_group pkgs/sinnixd/test_launch.py::test_start_writes_the_launch_input_and_queues_the_wrapper_in_the_pool — 3 passed in 0.05s.
  • python -m pytest -q pkgs/sinnixd/test_pueue.py::test_a_private_pueue_task_places_its_child_in_the_declared_pool_scope — 1 passed in 2.05s.
  • nix build .#sinnixd --accept-flake-config --no-link — exit 0.
  • nix build .#checks.x86_64-linux.agent-resource-policy .#checks.x86_64-linux.agentctl-operation-contract .#checks.x86_64-linux.agentctl-operation-launch --accept-flake-config --no-link — exit 0.

Residual risk

The deployed live service was not switched; live smoke and hostile-allocation checks require activation authority. The broader local Python selection had one inherited environment-scrubbing failure involving PYTHONNOUSERSITE and LC_CTYPE; the changed focused tests and package checks pass.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 88039980-4fb0-47a8-85c2-c526bc336ffe


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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-04T01:44:16.854979Z 517c625 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity merged commit 68373ec into master Sep 4, 2026
2 checks passed
@Sinity
Sinity deleted the feature/packet/sinnix-xsk3 branch September 4, 2026 01:38

@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: 517c625860

ℹ️ 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 flake/dev-shell.nix
${resolveFlakeDir}
if [ "''${SINNIXD_PRINCIPAL:-}" = agent-control ] \
&& [ "''${SINNIXD_OPERATION:-}" != check ]; then
exec agentctl job start sinnix check --workspace "$_flake_dir" --wait -- "$@"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fail when queued verification is still running

When the single-slot bulk pool is occupied, this nested job can spend part or all of the default 3,600-second wait queued; agentctl then returns exit 0 for a nonterminal task (pkgs/sinnixd/sinnixd/cli.py:225-236), so the lane treats check as successful while verification is still running or has not started. The equivalent check-heavy and check-all redirects have the same problem; either wait long enough to include queueing and the operation timeout or make a wait timeout fail.

AGENTS.md reference: AGENTS.md:L38-L46

Useful? React with 👍 / 👎.

Comment on lines +369 to +370
MemoryHigh = "8G";
MemoryMax = "10G";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep the hard memory ceiling on each lane scope

Because sinnixd-pueue-agent.slice contains all six admitted agent tasks, this MemoryMax is a shared 10G cap rather than the intended per-lane 10G safety boundary. With multiple healthy lanes, their combined usage can exceed 10G even though every lane remains below its own declared limit, causing allocation failures or OOM kills and undercutting the parent job plane's 20G budget; leave the hard cap on each lane scope rather than on the shared pool slice.

AGENTS.md reference: AGENTS.md:L98-L107

Useful? React with 👍 / 👎.

def scope_unit_for(job_id: object, pool: str) -> str:
"""Name the transient scope that carries one queued task's workload."""
safe_job_id = re.sub(r"[^A-Za-z0-9_.-]", "-", str(job_id)).strip("-") or "job"
return f"{POOL_SLICE_PREFIX}-{pool}-{safe_job_id[:160]}.scope"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the unique suffix when shortening scope names

For any project/operation label that makes the generated job reference exceed 160 characters, this truncation removes the UUID suffix added by _reference(). Two concurrent launches with the same long label therefore request the same transient scope name, and the second systemd-run fails because the first scope already exists; descriptor validation permits identifiers of this length, so shorten or hash the label while retaining the unique suffix.

Useful? React with 👍 / 👎.

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