Skip to content

Move the harness env contract check from review to a linter #2217

Backlog

Description

@jflowers

Today the only thing that keeps a script's env var reads in line with its harness is PR review. When review misses one, the fix we reach for is more review: the retro agent files "the review agent should flag X", and X goes into prompt prose. I'd like to move this check into a linter that gives the same answer every time.

To be clear up front: the tool I want to use for it is ripwire, which is my project (redhat-et/ripwire). I think it fits here, but I should not be the only judge of that.

Who guards this today?

Review, and the record shows it is a leaky gate.

Not every one of these is something a Bash read check would catch. #1064 is a YAML naming mismatch and #1 was a bad path. They show the same pattern, though: the harness to script contract has no gate, so review carries it and sometimes drops it.

What would the linter check?

Both directions of the contract, for every pre_script and post_script:

ripwire gives the script side: ripwire --flags --json lists every Bash env var read with its form (required ${X:?}, with a default ${X:-y}, plain, and a few others) and where each var is written. It has no runtime dependencies. The harness side is env.runner, plus the sandbox env schema from fullsend-ai/fullsend#8679 for the sandbox.

What does it see on main?

I ran ripwire 0.7.0 on agents main at d33dcfa (2026-11-30) and matched each pre and post script (the .src.sh source plus the libs it sources) against its harness with a quick script.

  • 308 vars read across the 16 pre and post scripts. 33 reads are not named in their harness and not set in the script.
  • Many of those are false alarms from my matching. For example, REPO in pre-review.src.sh is most likely set by forge_parse_pr_url.
  • Some are by design. RETRO_JIRA_PROJECT is not in retro.yaml because operators supply it through a base: overlay (see docs/retro.md). So the linter needs a way to declare optional, operator supplied vars, or it will be noise.
  • ripwire skips the 16 generated .sh files, so the check runs on .src.sh and lib/.

So it needs tuning before it can block anything, which is why I'm proposing advisory first.

What am I proposing?

#1994 (from #350) adds scripts/harness-config-lint-test.sh for harness structural invariants. The env contract could be one more assertion there instead of a separate job. @tgeagle081, would you rather it go in #1994, or stay separate?

What if we don't want another binary in CI?

Extend the grep approach from #1665 to the pre and post scripts. It is less precise (no read forms, no write tracking), but it adds no new dependency.

Part of #2216. Related: #1665, #1738.

Is an advisory job worth a two week trial?

Activity

  1. fullsend-ai-triage commented on Nov 30, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 4:43 PM UTC · Completed 4:45 PM UTC

    Commit: d33dcfa · View workflow run →

    Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.15

  2. fullsend-ai-triage commented on Nov 30, 2026

    @fullsend-ai-triage

    Triage notes for maintainers:

    Decisions needed before implementation (not questions for the reporter):

    Scope and tuning: The reporter's trial shows 33 unmatched reads of 308, with known false-positive classes (vars set by sourced lib functions) and by-design operator-supplied vars. An allowlist/declaration mechanism and handling of .src.sh plus scripts/lib (not the generated .sh) are needed for the check to be usable. Related open work: #1738, #1061, #539 (could be closed by this), #1064.

    Workflow changes required: This needs a new or modified CI job under .github/workflows/. The code agent cannot modify workflow files under current permissions, so a human PR or maintainer action is required; auto-dispatch is skipped.

    Proposed test case:

    Fixtures for the checker:
    1. Script reads FOO; harness env lacks FOO; script doesn't set it -> reported.
    2. Harness supplies BAR; no script/skill reads it -> reported.
    3. Var set by a sourced lib function, or declared optional/operator-supplied -> not reported.
    4. Consistent script/harness pair -> no findings.
    5. Analyzer failure -> check fails visibly rather than passing silently.
    

    No open PR currently addresses this issue.


    Labels: This is a request for new CI capability rather than a defect, which matches the repository's enhancement label (New feature or request).


    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfeaturetriaged

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions