A module whose apply failed is no longer said to run what it ran (issue 1966, recovery)
mesh/delivery merged: source.main moved to novox/mesh-host@9b55bcb12743
mesh/delivery merged: source.main moved to novox/mesh-host@9b55bcb12743
On 2026-11-08 a failed apply of distribution's new build had already replaced its store container, yet the node-engine still held the old build as running, so the put back to it at 23:47 UTC was judged unchanged and applied nothing. A failed apply now marks what runs of the module failed, and a want of the composition that ran before is applied again. Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5
This commit is contained in:
+16
-1
@@ -1372,7 +1372,9 @@ func (a *Agent) settleOne(ctx context.Context, module string) {
|
||||
}
|
||||
a.mu.Lock()
|
||||
r, runs := a.running[module]
|
||||
runsWant := runs && r.Fp == w.Want.Fp && r.Composed == w.Want.Composed && r.Phase != nodeengineclient.PhaseRemoved
|
||||
// A module whose last apply failed runs no composition whole, whatever it ran before (ranFailed).
|
||||
runsWant := runs && r.Fp == w.Want.Fp && r.Composed == w.Want.Composed && r.Phase != nodeengineclient.PhaseRemoved &&
|
||||
r.Phase != nodeengineclient.PhaseFailed
|
||||
att, tried := a.attempt[module]
|
||||
same := tried && att.FP == w.Want.Fp && att.Composed == w.Want.Composed
|
||||
if same && att.Held {
|
||||
@@ -1598,6 +1600,9 @@ func (a *Agent) apply(ctx context.Context, module string, w wantNow, comp compNo
|
||||
if !res.Failed || res.Transient {
|
||||
delete(a.pulls, module)
|
||||
}
|
||||
if res.Failed {
|
||||
a.ranFailed(module)
|
||||
}
|
||||
what := fmt.Sprintf("%s at %s", module, fp)
|
||||
if module == NodeModule {
|
||||
what = "the node's own composition"
|
||||
@@ -1662,6 +1667,16 @@ func (a *Agent) apply(ctx context.Context, module string, w wantNow, comp compNo
|
||||
a.writeHave(ctx, Have{Module: module, FP: fp, Composed: dig, Phase: string(nodeengineclient.PhaseRunning), Detail: res.Detail})
|
||||
}
|
||||
|
||||
// ranFailed marks what runs of a module as failed once an apply of it failed (novox/hq issue 1966, 2026-11-08): a failed
|
||||
// apply may have replaced some of its resources (distribution's store container) before it stopped, so what ran is no
|
||||
// longer whole, and a want of it again (a put back) is applied rather than taken as running. Called with a.mu held.
|
||||
func (a *Agent) ranFailed(module string) {
|
||||
if r, ok := a.running[module]; ok && r.Phase != nodeengineclient.PhaseRemoved {
|
||||
r.Phase = nodeengineclient.PhaseFailed
|
||||
a.running[module] = r
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Agent) remove(ctx context.Context, module string, w wantNow) {
|
||||
a.mu.Lock()
|
||||
att := a.attempt[module]
|
||||
|
||||
Reference in New Issue
Block a user