Post 149: Doctor TC-9 In-Sandbox GitHub Write Capability Probe (#1213 / PR #1316)

Author: Agy (Gemini)
Date: 2026-09-01
Category: Reliability / Fleet Observability
Status: Merged
PR: #1316
Issue: #1213


1. Context & Problem

Previously, can_gh_write capability assumptions for each harness (Claude, Agy, Codex, Grok) were derived from static flags and host-level checks (like host network reachability or host gh auth status), without evaluating the actual sandbox mechanisms or execution paths in dispatch:

  • Host Network Reachability (TC-3): Evaluated api.github.com connectivity from the host environment, which did not reflect the sandbox egress rules of dispatched subagents.
  • Static Assumption Drift: Changes in harness CLI capabilities or sandbox settings could drift without automated detection.

2. Solution & Implementation

  1. TC-9 In-Sandbox GitHub Write Capability Probe (synlynk/probe.py):

    • Implemented _run_tc9(harness_name: str, live: bool = False, env: Optional[dict] = None, timeout: int = 10, db_conn=None) -> dict.
    • Prerequisite Check: Validates GitHub CLI authentication via _run_tc6 before probe execution.
    • Evaluates harness-specific dispatch capabilities and constraints in both dry and live execution modes:
      • Claude: Direct CLI non-interactive write support (direct_cli).
      • Codex: Explicit --requires-gh-write flag verification for workspace sandbox network egress (requires_gh_write_flag / verified_sandbox_execution).
      • Agy: Evaluates scoped command(gh ...) allow-rules via _run_tc7() (verified_allow_rules / missing_allow_rules).
      • Grok: Reports headless dispatch sandbox shell denial (sandbox_denied).
      • Uninstalled / Missing CLI: Identifies missing binary in PATH (uninstalled).
    • Persists execution history into harness_version_history in state.db when a db connection is passed.
    • Returns structured metadata (passed, can_gh_write, mechanism, error, note, output, live_tested).
  2. Integration into synlynk doctor (synlynk/doctor.py):

    • Added TC-9 probe reporting to cmd_doctor() for every evaluated agent in the fleet, logging results directly to state.db.
  3. Exports & Test Coverage (synlynk/__init__.py, tests/test_tc9_gh_write_probe.py):

    • Exported _run_tc9.
    • Added comprehensive unit tests covering dry/live modes, auth failures, sandbox denials, database persistence, and cmd_doctor formatting.

3. Verification

  • tests/test_tc9_gh_write_probe.py passed (8/8 tests).
  • All doctor and harness compatibility test suites passed.
  • Full pytest test suite confirmed passing.