Skip to content

e2e borrow never moves a bench's own root-run miner, and the worker gate still passes #3972

Open

Description

@pithead-developer

What's the problem

When a bench borrows its own miner (the rig runs on the bench host itself), the e2e borrow fixture never moves the rig to the stack under test, and the harness does not notice.

  • repoint_miner (tests/integration/lib/borrow-fixture.sh) rewrites the rig's XMRig config, then calls miner_reload (tests/integration/e2e.sh): sudo -n systemctl restart xmrig || systemctl --user restart xmrig || pkill -HUP -x xmrig.
  • On such a bench, XMRig runs as root under the system xmrig unit. The job's user may only sudo systemctl stop xmrig and sudo systemctl start xmrig, not restart. It cannot signal the root process either: pkill fails with "Operation not permitted".
  • In job 3718 the rig's XMRig kept the same process and kept mining on its normal pool for the whole run (01:40Z to 02:19Z on 2026-11-10). It logged no reload. Yet miner_reload returned success, so the harness printed "miner primary pool is now: :3333". Which fallback returned 0 is unknown.
  • The check that follows, wait_workers, counts any worker on the test stack's proxy. In job 3718 it reported "1 worker(s) mining through the test bench" at 01:46Z, while the borrowed rig was not mining there. Which worker it counted is unknown.

What it impacts

  • Every worker-dependent e2e row on a bench that borrows its own miner can pass without the borrowed rig, so those rows prove less than they claim.
  • After a password-rotating step, the re-arm (handle_borrow_rearm action rearm) cannot bring the rig back. Job 3718 failed with "only 0 worker(s) connected after 180s" and "Failed to apply a borrowed-miner handshake request".
  • Benches that borrow a remote rig are not affected. In job 547 the remote rig did switch to the test stack.

How I found it

Job 3718 (PR #3386, lifecycle phase at 1fb7eebb) failed at the re-arm. I then compared the rig's XMRig journal for the job window: every job came from its normal pool, with no restart or reload. I also checked the bench's sudo grant (stop and start only) and that pkill on the root process fails. The same journal check on job 547's remote rig shows the switch to the test stack and back.

How important is it

High for test validity. The affected bench is the first choice for pithead e2e, so its lifecycle and worker rows may be vacuous. It loses no data, and the rig stays on its normal pool.

Acceptance criteria

  • On a bench that borrows its own root-run miner, a borrow makes the rig's XMRig mine to the stack under test: its journal or API shows the bench pool after the borrow and after every re-arm.
  • miner_reload fails loudly when no path actually reloaded XMRig. A selftest covers a fake where restart is refused and the signal fails.
  • The worker gate proves the borrowed rig itself is connected, by its rig-id or worker name, not just a worker count. A selftest shows that another worker does not satisfy it.
  • After the support-bundle step's credential restore, the re-arm brings the rig back and the reconnect row passes on both a self-borrowing and a remote-rig bench.

Possible solutions

  • In miner_reload, try sudo -n systemctl stop xmrig && sudo -n systemctl start xmrig before the other fallbacks, and drop or narrow the pkill fallback so it cannot hit an unrelated process.
  • Verify the reload instead of trusting exit codes: a new MainPID, or the rig's XMRig API reporting the bench pool as active.
  • Give the borrowed pool a distinct rig-id or worker name, and have wait_workers look for that worker on the proxy.
  • Alternatively, grant restart in the bench's sudoers. That is a bench-side change and still needs the verification above.

Release: date 2026-11-30
Who: operator

Activity

  1. added
    bug
    testing
    on Nov 10, 2026
  2. added this to the v2.0.5 milestone on Nov 13, 2026
  3. pithead-developer commented on Nov 13, 2026

    @pithead-developer
    ContributorAuthor

    Moved to v2.0.5 (owner-approved backlog groom, 2026-11-13): the borrow fixture false green.

  4. pithead-developer commented on Nov 14, 2026

    @pithead-developer
    ContributorAuthor

    Needs an operator action (do it, then remove the operator-action label):

    PR #3990 needs an owner-only rewrite of head branch agent/3972-e2e-borrow-never-moves-a-bench-s-own-roo from observed remote head c86210f88515f251689a89387ee48d2ec1a55365 onto develop before it can merge. Candidate preparation runs locally; its evidence will follow if available. Verify the candidate, target-base SHA, selected commits, check results and prior review coverage before publication. Publish only to the same PR head branch with an explicit lease on c86210f88515f251689a89387ee48d2ec1a55365, followed by the base change; if the remote head moved, stop and reassess. Preserve the existing PR discussion and review history; a replacement PR requires explicit owner approval. Keep this issue open; remove only the operator-action label after verifying publication. The rewritten head needs fresh checks and review, then any required owner approval; old PASS or approval evidence must not be carried to it.

  5. added
    operator-action
    on Nov 14, 2026
  6. pithead-developer commented on Nov 14, 2026

    @pithead-developer
    ContributorAuthor

    Candidate preparation for PR #3990 (owner publication still required):

    Owner action needed before merge: rewrite PR #3990's head in place so the branch targets develop. Published head branch: agent/3972-e2e-borrow-never-moves-a-bench-s-own-roo. Observed remote head, re-checked just now: c86210f. The PR is still open with base develop-v2.1.0 and nothing was pushed, force-pushed, re-based or replaced. Target base: develop at 452a33e. Candidate: local branch candidate/3972-on-develop in this repository, full SHA c1174a41504bd0dbab1c01516e3bdbf986f75ac0, six commits above that base. Selected commits, oldest first, each cherry-picked with -x from the published branch: 60aed91, 4bf1a24, e4f262f, 09282a3 and b3278a0. The sixth commit is new and is not covered by any earlier review: the clearnet-fixture half of the change called approval_restore_step and tests/os/approval-restore-output.py, which exist only on develop-v2.1.0 (#3807), so I ported the fixture to report the apply's exit status and a bounded tail from scripts/sanitize-test-log.sh, which develop has. The first cherry-pick also needed hand resolution in docs/dev/file-budget.tsv, integration-testing.md, testing-strategy.md and selftest-borrow-rearm.sh, where develop's text differs. Focused checks on the candidate: shfmt -i 4 and shellcheck clean on the six changed shell files; selftest-borrow-reload 12 passed; selftest-borrow-rearm 45 passed; appliance-node-runtime-leg --self-test and appliance-config-approval-leg --self-test passed; make lint-file-budget (base origin/develop) and make lint-pithead-build passed; no added comment lines beyond shebang and shellcheck pragmas. selftest-rotate-secrets shows 4 failures on this Mac, identical on untouched origin/develop, so not from this change. Existing evidence is for the published head only and must not carry over. Verifier passes: the first on 60aed91, the second on e4f262f, the third on the merged head 38ae5b6; the fix in b3278a0 was never re-reviewed. GitHub checks on c86210f: 52 pass, 2 skipped. Bench jobs, each at its own head: 855 and 498 at 4bf1a24, 871 and 323 at 09282a3, 599 and 521 at 38ae5b6, 907 (tier4-e2e) and 697 (tier4-kvm provision) at c86210f. The only red rows were owned by #2890, #3935 and #4113. Requested sequence: publish the candidate to the same head branch with an explicit lease on c86210f, then change the PR base to develop, keeping the existing discussion and review history. If the remote head has moved, stop and reassess. The rewritten head needs fresh GitHub checks, a fresh review and fresh tier-4 jobs, in particular tier4-kvm provision for the ported clearnet fixture, then any required owner approval. A replacement PR needs explicit owner approval.

  7. added
    operator-hold
    and removed
    operator-action
    on Nov 16, 2026
  8. removed
    operator-hold
    on Nov 27, 2026
  9. pithead-architect commented on Nov 27, 2026

    @pithead-architect

    Owner decision (2026-11-27): the earlier request to rewrite this work onto develop-v2.0.5 is cancelled, because bug and security fixes now go to develop. The open PR is redone on develop (rebase, conflicts fixed, fresh review); the prepared candidate is not force-pushed. This hold is lifted for that redo.

  10. added
    operator-hold
    on Nov 27, 2026
  11. pithead-architect commented on Nov 27, 2026

    @pithead-architect

    Held again for a few days, without an owner action: the owner's cancellation of the rewrite stands, and this PR will be redone on develop automatically (held until the 2.0.5 fold, or rebuilt on a fresh branch from develop with a replacement PR). This hold only stops wasted review passes until that change is live, and is lifted then.

  12. removed
    operator-hold
    on Nov 28, 2026
  13. pithead-developer commented on Nov 28, 2026

    @pithead-developer
    ContributorAuthor

    Hold lifted: the runner change for the owner's 2026-11-27 decision is live. A PR on the line that folds into develop waits for the fold and then retargets; a PR on a line that does not fold is rebuilt by the runner on a new branch as a replacement PR with a fresh review. No force-push.

  14. pithead-developer commented on Nov 29, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on p2pool-starter-stack/bench-ci#2830. PR #4621 is blocked on bench-ci#2830. Its tier4-e2e job on b14b71a (768) aborted at the telemetry schema row (schema drift in: worker_history) before rigforge-control, lifecycle and the re-arm could run. The cause is the bench's dashboard database: it still carries the columns that the previous job on that bench (766@014e5e7b, the #4542 branch) added. This PR changes no dashboard code. Until that database is restored, no e2e on the only bench that lends a pithead rig can show the re-arm and reconnect rows. Done so far: the self-borrowed rig's own pool is no longer renamed. The gate waits for that pool's rig-id, or its stratum user when it has none, because job 768 showed the pool has no rig-id. That change is head 1fa668f, with selftests green. KVM provision job 685 shows the reserved-node leg green after the redacted clearnet fixture; its only red rows are bench-ci#2747's. To clear this, bench-ci#2830 must be fixed or the bench's database restored; then a fresh tier4-e2e runs on 1fa668f.

    The runner resumes this issue when that one closes.

  15. added
    blocked
    and removed
    blocked
    on Nov 29, 2026
  16. pithead-developer commented on Dec 4, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4677. PR #4621 is blocked on #4677. Develop's tor image no longer builds: apk cannot find the pinned tor package. That fails Build image (tor) on every head, including this PR's head cde82f8, and tier-4 jobs are held until every GitHub check passes, so no e2e or KVM proof can run. bench-ci#2830 is fixed (the rig bench has passed the schema row since 12-01). Head cde82f8 fixes the verifier and security findings: an empty rig-id now gates on the stratum user, the gate name is never printed (it can be a payout address), the clearnet self-test checks the lock probe and a non-1 exit status, the failure row's newline is real, and scratch files are private. The selftests pass (16 and 45), the node-runtime self-test passes, and each new test fails when its fix is reverted. Shell tests (pithead suite, block 5) also failed one assertion outside this diff (a multi-line stamp is refused), which develop passed the same day; it needs a look after the develop merge. Once the tor build is green on develop (PR #4683 moves the pin), merge develop, confirm CI, then submit tier4-e2e targeted plus two tier4-kvm provision jobs on that head. The remote-rig half of #3972's last criterion cannot run, because no other bench lends a pithead rig.

    The runner resumes this issue when that one closes.

  17. added
    blocked
    on Dec 4, 2026
  18. pithead-developer commented on Dec 4, 2026

    @pithead-developer
    ContributorAuthor

    Correction: develop's tor build failure is fixed by PR #4683 (tor 0.4.9.18-r0), not by #4677, which tracks the pin-bump workflow token. This now waits on #4683. GitHub's blocked-by link can't point at a pull request, so the #4677 link is removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedbugtesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions