gh shim: every Plexus and relay refusal explains what happened and whether a retry is safe

Merged
AF
11h ago
+1522-128

Every refusal the GitHub shim relays from Plexus or AFT's own relay now prints the operator-approved explanation: what happened and whether a retry is safe.

  • Explanations: each Plexus refusal_code and relay refusal maps to one approved line. All 72 table rows are pinned as independent literal strings, including the reach, actor and rerun suffixes.
  • Bypass hint: a not_governed refusal in a head shell adds the approved operator-bypass line. Worker shells never get a bypass hint, and their refusal lines stay exact.
  • Warming: module_warming retries once after 5 s with the same request ID, so the write goes out at most once. After that it refuses with the approved "nothing reached GitHub" text.
  • Plexus's own message: where Plexus sends detail.message (for example review_thread_not_own), it's shown through the vendored contract vectors and the real-shim wire test.
  • Unchanged: the fail-closed manifest check (#1120), the audited operator bypass (#1112), bot-speech binding selection (#1115) and -F @file reading (#1129). The branch is merged with current main.

Tests: gh_shim_relay_client_tests, gh_shim_speech/policy_tests, gh_shim_runtime_context_test and gh_shim_wire_goldens_test. Eight AFT-owned stderr exchange snapshots are updated to the approved wording. Plexus request and response bytes are unchanged.

The worker's final runs on Linux 12-core passed the gh_shim library tests, including both Landlock canaries, the wire goldens and the Windows compile check. My re-run on the merged branch was refused by a full build server, so this PR's CI is the gate.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Every refusal the GitHub shim relays from Plexus or AFT's own relay now prints an operator-approved explanation: what happened and whether retrying is safe.

  • Each Plexus refusal_code maps to one approved literal line, including reach, actor, and rerun suffixes; all 72 table rows are pinned as independent strings.
  • module_warming refusals retry once after 5 s with the same request ID so the write goes out at most once, then refuse with the approved "nothing reached GitHub" text.
  • not_governed refusals in a head shell add the audited operator-bypass hint (GH_SHIM_BYPASS=operator); worker shells never get it.
  • Plexus detail messages (such as review_thread_not_own) are preserved verbatim.
  • Existing behavior is unchanged: the fail-closed manifest check, audited operator bypass, bot-speech binding selection, and -F @file reading. Plexus request and response bytes are unchanged.

Tests

  • gh_shim_relay_client_tests, gh_shim_speech/policy_tests, gh_shim_runtime_context_test, and gh_shim_wire_goldens_test cover the new wording; eight AFT-owned stderr snapshots are updated.