Conversation
…tform-gate tests Four tests in tests/gateway/test_update_command.py call _handle_update_command without mocking subprocess.Popen, spawning a real detached 'setsid hermes update --gateway' against the running checkout. On detached-HEAD CI checkouts (every pull_request event) the update switches the tree to origin/main and the restore step is skipped when detached, silently poisoning every test process that starts afterwards. Repro: detach HEAD, run one of these tests, watch the reflog flip to main 60s later.
|
Thanks for the PR! One observation: PR description doesn't match the actual code changes The PR description describes a massive cognitive skill category — neurochemical states, graph memory, signed personality kernels, daemons, etc. — but the diff only contains a 26-line test fixture change in The actual cognitive skill implementation (the If the intent is just to add the test fixture (which prevents a real |
|
Thanks for taking a look! I think this observation landed on the wrong PR — the description here has only ever covered the |
|
Independent confirmation with hard evidence — this just bit #44433's Reproduced locally by running that shard's file list against a scratch checkout, with
On a The autouse-fixture approach here (patching |
…tform-gate tests Cherry-pick of upstream PR NousResearch#43298 (eazye19). The four TestUpdateCommandPlatformGate gate-pass tests spawn a REAL detached `setsid hermes update --gateway`; on CI's detached-HEAD checkout the fallback `git reset --hard origin/main` deletes branch-added test files minutes later, failing whichever shard is mid-collection (exit-4 "file or directory not found" flake). Carried here so the rollup CI stops tripping on it; drop when NousResearch#43298 merges upstream. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
check-attribution flagged support@captureclient.net, introduced by cherry-picking PR NousResearch#43298 onto this branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks for the focused report and the corroborating CI forensics in the discussion. This is an automated hermes-sweeper review; current
The equivalent protection shipped in |
What does this PR do?
Four tests in
tests/gateway/test_update_command.py(TestUpdateCommandPlatformGate: the DISCORD/MATTERMOST/HOMEASSISTANT registry-fallback tests and the TELEGRAM allowlist test) call_handle_update_commandwith nosubprocess.Popenmock. When the gate passes, the handler spawns a REAL detachedsetsid hermes update --gatewayagainst whatever checkout the tests run in.On a detached-HEAD checkout (which is what
actions/checkoutproduces for everypull_requestevent) the spawned update prints "switching to main for update", checks outmain, and the restore step is skipped becausecurrent_branchis the literal stringHEAD(hermes_cli/main.py, theif current_branch not in {branch, "HEAD"}guard). The working tree is silently left onmain, so every test process that starts after the spawn runs against the wrong code. The failures look like unrelated flakes in whatever tests happen to run later.This PR adds a class-scoped autouse fixture that mocks
gateway.run._hermes_home,shutil.which, andsubprocess.Popenfor the platform-gate tests, using the same mocking idiom the file already uses intest_spawns_setsid. Pure addition, no test logic changed.Related Issue
No existing issue found (searched PRs and issues for the test names and spawn behavior).
Type of Change
Changes Made
tests/gateway/test_update_command.py: newblock_real_update_spawnautouse fixture inTestUpdateCommandPlatformGate(+15 lines, addition only).How to Test
git checkout --detach HEAD~1(simulates a PR-event checkout).pytest 'tests/gateway/test_update_command.py' -k mattermost -q(passes), then wait ~60s.git reflog -3on current main showscheckout: moving from <sha> to mainand the tree is now onmain: the test spawned a real update. With this PR, step 3 shows no checkout and HEAD stays detached.pytest tests/gateway/test_update_command.py -q: 35 passed.Checklist
Code
Documentation & Housekeeping