Skip to content

[code-review] Scripts self-test chunk cleanup: dropped run() input, weak refusal and exit-code checks, host-dependent cargo-deny test, reaped-PGID kill - #10366

Merged
orbit-agent-01 merged 1 commit into
agent-mainfrom
orbit/ORB-26223-6bb2bc1a
Nov 21, 2026
Merged

orbit-agent-01 merged 1 commit into
agent-mainfrom
orbit/ORB-26223-6bb2bc1a

Conversation

@orbit-agent-01

Copy link
Copy Markdown
Contributor

Task

ORB-26223 — [code-review] Scripts self-test chunk cleanup: dropped run() input, weak refusal and exit-code checks, host-dependent cargo-deny test, reaped-PGID kill

Description

Whole-module rotation review (ORB-26217) of module scripts chunk (47 direct files scripts/release_schema_oracle.py … scripts/test-pr-state-workflows.py, 23,473 lines) at pinned agent-main SHA 8ab34e3ce6e1015bc44905efd82764a88aa9bd21. Module ID: the sorted file: selectors of those 47 files (recorded in ORB-26217's reviewed-modules.json). Every finding was verified at the pinned SHA; no open code-review task covers any of them. Highest grouped severity: low.

Findings

  1. self_test_hang.run() silently drops input= unless the caller also passes stdin=PIPE — low. scripts/self_test_hang.py:130 (def run(argv, *, step, timeout=None, check=False, input=None, ...)) and :176 (proc.communicate(input=input, timeout=limit)). Unlike subprocess.run, nothing sets popen_kwargs["stdin"] = subprocess.PIPE when input is given; Popen.communicate ignores input when proc.stdin is None, so the child inherits the parent's stdin and a stdin-reading child hangs until the 120 s ceiling (reported as a hung step). Latent: the one current input= caller also passes stdin=PIPE. Culprit ORB-16740 (2d25ec8) introduced the communicate(input=...) wrapper; defect_in_new/no_test.
  2. The invalid-plugin refusal smoke accepts any non-zero validator exit — low. scripts/smoke-plugin-install.sh:35-42: if "$repo_root/scripts/validate-codex-plugin.sh" "$invalid_root" >/dev/null 2>&1; then ... fi (same for validate-agent-plugin.sh). Output is discarded and only the status is checked, so a validator that crashes (traceback, missing support file) still prints plugin-invalid-install-is-refused; the check never confirms the refusal is the not-semver version error it provokes. Culprit ORB-21222 (1ef9830); defect_in_new/review_missed.
  3. The cancellation-identity scenario never executes bench-build-budget.sh — low. scripts/test-bench-build-budget.py:946 (scenario_cancellation_identity) patches subprocess.Popen with FakeBenchmark (:1137) plus os.pidfd_open/os.kill/os.killpg/select.select/read_arm_proc_identity/pid_alive; FakeBenchmark writes the arm files itself. The scenario only exercises this test file's own teardown helpers, yet reports "passed" alongside the real-script scenarios; a regression in bench-build-budget.sh cannot fail it. Either drive the real script or rename/document it as a harness self-check. Culprit ORB-21023 (55bdd05); defect_in_new/review_missed.
  4. The real cargo-deny wrapper test depends on the host advisory DB and caller cwd — low. scripts/test-ci-fast-guards.py:2562-2566 (CargoDenyGuardrailTests.test_real_cargo_deny_with_writable_fixture) copies Path.home()/".cargo/advisory-dbs" when it exists (ignoring CARGO_HOME, which cargo-deny.sh honours) and runs scripts/cargo-deny.sh check advisories with no cwd=, so it checks whatever workspace the caller is in. On a host with a live DB a new RUSTSEC advisory against a real Orbit dependency fails this wrapper test (which only claims to test writable-DB handling), and the outcome differs by host. Use _write_minimal_advisory_db plus a tiny fixture workspace via cwd=. Culprit ORB-25945 (629e77c) added the host-DB copy; defect_in_new/review_missed.
  5. Process-group cleanup SIGKILLs a group number after its leader was reaped — low. scripts/test-pr-state-workflows.py:856-861 (nested stop_process_group in NextestShardWorkflowTests.test_proof_start_waits_for_lock_and_wait_propagates_result) runs os.killpg(process.pid, SIGKILL) in cleanup, but both leaders are reaped earlier (start.wait at :879, wait.communicate at :890). Once the background proof exits the PGID can be reused, and cleanup can SIGKILL an unrelated group. Sibling fixtures already avoid this (unreaped anchor in test-codeql-rust-local.py stop_group, pidfds in this file's _stop_owned_processes). Culprit ORB-25704 (b4945b4); defect_in_new/review_missed.
  6. "Expect a finding" cases accept a scanner error as success — low. scripts/test-openpty-portability.py:104,111,115 (OpenptyPortabilityTests.test_redirected_descendants_keep_gates_and_loading_contexts, also :122,:130-131) and scripts/test-linux-gated-test-items.py:174 (test_inline_format_arguments_and_attribute_arguments_are_uses) call check_tree(files, 1) without checking stderr, while scripts/check-openpty-portability.py/check-linux-gated-test-items.py main() also return 1 on except (OSError, ValueError). A scanner change that raises while resolving the ungated fixture passes these cases with no finding produced. Assert the expected finding line, as test_incident_shapes_and_repairs does. Culprits: ORB-22723 (1a5fa5b) for the openpty cases and ORB-18296 (a06f281) for the linux-gated case; both defect_in_new/review_missed.
  7. sync-plugin-skills.sh "no skills found" error is unreachable — nit. scripts/sync-plugin-skills.sh:16-28: for entry in "$source_root"/*/ without nullglob leaves the literal glob for an empty/missing source, so the canonical skill is missing: .../*/SKILL.md exit at :20-22 fires before the no skills found branch at :27. Still exits non-zero; only the diagnostic is wrong. Culprit ORB-11216 (4a57ff7); defect_in_new/no_test.

Acceptance Criteria

  • self_test_hang.run(..., input=...) delivers the input to the child without the caller also passing stdin=PIPE.
  • The invalid-plugin smoke and the openpty / linux-gated "expect a finding" cases assert the specific refusal or finding text, so a crashing validator or scanner error fails them.
  • scenario_cancellation_identity either drives the real bench-build-budget.sh or is named and documented as a harness self-check.
  • test_real_cargo_deny_with_writable_fixture uses a fixture advisory DB and fixture workspace independent of the host's ~/.cargo and the caller's cwd.
  • The shard-proof workflow test's cleanup never signals a process group whose leader it already reaped.
  • sync-plugin-skills.sh reports no skills found for an empty or missing source directory.

Execution Summary

Click to expand

Outcome: success

Changes:

  • scripts/self_test_hang.py: run() gives the child a stdin pipe when input is set and the caller omits stdin. An explicit stdin=PIPE remains valid. Any other stdin combined with input raises ValueError.
  • scripts/test-pr-state-workflows.py: a regression delivers a fixed payload with omitted stdin and with stdin=PIPE. Shard-proof cleanup starts each leader with process_group=0 and holds the group with an unreaped stdin anchor. killpg runs only while that anchor is still alive.
  • scripts/smoke-plugin-install.sh: the invalid-plugin smoke requires the Codex string "plugin.json.version must use strict semver" and the Agent Plugins string "plugin/plugin.json.version must use strict semver". The success line is unchanged.
  • scripts/test-openpty-portability.py and scripts/test-linux-gated-test-items.py: expect-a-finding cases assert the scanner finding line, so a scanner error that only exits 1 fails them.
  • scripts/test-bench-build-budget.py: scenario_cancellation_identity is documented as a harness self-check and reported as cancellation-identity-harness-self-check. It checks that the supplied path is named bench-build-budget.sh and does not execute that script.
  • scripts/test-ci-fast-guards.py: the writable cargo-deny test builds a minimal fixture advisory database, a tiny offline workspace, and a fixture CARGO_HOME, then runs cargo-deny.sh with cwd set to that workspace.
  • scripts/sync-plugin-skills.sh: nullglob applies only to the source-directory loop, so an empty or missing source reports "no skills found". scripts/test-validate-agent-plugin.sh covers empty and missing sources for regenerate and --check.

Criteria:

  1. Met. self_test_hang.run writes input to the child without the caller passing stdin=PIPE. Evidence: CiCacheWorkflowTests.test_run_delivers_input_without_an_explicit_stdin_pipe, both the omitted-stdin case and the explicit PIPE case. Passed.
  2. Met. The invalid-plugin smoke asserts the strict-semver refusal text. The openpty and linux-gated expect-a-finding cases assert the finding line. A crashing validator or scanner that exits 1 without that text fails. Passed.
  3. Met. scenario_cancellation_identity is named and documented as a harness self-check (printed name cancellation-identity-harness-self-check). The real script remains covered by scenario_cancellation, scenario_cancellation_spawn_window, and scenario_cancellation_flag_clear. Passed.
  4. Met. test_real_cargo_deny_with_writable_fixture uses _write_minimal_advisory_db, a fixture workspace, cwd=workspace, and a fixture CARGO_HOME. It does not copy the host advisory database and does not inherit the caller cwd. Passed.
  5. Met. Shard-proof cleanup signals the process group only while the unreaped same-session anchor holds it. Leaders are group leaders in this session (process_group=0). Passed.
  6. Met. sync-plugin-skills.sh reports "no skills found" for an empty directory and a missing directory, including --check, and does not report "canonical skill is missing" for those cases. Passed.

Validation:

  • python3 scripts/test-openpty-portability.py: passed (6 tests)
  • python3 scripts/test-linux-gated-test-items.py: passed (20 tests)
  • python3 scripts/test-pr-state-workflows.py CiCacheWorkflowTests.test_run_delivers_input_without_an_explicit_stdin_pipe: passed
  • python3 scripts/test-pr-state-workflows.py NextestShardWorkflowTests.test_proof_start_waits_for_lock_and_wait_propagates_result: passed
  • bash scripts/test-validate-agent-plugin.sh: passed
  • bash scripts/smoke-plugin-install.sh: passed
  • python3 scripts/test-bench-build-budget.py: passed (cancellation-identity-harness-self-check: passed)
  • python3 scripts/test-ci-fast-guards.py CargoDenyGuardrailTests.test_real_cargo_deny_with_writable_fixture: passed
  • python3 -c runpy plugin_install_self_test from scripts/test-qa-full-sweep.py: passed (exit 0)
  • make ci-guards: passed
  • cargo fmt --all -- --check: passed
  • git diff --check: passed
  • cargo clippy and cargo doc: not_run (no Rust crate change)
  • make ci, make ci-fast, make ci-lint, make goldens, make ci-test-affected: not_run (workspace guide excludes them as blanket pre-handoff gates)
  • workflow.required_validation_commands: empty, so no extra required command
  • task.final_validation_commands: absent from the execution envelope
  • local CodeQL: not_run (the task is not a CodeQL repair and is not tagged security or security-review)
  • scripts/workflow_helper_tests.py caller that already passes input and stdin=PIPE: not_run as its own command. The new regression covers that same combination.

Reconciliation:

  • Baseline HEAD d9fce43 with a clean status. HEAD is unchanged. Changes are uncommitted.
  • Delivery paths, all modified and unstaged: scripts/self_test_hang.py, scripts/smoke-plugin-install.sh, scripts/sync-plugin-skills.sh, scripts/test-bench-build-budget.py, scripts/test-ci-fast-guards.py, scripts/test-linux-gated-test-items.py, scripts/test-openpty-portability.py, scripts/test-pr-state-workflows.py, scripts/test-validate-agent-plugin.sh.
  • scripts/test-validate-agent-plugin.sh was added as a file selector because the empty-source cases live in its existing Python block. The new input-delivery method is declared on this update.
  • No untracked paths outside .orbit/tmp. Scratch under .orbit/tmp is gitignored and is not a deliverable.
  • Cleanup: no run-owned output left outside .orbit/tmp. git diff --check is clean.

Strategic decisions:

  • Callers that pass both input and stdin=PIPE keep working. Any other stdin value with input is rejected.
  • cancellation-identity stays a harness self-check. docs/runbooks/build-budget.md does not name that scenario and was left unchanged.
  • The shard-proof group stays in the current session so the anchor can join it. An unreaped anchor is what makes killpg safe after the leader has been reaped.

Design weaknesses / risks:

  • Severity low. Cleanup treats an unpolled anchor as still holding the group. The anchor blocks on stdin, so it does not exit by itself. The same reservation is used by the CodeQL local fixture.
  • The cargo-deny wrapper always loads the repository deny.toml. This test's empty package graph passes the current advisories check. A later deny.toml rule that rejects that empty package would fail the fixture.

Deviations from original plan: none. The build-budget runbook was not edited because it does not name cancellation-identity.

Assessment: Each finding now fails its own check when the refusal text, finding line, stdin delivery, fixture isolation, group reservation, or empty-source diagnostic regresses. No Rust sources changed.

Validation

  • Not reported

Branch Freshness

  • Base ref: refs/remotes/origin/agent-main
  • Head ref: orbit/ORB-26223-6bb2bc1a
  • Behind base: 0
  • Ahead of base: 1

[code-review] Scripts self-test chunk cleanup: dropped run() input, weak refusal and exit-code checks, host-dependent cargo-deny test, reaped-PGID kill

Outcome: success

Orbit-Task: ORB-26223
Fixes: 2d25ec8 ("fix: [friction-curation] Release and PR-state guard self-tests fail ci-… [ORB-16740] (#5196)")
Fixes: 1ef9830 ("fix: [code-review] Repair script guards and behavioral QA claims [ORB-21222] (#7679)")
Fixes: 55bdd05 ("fix: [code-review] Keep benchmark cancellation fixture process identiti… [ORB-21023] (#7577)")
Fixes: 629e77c ("fix: [code-review] Scripts self-test module [ORB-25945] (#10212)")
Fixes: b4945b4 ("fix: Wait for the shard coverage proof to acquire [ORB-25704] (#10062)")
Fixes: 1a5fa5b ("fix: [code-review] Preserve platform gates below redirected Rust file m… [ORB-22723] (#8430)")
Fixes: a06f281 ("feat: Guard: flag Linux-gated test items left ungated for macOS [ORB-18296] (#6128)")
Fixes: 4a57ff7 ("feat: Ship orbit-orchestrate skill for continuous task preparation, del… [ORB-11216] (#1339)")
Regression-From: ORB-16740
Regression-From: ORB-21222
Regression-From: ORB-21023
Regression-From: ORB-25945
Regression-From: ORB-25704
Regression-From: ORB-22723
Regression-From: ORB-18296
Regression-From: ORB-11216
Regression: defect_in_new; escape=no_test; severity=low
Regression: defect_in_new; escape=review_missed; severity=low
Regression: defect_in_new; escape=no_test; severity=nit
@orbit-agent-01 orbit-agent-01 added the orbit orbit related label Nov 21, 2026
@orbit-agent-01
orbit-agent-01 merged commit 3c12ba6 into agent-main Nov 21, 2026
20 checks passed
@orbit-agent-01
orbit-agent-01 deleted the orbit/ORB-26223-6bb2bc1a branch November 21, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

orbit orbit related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant