Skip to content

v6.7 Part 3: dispatcher subprocess-honesty (#33, #34, #65) - #13

Merged
jarvis-stark-ops merged 2 commits into
mainfrom
kaipo/v6.7-subprocess-honesty
Jun 10, 2026
Merged

v6.7 Part 3: dispatcher subprocess-honesty (#33, #34, #65)#13
jarvis-stark-ops merged 2 commits into
mainfrom
kaipo/v6.7-subprocess-honesty

Conversation

@jarvis-stark-ops

Copy link
Copy Markdown
Collaborator

Summary

Three small infrastructure fixes that together close the gap between "the dispatcher's shell can do X" and "the worker subprocess can also do X". The 2026-06-09 v6.7 build chain hit all three failure modes — this PR ships the targeted fixes.

Independent of #11 and #12 (touches different code paths: worker spawn, respawn guard, block_task).

Closes hermes-jarvis#33 (GH_TOKEN propagation at worker spawn)
Closes hermes-jarvis#34 (respawn_guarded `active_pr` exempts review roles)
Closes hermes-jarvis#65 (fabricated github-auth block claims rejected)

NousResearch#33: GH_TOKEN propagation

`_inject_gh_token_into_env` is called just before each worker `subprocess.Popen` in `_default_spawn`. If neither `GH_TOKEN` nor `GITHUB_TOKEN` is set, fall back to `gh auth token` from the dispatcher's shell and inject the result. Silent on every failure (no `gh`, not logged in, timeout) — workers that don't need GitHub access are unaffected.

Closes the "subprocess can't see macOS-keyring-backed gh auth even though the dispatcher can" pattern that bit JARVIS umbrella + Tchalla release-gate + Tchalla v6.7 in three separate incidents in 48 hours.

NousResearch#34: respawn_guarded active_pr exempts review roles

`check_respawn_guard` skips the 24h `active_pr` guard for review-role tasks (tony, tchalla, vision, reviewer). Their entire job is to operate on PRs — a release-gate body legitimately cites the PR URL it is tasked to verify, and unblock comments often include the URL as evidence. The guard was a 17-tick `respawn_guarded` loop on a Tchalla re-review that only resolved when JARVIS kludged around it by spawning a duplicate card with the URL stripped from the body.

Non-review roles (jarvis, friday, etc.) continue to honor the guard.

NousResearch#65: fabricated github-auth block claims rejected

`block_task` adds a gate (mirrors completion-gate pattern from Parts 1-2): if the block reason matches `_AUTH_CLAIM_PATTERN` ("missing-github-auth", "gh auth login required", etc.) AND the dispatcher's own `gh auth status` succeeds, the block is rejected with `FabricatedAuthClaimError`. Task state unchanged; the worker has to surface the real cause.

Tchalla on 2026-06-09 blocked his review with "gh CLI not authenticated; cannot run gh pr diff 42" — except PR NousResearch#42 didn't exist and the dispatcher was authed the whole time. The gate would have rejected that block, forcing an honest cause.

The genuine subprocess-auth case (worker can't reach gh but parent also can't, e.g. `gh` not installed at all) is still accepted — gate only fires when the dispatcher itself IS authed.

Test plan

  • 24 new tests in `tests/cli/test_v6_7_subprocess_honesty.py` covering all three issues
  • 47 passed / 0 failed across Part 3 + adjacent worker_exit_code + oneshot_runtime_fallback + dispatcher_heartbeat tests — zero regressions on related paths
  • After merge: spawn a worker that calls `gh pr list` to confirm injection works in production
  • After merge: re-run a swarm chain on a Tchalla re-review to confirm respawn_guarded exemption + fabricated-auth gate work end-to-end

🤖 Generated with Claude Code

Jarvis and others added 2 commits June 9, 2026 15:44
Three small infrastructure fixes that together close the gap between
"the dispatcher's shell can do X" and "the worker subprocess can also
do X". The 2026-06-09 v6.7 build chain hit all three failure modes —
this PR ships the targeted fixes.

Closes hermes-jarvis#33 (GH_TOKEN propagation at worker spawn)
Closes hermes-jarvis#34 (respawn_guarded active_pr exempts review roles)
Closes hermes-jarvis#65 (fabricated github-auth block claims rejected)
Context: hermes-jarvis#61 (bootstrap-paradox case study)

## NousResearch#33: GH_TOKEN propagation

`_inject_gh_token_into_env` is called just before each worker
subprocess.Popen in `_default_spawn`. If neither `GH_TOKEN` nor
`GITHUB_TOKEN` is set, fall back to `gh auth token` from the
dispatcher's shell and inject the result. Silent on every failure
(no `gh`, not logged in, timeout) — workers that don't need GitHub
access are unaffected.

Closes the "subprocess can't see macOS-keyring-backed gh auth even
though the dispatcher can" pattern that bit JARVIS umbrella + Tchalla
release-gate + Tchalla v6.7 in three separate incidents.

## NousResearch#34: respawn_guarded active_pr exempts review roles

`check_respawn_guard` now skips the 24h `active_pr` guard for review-
role tasks (tony, tchalla, vision, reviewer). Their entire job is to
operate on PRs — a release-gate body legitimately cites the PR URL it
is tasked to verify, and unblock comments often include the URL as
evidence. The guard was a 17-tick `respawn_guarded` loop on a Tchalla
re-review that only resolved when JARVIS kludged around it by spawning
a duplicate card with the URL stripped from the body.

Non-review roles (jarvis, friday, etc.) continue to honor the guard.

## NousResearch#65: fabricated github-auth block claims rejected

`block_task` adds a gate (mirrors completion-gate pattern from Parts
1-2): if the reason matches `_AUTH_CLAIM_PATTERN`
("missing-github-auth", "gh auth login required", etc.) AND the
dispatcher's own `gh auth status` succeeds, the block is rejected
with `FabricatedAuthClaimError`. Task state unchanged; the worker has
to surface the real cause.

Tchalla on 2026-06-09 blocked his review with "gh CLI not
authenticated; cannot run gh pr diff 42" — except PR NousResearch#42 didn't
exist and the dispatcher was authed the whole time. The gate would
have rejected that block, forcing an honest cause.

The genuine subprocess-auth case (worker can't reach gh but parent
can't either, e.g. `gh` not installed at all) is still accepted —
gate only fires when `_dispatcher_gh_is_authed()` returns True.

## Tests

24 new tests in `tests/cli/test_v6_7_subprocess_honesty.py`:
- TestInjectGhToken (7) — existing env, gh not installed, returncode
  nonzero, empty stdout, timeout, normal injection
- TestRespawnGuardExemption (6) — tchalla/tony/vision with PR URL
  pass, jarvis/friday with PR URL still guarded, review role
  without URL passes
- TestReasonClaimsMissingGhAuth (6) — pure pattern matcher
- TestBlockGate (5) — fabricated rejected, genuine accepted, non-
  auth pass-through, empty reason skip, audit event recorded

47 passed across Part 3 + adjacent worker_exit_code + oneshot_runtime
+ dispatcher_heartbeat tests — zero regressions on related paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nded respawn exemption

Self-review of PR #13 surfaced two P1 issues that this commit fixes
together.

## P1 — _AUTH_CLAIM_PATTERN was too permissive

The original regex matched any occurrence of an auth-claim phrase
within the reason — including the EXACT honest cause workers should
surface. Specifically:

  "investigated: gh CLI is authenticated; the real issue is that
   PR 42 doesn't exist"

This was a false positive: the gate would reject the worker's honest
diagnosis. Other false positives included documentation mentions
("gh auth login is needed in setup docs") and handoff-context
mentions ("used gh auth token earlier in the task").

Fix: anchor the pattern to the LEADING substring of the reason
(optionally after a `cause:`/`blocker:`/`reason:`/`infra:` prefix).
The 2026-06-09 Tchalla case ("missing-github-auth: gh token for ...")
still matches; the honest diagnosis above no longer does.

7 new tests in `TestAuthClaimNotLeading` lock in the contract.

## P1 — Respawn exemption was unbounded

The review-role exemption in `check_respawn_guard` correctly stopped
the 17-tick `respawn_guarded` loop, but it had no upper bound — a
flapping review profile (crashes-fast-each-attempt) could respawn
unconditionally on the URL signal, burning tokens until the
auto-block path noticed.

Fix: the exemption only applies while consecutive_failures <
max_retries (the same brake every other path observes). Once the
breaker is exhausted, fall through to the `active_pr` check and let
auto_block catch it shortly after.

2 new tests in `TestRespawnExemptionBounded`:
- Under-limit review stays exempt (existing behavior preserved)
- At-limit review falls through to active_pr (new bound enforced)

## Tests

33 passed in tests/cli/test_v6_7_subprocess_honesty.py — up from 24
in the original PR #13 (9 new). Zero regressions on adjacent paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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