Skip to content

Gate agent sessions on configurable host resources - #1206

Merged
JacobStephens2 merged 7 commits into
mainfrom
issue-1152
Oct 24, 2026
Merged

JacobStephens2 merged 7 commits into
mainfrom
issue-1152

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

before an agent session or Model test call
  read [resources] from User config
  if limits are enabled
    measure available RAM and one-minute load per logical CPU
    wait while outside limits; recheck config and allow interruption
  start the Harness

thirdshift resources [--json] and the Console's Resources page (9 or g e) show the same measurements, limits and admission decision. Reload the page for a fresh snapshot. Configure minimum available memory in decimal MB and maximum load per CPU as a percentage; 0 disables each limit. Resumes, Repairs, Security reviews, release summaries and preflight Model test calls use the gate. Issue trust is checked after a work session's wait.

Closes #1152

Test seams

  • User config parsing and completion.
  • Host resource admission using known measurements.
  • The binary's resources command and authenticated Console HTTP view.
  • Real session launch, waiting, recovery and interruption through the binary.

Evidence

  • Before: The CLI test failed because resources was not a command; the session test showed a Harness starting despite an impossible memory threshold. Spec finding S1's exact isolated reproduction failed (exit 101): OpenCode ran Reply with OK. before resource admission.
    After: The same S1 command passes (exit 0), and its regression test is retained as resource_limits_block_opencode_probe_sessions_too. Focused tests cover threshold equality/independent limits, config validation, waiting/recovery, Resumes, interruption, all three Model-probe entry points, Console reload and sign-in protection.
  • cargo check and cargo clippy --all-targets -- -D warnings: passed.
  • All 68 Console browser tests passed, including Resources navigation, config reload and a 390px phone view. Local screenshot: /tmp/thirdshift-1152-resources.png.
  • NEXTEST_TEST_THREADS=8 /usr/bin/time -p scripts/affected-tests main: passed — 2,427 Rust tests (57 skipped) and all 49 public-site tests. Warm cache, compilation included; selector wall time 1,162.88s, Rust execution 1,066.80s.

Unaddressed findings

Standards

None skipped. No findings.

Spec

None skipped. S1 was reproduced, fixed in 285a078, and verified with the reviewer's unchanged command.

Security

No unaddressed findings introduced by this change. Security review of the diff against main (resource gating in src/resources.rs, src/session.rs, harness probes, thirdshift resources CLI, and the read-only Console Resources page behind the existing auth guard with the shared frame-ancestors 'none' CSP) found no reachable cross-boundary violation: limits come from the owner's User config (nonnegative integers, unknown keys rejected), admission reasons render only numbers, observe reads only RAM/CPU inventory plus getloadavg with return/finiteness checks, and wait rechecks config on a ten-second pause with interrupt handling. No proof-of-concept test fails on HEAD, so no fix was made and no regression test was added by this review.

Security review outcome

No unaddressed introduced findings.

Review coverage

Both independent reviewers inspected the 28 changed files through 285a078 against main, including generated site/docs/index.html directly and the Model-probe fix. No generated output was excluded. After review, the help-only hunk in src/main.rs condensed existing text to retain the tested 65-line help limit; it was inspected locally and verified with cargo test --test command_surface help_is_a_compact_reference_with_a_link_to_the_details.

The final src/config.rs comment/test-only hunks add explicit default 0 wording and the two resource keys to the existing config inventory assertion; these hunks were also added after independent review.

Unread changed files under both Standards and Spec: tests/setup.rs and src/setup.rs. Their changes were added after the reviews to update two expected section lists for [resources], assert both limits default to zero, and include the limits in an existing complete-config unit fixture. Reports, with each axis's combined files-read list and these coverage notes, are retained at .thirdshift-review-xiEaBt/standards.md and .thirdshift-review-xiEaBt/spec.md in the Session evidence.

Merge Danger

Door: two-way

Blast Radius: sessions

Limits default to disabled. Configured limits delay new sessions and do not stop running sessions. Measurements are host snapshots, without capacity reservations or container quota accounting. The existing Spec parallel limit still applies.

Built with codex · gpt-6.1-sol · xhigh

@JacobStephens2
JacobStephens2 merged commit 519e382 into main Oct 24, 2026
18 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-1152 branch October 24, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant