Skip to content

Document compose/diff bidirectional invariant in contributing docs #841

Description

@guyoron1

What happened

On PR #5450, the code agent (run 29904860646) implemented field-level merge for validation_loop in compose.go and forge.go but did not update the corresponding DiffHarness/diffForgeConfig functions in diff.go. The triage agent (run 29904515735) had scoped the fix to only the merge side without mentioning diff.go. Neither agent read ADR-0045, which documents the bidirectional constraint. The multi-agent human review by waynesun09 caught this as a HIGH-severity round-trip regression affecting the migrate-customizations CLI command (ADR-0064). The resulting DiffHarness fix in iteration 2 then introduced a new bug, and after 6 fix iterations over 8 days the PR was closed without merge.

What could go better

The repo has no discoverable documentation of the compose/diff bidirectional constraint outside of ADR-0045, which (a) is buried in a long Consequences section, (b) inaccurately states that DiffHarness was "removed with the scaffold agent extraction" when it still exists in internal/harness/diff.go, and (c) is subject to immutability policy so agents may skip reading it for active guidance. Neither AGENTS.md nor any file under docs/contributing/ mentions the requirement that changes to merge functions in compose.go must be mirrored in the corresponding diff functions in diff.go. This means triage, code, and review agents all lack a reliable way to discover this constraint during their normal documentation reads. Confidence: High -- the triage and code agent logs confirm they did not read ADR-0045 or search for counterpart functions in diff.go.

Proposed change

Add a harness composition entry to the docs/contributing/ guidance table in AGENTS.md (or create a docs/contributing/harness-composition.md file referenced from that table) that documents the bidirectional invariant: changes to merge/compose functions (mergeBaseIntoChild, mergeForgeConfigInto, mergeForgeConfig, and their field-level helpers like mergeValidationLoop) must be mirrored in the corresponding diff functions (DiffHarness, diffForgeConfig, diffValidationLoop) in internal/harness/diff.go. The note should explain that these pairs support the migrate-customizations command (ADR-0064) and that breaking the round-trip property silently corrupts harness customizations during migration. Include a brief list of the current paired functions.

Validation criteria

The next code agent PR that modifies merge behavior in compose.go should also include corresponding changes to diff.go. Verify by checking the next 3 agent PRs touching internal/harness/compose.go -- at least those modifying merge logic should also touch diff.go or explicitly document why the diff side is unaffected.


Generated by retro agent from fullsend-ai#5450

Metadata

Metadata

Assignees

No one assigned

    Labels

    benchmark-pathBPath B benchmark issuespr-openAn open PR already addresses this issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions