The node says why it composes nothing of a want, and hands again what its agent waits for (issue 1966)

Every pass names each wanted module it made no composition of, with why (Pass.Unmade, the verb compose, one journal line per
change); a want not taken is said; the agent says once per want that it waits for the composer and why, and tells it, so a
composition the composer believed handed is handed again.

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-09 08:58:33 +01:00
parent 9b55bcb127
commit 5f37a43b91
7 changed files with 266 additions and 7 deletions
+28
View File
@@ -125,6 +125,11 @@ type Env struct {
Wants Watcher
Composed Watcher
Haves Haves
// WhyUnmade is why the node's composer composed nothing of a module at its want's fingerprint, from its last pass; empty
// when it says nothing. Nil says nothing. Waiting tells the composer the agent waits for the composition of a module at
// a fingerprint it holds none of, so a composer that believes it handed it hands it again. Nil tells nobody.
WhyUnmade func(module string) string
Waiting func(module, fp string)
// Apply applies one module's composition (scope NodeModule for the node's own), given the compositions the node's
// other modules run so a path, unit or group they hold is not removed or taken. It is called with one module at a
// time.
@@ -1319,6 +1324,26 @@ func (a *Agent) HoldsNode() bool {
return ok && h.Phase != nodeengineclient.PhaseRemoved
}
// waitsForComposer says once per want and reason that the agent waits for the node's own composition of module at fp, and
// why the composer made none (Env.WhyUnmade), and tells the composer (Env.Waiting) so it hands again what it believes it
// handed. Called without a.mu held.
func (a *Agent) waitsForComposer(module, fp string) {
why := "the composer has made none yet"
if a.env.WhyUnmade != nil {
if w := a.env.WhyUnmade(module); w != "" {
why = w
}
}
line := fmt.Sprintf("%s waits for the composer: no composition of it at %s: %s", module, fp, why)
a.mu.Lock()
first := a.said["composer:"+module] != line
a.sayOnce("composer:"+module, line)
a.mu.Unlock()
if first && a.env.Waiting != nil {
a.env.Waiting(module, fp)
}
}
func (a *Agent) settleOne(ctx context.Context, module string) {
a.mu.Lock()
w := a.wants[module]
@@ -1335,6 +1360,9 @@ func (a *Agent) settleOne(ctx context.Context, module string) {
a.mu.Unlock()
if a.env.SelfComposed {
if !have || comp.Err != nil {
if !have {
a.waitsForComposer(module, w.Want.Fp)
}
return // waits for the node's own composition of the want's build
}
// The composition the node composed for the want's build is the one it applies (ADR 0547 §2).
+20
View File
@@ -1935,3 +1935,23 @@ func testReconcileAppliesARunningModuleAgainAndLeavesTheHeldAndTheUnwantedAlone(
t.Fatalf("a failed apply was tried again with no edge: %v", got)
}
}
// Issue 1966 (novox, 2026-11-09): an agent that waits for its node's own composition of a want says so once, with why the
// composer made none, and tells the composer, which hands again what it believes it handed.
func TestAnAgentWaitingForTheComposerSaysSoOnceAndTellsIt(t *testing.T) {
b := newBed(t)
b.env.SelfComposed = true
var said []string
b.env.Say = func(s string) { said = append(said, s) }
b.env.WhyUnmade = func(string) string { return "no manifest in the composer's picture" }
var told []string
b.env.Waiting = func(module, fp string) { told = append(told, module+"@"+fp) }
a := New(b.env)
for range 2 {
a.waitsForComposer("web", fpOf("a"))
}
want := "web waits for the composer: no composition of it at " + fpOf("a") + ": no manifest in the composer's picture"
if len(said) != 1 || said[0] != want || len(told) != 1 || told[0] != "web@"+fpOf("a") {
t.Errorf("said %q, told %q; want %q once and web told once", said, told, want)
}
}
+5
View File
@@ -209,6 +209,11 @@ func (a *Agent) Composition(ctx context.Context, module, digest string, diff boo
case digest != "" && read == nil:
return view, fmt.Errorf("no revision of %s the bucket keeps has the digest %s; revisions lists those it keeps", key, digest)
case read == nil && !haveLatest:
if a.env.SelfComposed && a.env.WhyUnmade != nil && module != NodeModule {
if why := a.env.WhyUnmade(module); why != "" {
return view, fmt.Errorf("the bucket holds no composition of %s at %s; the agent waits for the composer: %s", module, fp, why)
}
}
return view, fmt.Errorf("the bucket holds no composition of %s at %s", module, fp)
case read == nil:
read = &latest