← Back to Pull requests

v0.16 slice 2: gates via Agentic Dev contracts (agentic-dev#66) #2

Closed
unknown closed this pull request without merging on Oct 03, 2026 11:14 UTC
View on GitHub
unknown unknown commented on Oct 03, 2026 09:42 UTC
Author

v0.16 slice 2 (szaher/agentic-dev#66; tracking szaher/agentic-dev#33). AgentFlow consumes Agentic Dev's discovery and verification contracts (szaher/agentic-dev#69, merged as 725a7a4). Scope is limited to discovery and gates. Bootstrap blocks, doctor delegation, readiness/capability requirements, and worktree policy belong to later slices. Held for review before merge.

Merge bar


  • detected_commands and direct gate shell execution are gone. gates.py has no subprocess/run_command. A structural test fails if any AgentFlow module inspects package.json, pyproject.toml, go.mod, Cargo.toml, Makefile, or pnpm-lock.yaml, regrows detected_commands/commands_for, or imports agentic_dev.

  • Custom commands still work through Agentic Dev. config.gates[profile] becomes repeated agentic verify run --command … arguments. AgentFlow never invokes a shell itself; it passes each command intact as one argument (test_custom_command_is_passed_as_single_agentic_argument). Agentic Dev's host backend then runs it with sh -lc, by design.

  • The run-start SHA is durable. RunState.run_start_commit comes from git rev-parse --verify HEAD in _make_state() before any stage runs, and is None for an unborn repo. It's in history. Tests cover a save/load round trip, old state files without the field still loading, and the unborn case.

  • Returned JSON is schema-validated. Every consumed document (contracts, repo-inspection, verification-run) is validated against the schema the installed agentic ships (agentic contracts schema NAME); an invalid response raises and fails closed. jsonschema is now AgentFlow's runtime dependency. install.sh creates a private venv for it, and the README no longer claims there are no runtime dependencies.

  • Zero checks and missing required kinds fail closed. AgentFlow always requests every kind the profile requires; discovery never weakens the requirement. If any required kind has no command, Agentic Dev returns no-checks with missing_kinds, executes nothing, and the gate fails. Agentic Dev's status is authoritative: passed goes to on_success; failed and no-checks go to on_failure. A document with success: true but a status other than passed does not pass.

  • Installed-artifact integration test. tests/test_agentic_contract.py runs the real agentic that CI installs with pip install 'agentic-dev @ git+…@725a7a45…', never from PYTHONPATH. It's mandatory in CI (AGENTFLOW_REQUIRE_AGENTIC=1).
  • Design


  • agentflow/agentic.py is the only route to Agentic Dev. It invokes the CLI with argv and has no fallback.

  • - The first call is agentic contracts --json. It requires contracts@1, repo-inspection@1, verification-run@1 and the features commands.canonical-discovery, repo-inspection.discovered-commands, verification.full-kind-filter, verification.explicit-commands, and verification.no-checks-status.
    - It requires verification.change-aware only when augmentation is requested, and never runs agentic --version.
    - It accepts exit 1 from verify run as a result, but checks that the exit code agrees with status.
  • Profiles are defined by kind, and all of a profile's kinds are required and sent unchanged:

  • - fast: lint, test
    - standard: lint, typecheck, test
    - strict: build, lint, typecheck, test

    Agentic Dev decides whether each can be met, and runs every command of each kind or reports the missing ones. agentflow doctor shows which required kinds have no command yet; this is informational only and never changes the requirement. There is no attempt to reproduce the old per-language detector; the differences are documented under "Migration from the built-in detector" in the README.

  • Evidence is an AgentFlow envelope (run, stage, fingerprint, profile, passed, status, reason, plan) around Agentic Dev's unmodified agentic.verification-run document. The old GateResult flattening is removed.

  • A missing or incompatible verifier blocks the run with a reason instead of sending it back to implement.

  • Workflow gate stages are full-only. agentflow verify --include-changed passes --include-changed --base <run_start_commit>, omitting the base when there's no start SHA. The stage-metadata opt-in from the first draft is removed; pattern configuration is #68.
  • Tests (50; all pass locally against agentic-dev 725a7a4, none skipped)


  • Unit tests (FakeAgentic, which, like Agentic Dev, returns no-checks and runs nothing for any missing kind): every profile kind is sent unchanged; discovery never weakens the requirement (only test exists, so fast fails on missing lint); custom gates go via --command; empty custom gates fall back to the profile requirement; status is authoritative; the document is kept whole; augmentation passes the base.

  • Engine: an unavailable verifier blocks (no retry, no gate evidence); a missing required kind fails the gate; the start commit is recorded; evidence wraps the whole document; workflow gates never augment.

  • Client (a stand-in agentic executable that logs its argv): missing binary; an incompatible handshake failing before any verify run; --version never called; a missing jsonschema reported as itself; schema-invalid verification-run and repo-inspection documents failing closed; exit/status agreement; the custom command passed as a single argument.

  • CLI: verify --include-changed passes the stored SHA, and plain verify doesn't augment.

  • Contract tests against the installed agentic:

  • - the handshake;
    - a make check-only repo fails fast with missing_kinds: ["lint"] and checks_executed: 0, and make check is never run;
    - with every required kind present, make test, npm run test, and make lint all execute;
    - an explicit failing gate;
    - change-aware augmentation from the run base;
    - a docs-only repo failing standard with all three kinds missing.
  • CI also runs install.sh and checks its private venv.
  • Also in this PR


  • Bytecode cleanup. It stops tracking the 31 __pycache__/*.pyc files that #1 committed by mistake, and adds a .gitignore covering bytecode, build output, virtual environments, tool caches, and editor files.

  • Correction. An earlier description of this PR listed engine tests that weren't actually in the branch (a test-file edit had silently not applied). They're now present and listed above.
  • Packaging


    Runtime compatibility is decided by contracts and features only. CI pins Agentic Dev to the #69 merge commit because 0.15.0 on PyPI predates these contracts. When a release containing #69 is published, add agentic-dev>=<that release> to dependencies and drop the git pin.

    🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: szaher Review duration: 91m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%