Skip to content

do: the per-leaf contract is read by every leaf and written by nobody — jobPlans.putContract has no caller on the live path #477

Closed

Description

@santoshkumarradha

Filed under the WIP freeze from #329's dead-road sweep (PR #469, which deliberately does NOT remove this); queued, not started. Possible defect on the live aforge do path.

What is true (dev at 2289427 and after)

jobPlans.putContract (cmd/aforge/chat.go) is the only writer into jobPlans.contracts, and nothing calls it:

staticcheck -checks U1000 -tests=false ./cmd/aforge/    # names jobPlans.putContract unused, at origin/dev

Its reader is live: takeContract (chat.go:3982 on dev 1978b34) → leafContract (chat.go:2456) → the Contract field handed to every leaf (chat.go:984); grep the names, line numbers drift. So on the aforge do path every leaf asks for its contract and can only ever receive "". Either the per-leaf working method (the contract the planner writes for a one-leaf job, as the surrounding prose describes it) is a feature that silently stopped being written when its writer's caller went — in which case leaves have been running without the working method the design says they get — or the map and its reader are a leftover and should go together.

This was not folded into #469 because deciding which is a judgment about a live behaviour, not dead code.

Replication

  • Static: the staticcheck line above at origin/dev.
  • Live: run a one-leaf aforge do errand on deepseek/deepseek-v4-flash and read the leaf's prompt/journal for its contract — expect the field empty.

Acceptance (one of the two, decided by the owner)

  • Written: the contract is written on the do path at the seam where the plan is settled, and a real-model run (flash) shows a leaf receiving a non-empty contract in its journal; a test pins the writer to the reader.
  • Removed: contracts, putContract, takeContract, leafContract and the leaf's Contract field go together, with any manual claim about a per-leaf working method removed in the same PR (manual law), and staticcheck -checks U1000 -tests=false ./cmd/aforge/ no longer names them.

Drafted with CodeAF · reviewed and owned by the author

Activity

  1. santoshkumarradha commented on Sep 10, 2026

    @santoshkumarradha
    MemberAuthor

    Consolidated into #817 — the tree tells the truth about itself. This issue's evidence and acceptance are reproduced there in full under its own heading; the lane that takes #817 takes this. Nothing is lost — this issue stays readable and #817 links back to it.

    All three end in the same place: a structural law test on the pull-request gate, plus the small change that makes the tree pass it. scripts/laws.sh finds a law by its go/ast/go/parser import and runs the lot in about twenty seconds, so a law written that way is on the gate the day it lands — which makes these one lane's afternoon rather than three open issues. Closed as part of the 2026-09-10 triage sweep; all three re-verified live at dev@95a0d0a9b (and #621's site count has grown from eleven to seventeen in the interval, with a second local re-spelling of utf8.RuneStart in internal/furrow).

  2. added
    bug
    area:headless
    on Oct 3, 2026
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

    area:headlessbug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions