Skip to content

RCA: the #717 multi-tag advisory is an authored-data defect (one bare ref pinned at incoherent tags), not a resolver bug #735

Closed as not planned

Description

@aitrawog

RCA — the #717 multi-tag advisory, its root cause, and the correct fix

1. What the advisory IS (mechanism, from source)

sdk/loaderkit/candy_version.go (PickCandyVersion) is the sole per-entity version arbiter.
It receives the candidate materializations of one BARE ref and emits the advisory only
when ≥2 candidates resolve to DIFFERENT git tags carrying DIFFERENT candy content
:

Warning: candy <bare-ref> resolved to multiple git tags with differing content;
         using newest <T1> (from <src1>), ignoring <T2> (from <src2>)

It is deliberately not a re-tag false-positive: identical content is silent
(candyContentsIdentical), and the winner is the newest CalVer tag. So every advisory in the
bed is a real cross-tag content divergence for one bare ref.

2. Why the candidates exist (the root cause)

loaderkit/refs_collect.go (CollectRemoteRefsOpts) is explicit:

"Collect EVERY distinct (repo, git-tag) a ref is referenced at. The git tag is only the
FETCH coordinate — per-entity-version arbitration happens AFTER fetch."

"Only the same bare ref at conflicting versions is an error."

The closure references github.com/opencharly/pod-dbus at three different explicit tags:

referenced at where (examples)
v2026.243.1831 charly/box/{arch,cachyos}/…, distro-cachyos/box/…
v2026.239.1555 distro-fedora/box/* (15 sites), distro-debian, distro-ubuntu, pod-kde-desktop
v2026.235.2115 layer-kde-shell, layer-libnotify, pod-dbus's own older consumers
bare (@github.com/opencharly/pod-dbus) charly/box/arch/charly.yml:1420 → newest = v2026.272.0105

Each becomes a candidate; the newest wins; the others are ignored → the advisory.

So the anomaly is the SOURCE, not the resolver: one bare ref is referenced at incoherent
tags across the closure.
This is an authored-data defect (R1), not a resolver bug. The
resolver is behaving exactly as documented and designed.

3. Why the obvious tools fail (measured)

charly box reconcile (plugin-box/candy/plugin-box/reconcile.go) aligns pins per project:

"For a multi-repo tree, run it per repo (e.g. charly -C box/<name> box reconcile)."

reconcileCandidateFiles walks only <dir>/charly.yml + <dir>/box/ + <dir>/candy/ — it
does not walk imported submodules. Hence:

  • default (reconcileTargetVersion(remote=false)): aligns to "the newest already-referenced
    version"
    within the one project — on a distro tree that references only v2026.239.1555,
    it is a no-op (already reconciled).
  • --remote: aligns every pin to the newest remote tag — which re-points every leaf
    pin, so those leaves' own closures then skew against the rest → the count EXPLODES
    (measured: distro-fedora 36 → 182 refs; distro-debian 2 → 12).

There is no closure-wide mode. The skew is cross-repo, so no per-repo tool can converge it.

4. The correct fix

Author the closure to reference each bare ref at ONE coherent tag. A targeted source
alignment across all owners of pod-dbus (and the other distinct-content refs), to a single
justified target tag — NOT a blanket --remote, NOT a per-repo reconcile. This is an
authored-data correction: the same logical dependency must name the same version everywhere.

Secondary (architecture, tracked separately):

  • Bare ref resolution diverges: charly/box/arch/charly.yml:1420 uses a BARE ref (resolves
    to newest remote v2026.272.0105) while every other site pins explicitly — so the bare site
    can never agree with the pinned ones. A bare ref and a pinned ref of the same repo are the
    same dependency and must resolve coherently.
  • Two independent "latest tag" implementations: refs.GitLatestTag (raw git ls-remote,
    used by reconcile --remote) vs the host's cached gitClient().LatestTag (1h TTL,
    disk-persisted) used for bare refs — same task, two code paths, different caching/freshness.

5. Non-band-aid acceptance

charly#733's assembled bed (check-commands-local) must reach errors: 0, warnings: 0
by SOURCE alignment. A waiver that accepts non-zero warnings does not satisfy this; neither
does suppressing the advisory in the resolver (that would hide a real divergence).

Activity

  1. aitrawog commented on Sep 29, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    6. OPERATOR RULING (severity) — supersedes the "align the whole source" emphasis

    If the dependency is resolvable, the multi-tag advisory is INFO, not WARNING.

    The resolver PICKS a candidate (newest CalVer wins) and resolution SUCCEEDS — so nothing is
    unresolved and no action is required. A Warning: must therefore be reserved for a genuinely
    unresolved/hard-conflict condition. Emitting a Warning for a success case is the defect: it
    makes a resolvable closure fail the R10 zero-warnings gate.

    Consequence for the fix (this is now the primary path, and it is NOT the ~105-ref wave):

    • Reclassify in sdk/loaderkit/candy_version.go: when PickCandyVersion has a deterministic
      winner (a resolvable set), emit an INFO-level diagnostic; emit a WARNING only when
      the set is NOT resolvable (no candidate / ambiguous / content undeterminable AND no winner).
    • The bed's warning counter then ignores it, and charly#733 passes errors:0, warnings:0
      WITHOUT a source-alignment wave.
    • ONE unified diagnostic path (single sink carrying a level), not a second side channel.

    Source alignment (one coherent tag per bare ref) remains DESIRABLE hygiene — it removes the
    info noise and makes the closure deterministic — but it is NOT the gate and is no longer the
    critical path. The gate is the severity fix.

    This is general, not pod-dbus-specific: resolvable ⇒ INFO; unresolvable ⇒ WARNING.

    Agent: coordination · session ses_f26225bfffferfo4tnJQw1ePqM
    Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  2. aitrawog commented on Sep 29, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    7. OPERATOR RULING — the version rule, restated CLEARLY (this is the authoritative spec)

    Two sentences:

    1. Winner = the newest REFERENCED version — among the versions actually referenced, never the newest remote tag.
    2. Scope = ONE BOX. That arbitration is used ONLY when multiple layers inside the same box point to different versions of the same layer.

    Consequences (the whole rule in a table):

    Situation Correct behaviour
    One box, two layers pin pod-dbus at different versions genuine conflict → use the newest referenced; note it (INFO — still resolvable)
    Two different boxes pin pod-dbus at different versions NOT a conflict — boxes are independent, immutable compositions → no notice at all
    One box, every layer pins the same version no notice
    A bare ref and a pinned ref resolve to different versions the bare ref must resolve to the newest referenced — never to newest-remote

    Why the bed is full of false warnings: the assembled closure contains MANY boxes (charly's boxes + every distro-* namespace). They legitimately pin pod-dbus at different tags (v2026.243.1831 in cachyos/arch boxes, v2026.239.1555 in fedora boxes, v2026.235.2115 in some layers). The resolver today keys candidates globally by bare ref, so those independent boxes look like one conflicting set → 1602 spurious warnings.

    The fix (two parts, both small):

    1. Scope the arbitration + any notice to within a single box — a cross-box version difference is not a conflict and must stay silent.
    2. Severity: within a box, if the newest-referenced wins and resolution succeeds → INFO, not WARNING. A WARNING is reserved for a genuinely unresolvable set (no candidate / no determinable winner).

    This means the critical path is the SDK scoping+severity fix — NOT the ~105-ref source-alignment wave. Alignment is optional hygiene.

    Refs: sdk/loaderkit/candy_version.go (PickCandyVersion), sdk/loaderkit/refs_collect.go (CollectRemoteRefsOpts, the global bare-ref keying). Related: #736 (two latest-tag paths), #737 (no closure-mode reconcile; bare vs pinned).

    Agent: coordination · session ses_f26225bfffferfo4tnJQw1ePqM
    Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  3. aitrawog commented on Sep 29, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    8. Exact fix location (verified in [email protected])

    loaderkit/scan_orchestrate.go:

    • :65 — candidates := make(map[string][]spec.CandyCandidate) // bare ref -> all fetched materializations
    • :124 — candidates[ref] = append(candidates[ref], spec.CandyCandidate{…})
    • :180-181 — for ref, cands := range candidates { winner := PickCandyVersion(ref, cands, seams.Warn) }

    The defect in one line: the candidate set is keyed by bare ref ONLY, so it merges the
    materializations from EVERY box in the assembled closure (charly's boxes + all distro-*
    namespaces) into ONE set. Independent boxes that legitimately pin different versions then look
    like one conflict → the ~1602 spurious warnings.

    The fix:

    1. Carry the referrer/box with each candidate (group by (box, bareRef), or record the
      referrer set per version).
    2. In candy_version.go (PickCandyVersion) / scan_orchestrate.go:181: only emit the
      diagnostic when ≥2 layers inside the SAME box reference different versions; cross-box
      differences are silent
      . Winner stays the newest referenced.
    3. Severity INFO (resolvable). WARNING only for a genuinely unresolvable set.
    4. ONE diagnostic path (single sink carrying a level) — no second side channel.

    This is an sdk change; charly then bumps its sdk require and #733's bed re-runs to
    errors:0, warnings:0. The ~105-ref source alignment is optional hygiene, NOT the gate.

    Agent: coordination · session ses_f26225bfffferfo4tnJQw1ePqM
    Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  4. aitrawog commented on Sep 29, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    9. DEEP RCA — the resolver resolves the whole PROJECT AT ONCE, not per box / per layer (CONFIRMED)

    The operator's hypothesis is correct and is provable in the code: there is no per-box or per-layer resolution scope anywhere in the path.

    Evidence ([email protected]):

    • loaderkit/refs_collect.go:336 — the collect walk iterates cfg.AllBoxNames() and calls collectBox for EVERY box, plus every base/builder edge (recursively into imported namespaces), plus every layer's require:/candy:, plus kind:local templates, plus add_candy. All of it funnels through ONE addRef.
    • refs_collect.go:262 — pairs := make(map[repoVer]map[string]bool) // (repo, git-tag) -> set of bare refs — one global map, keyed by (repo, tag), with no box/layer key.
    • scan_orchestrate.go:65 — candidates := make(map[string][]spec.CandyCandidate) // bare ref -> all fetched materializations — one global candidate set; :180-181 arbitrates it in ONE PickCandyVersion pass.
    • The resolver's own comment concedes the spuriousness: "Over-collecting them pulled unrelated candies pinned at a different ecosystem tag, which the one-candy-one-version invariant (tracker) then correctly — but spuriously — rejected."

    So the failure mode is structural: resolving the entire project (charly's boxes + every imported distro namespace) as ONE flat candy set makes boxes that are independent look like one conflicting box, and layers in different boxes look like layers in the same box. The arbitration is global because the SCOPE is global.

    The correct architecture (matches the operator's model):

    1. Resolve per box (and per layer within it): a box's candy closure is its OWN set.
    2. Within ONE box: if multiple layers reference different versions of the same layer → the newest referenced wins; note it as INFO (still resolvable).
    3. Across boxes: different versions are NOT a conflict → silent. A box is an immutable composition; two boxes are independent.
    4. Never consult the newest remote tag for this (that is --remote/bare-ref territory — see Duplication: two 'newest tag' code paths (raw git ls-remote vs the 1h-cached git client) — unify on the cached one #736/Alignment gap: box reconcile is per-project only (no closure mode); --remote worsens skew; bare vs pinned refs of one repo can never converge #737).

    Consequence: the ~1602 warnings are the signature of a global resolve, not a data defect to be swept. Fixing the SCOPE (per-box) + the SEVERITY (INFO when resolvable) is the fix; the source-alignment wave is not.

    This likely also explains the "over-collecting … pulled unrelated candies … spuriously rejected" note — the same global-scope root cause surfacing as a rejected set rather than an advisory.

    Fix location: the collect walk (refs_collect.go collectBox/pairs) must produce per-box ref sets (or the arbitration must carry the box), and scan_orchestrate.go must arbitrate per box — then candy_version.go emits within-box only. This is the sdk architectural change; charly then bumps and #733's bed re-runs.

    Agent: coordination · session ses_f26225bfffferfo4tnJQw1ePqM
    Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  5. aitrawog commented on Sep 29, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    FORMAL RCA (root-cause-analyzer 8-step) — consolidating §1–§9 above

    Step 1 — STOP

    Stopped the alignment work and both stale agents; no remediation attempted before analysis.

    Step 2 — Document exactly what's wrong

    Step 3 — Why

    • WHY: the resolution has no per-box scope — it resolves the whole project at once.
    • WHY now: the schema-versioning-removal cutover made the git tag the sole version authority; that exposed the pre-existing global scope that the authored per-entity version: field had masked.

    Step 4 — Investigate (charly verbs + source)

    Evidence in [email protected]: loaderkit/refs_collect.go:336 walks cfg.AllBoxNames()+all base/builder edges (recursing into distro-* namespaces)+every layer require/candy+kind:local+add_candy through ONE addRef → ONE pairs map (:262) → ONE candidates map (scan_orchestrate.go:65) → ONE PickCandyVersion pass (:181). The resolver's own comment concedes the spuriousness ("… spuriously — rejected").

    Step 5 — Hypothesis

    The ~1602 warnings are the SIGNATURE of a global (whole-project) resolve, not a data defect. Fixing the SCOPE (per box) + SEVERITY (INFO when resolvable) removes them; the alignment wave is unnecessary.

    Step 6 — Test

    The candidate map is provably global (bare ref -> all fetched materializations, no box key); the collect walk provably visits every box. The operator's cross-box pod-dbus pins (v2026.243.1831 cachyos/arch, v2026.239.1555 fedora, v2026.235.2115 layers) are independent compositions yet appear in ONE advisory set. Confirmed.

    Step 7 — ROOT FIX (eradicate, not band-aid — R4/R5)

    One unified, cleanly-architected version-resolution path:

    1. Scope to ONE BOX — arbitrate within (box, bareRef), never across boxes. Cross-box differences are silent.
    2. Winner = newest REFERENCED version (never the newest remote tag).
    3. Severity: resolvable ⇒ INFO; genuinely unresolvable ⇒ WARNING.
    4. DELETE the global-scope path (the defect) and the duplicate/band-aid siblings: the second latest-tag implementation (Duplication: two 'newest tag' code paths (raw git ls-remote vs the 1h-cached git client) — unify on the cached one #736), the per-project-only reconcile --remote non-convergence (Alignment gap: box reconcile is per-project only (no closure mode); --remote worsens skew; bare vs pinned refs of one repo can never converge #737). One code path, one sink with levels.
      Forbidden (band-aids): per-repo reconcile / --remote; suppressing the advisory; the ~105-ref alignment wave as the gate; a waiver.

    Step 8 — Verify completely

    charly#733's assembled disposable: true bed (check-commands-local) must reach errors: 0, warnings: 0 — fresh rebuild, from the final committed tree. That is the acceptance for the fix.

    Eradication scope (R3/R5): this is ONE core defect with a duplicated symptom path; the fix eradicates the global-scope resolution AND its duplicate latest-tag path in the SAME cutover — not a targeted patch.

    Agent: coordination · session ses_f26225bfffferfo4tnJQw1ePqM
    Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  6. aitrawog commented on Sep 29, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    STATUS

    DESIGN (posted before any edit) — per-box SCOPE + INFO/WARNING severity, the spike's measured result

    Spike (RDD, measured — not assumed). Traced the caller chain end-to-end on the committed tree + the
    predecessor worktree:

    • loaderkit/refs_collect.go CollectRemoteRefsOpts: pairs := make(map[repoVer]map[string]bool) keyed
      (repo, git-tag) — no box/layer key. The walk (cfg.AllBoxNames() -> collectBox -> base/builder edges
      recursing into imported namespaces -> layer require:/candy: -> kind:local -> add_candy) funnels through
      ONE addRef.
    • loaderkit/scan_orchestrate.go: candidates := make(map[string][]spec.CandyCandidate) keyed bare ref only;
      :181 arbitrates it in ONE PickCandyVersion pass. Confirmed: the candidate set is global.
    • Output shape (the spike's key question): the resolved set is a FLAT map[string]spec.CandyReader
      (ScanCandyFromLocal) consumed by deploykit.ResolveCandyOrder(img.Candy, layers, ...), which looks up
      layers[name] / layers[bareRef]. A per-box RESOLVED VERSION map would require threading a per-box map
      through ~40 layers[...] sites (a large change).
      The authoritative ruling table (two boxes -> silent; one box
      -> newest referenced + INFO) is satisfied WITHOUT it, because the project-wide newest-referenced winner is >=
      every box's own newest-referenced winner and a box never references the discarded lower tag directly. So the
      correct scope fix is diagnostic scope + winner = newest referenced, not a per-box closure.

    Architecture (ONE unified path, no side channel). A box is the SCOPE that owns a candy list. The ref
    collector already walks per-box (collectBox(c, name)); it labels each collected ref with the owning scope, the
    label travels with the fetch descriptor, and the arbiter reports only when >=2 references in one box disagree:

    1. refs_collect.go: carry a scope label per bare ref — box=<qualified-name> for a box's candy list, and
      box=<owning-box> for a layer's require:/candy: (resolved by the box's own candy closure, so
      "multiple layers inside ONE box" is exact); deploy=<word> for add_candy.
    2. spec.RemoteDownload.RefReferrers carries the labels to the post-fetch arbiter; spec.CandyCandidate.Referrers
      carries them onto each candidate.
    3. PickCandyVersion: winner stays the newest REFERENCED tag; emit a diagnostic ONLY when >=2 candidates
      share a scope label and their content differs; severity INFO (resolvable). WARNING only for a
      genuinely unresolvable set (no candidate). Cross-box differences are SILENT.
    4. ONE sink carries the level: spec.ScanSeams.Warn becomes Diag func(level DiagLevel, format, args)
      (DiagInfo/DiagWarning). plugin-build's diagWarnSink -> diagSink (level -> spec.Diagnostic.Severity,
      the EXISTING Diagnostics envelope — no parallel advisory API); build paths print "Notice:"/"Warning:" by
      level so a resolvable skew no longer trips the bed's severity scanner.

    Cross-repo shape (the spike's second finding). The seam type (spec.ScanSeams) and the carrier types
    (CandyCandidate, RemoteDownload) are spec-native, so this is a THREE-repo cutover, smallest-correct first:
    spec (enabling types) -> sdk (the fix) -> plugin-build (consumer). Each is one PR; each merges+tags
    before the next compiles against it. I bump nothing downstream (charly's pins + the umbrella gitlink are the
    parent's).

    Eradication (R3/R5, same cutover). refs_collect.go's global pairs map without a scope is deleted in
    place (no dead branch); the Warn seam, diagWarnSink and stderrWarn are DELETED (renamed to the
    level-carrying Diag/diagSink/stderrDiag). The duplicate latest-tag path (#736, refs.GitLatestTag raw
    git ls-remote vs the cached gitClient().LatestTag) is a SEPARATE spec change; it does not gate this bed (bare
    refs now resolve to the default branch, #318), so it lands as its own spec PR rather than being smuggled in —
    named here so it is not parked.

    Forbidden, not done: no suppression, no per-repo reconcile --remote, no source-alignment wave, no waiver,
    no dead transitional path.

    Agent: sdk-scope-fix · session ses_f128e8b6fffeZqfMHeAOHnJluh
    Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

    Agent: sdk-scope-fix · session ses_f128e8b6fffeZqfMHeAOHnJluh
    Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  7. aitrawog commented on Sep 29, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    STATUS — the sdk leg is MERGED; landing it in charly exposed a prerequisite (now filed as #738).

    leg state
    spec#186 ✅ MERGED v0.2026272.1512
    sdk#324 ✅ MERGED v0.2026272.1813 (PASS; per-box scope + INFO/WARNING; live mechanism bed green)
    charly ⛔ the pin bump does not build — a prerequisite leg

    The prerequisite (filed as opencharly/charly#738): bumping charly's sdk to v0.2026272.1813 pulls in sdk#288 (v0.2026271.915, 'require ctx on the deploy-config family') — a breaking context.Context-first-parameter change to deploykit (ResolveBoxEngineForDeploy, ResolveSidecarContainer, RestartPodService). charly's 63 compiled-in plugin-candy modules pin pre-ctx tags; 9 fail to build (plugin-box, -build, -check, -cmd, -fleet, -pod, -preempt, -substrate, -vm).

    This is a prerequisite exposed by the fix, not a new defect: #733's original sdk bump (.1147, no ctx) never exercised it; the #717 bump (.1813, with ctx) does. #738 is the named owner; it is the same consumer-fan-out class as charly#632.

    Unblock order: the 9 plugin candies adopt ctx + tag → charly bumps sdk/spec/the 9 plugin pins → #733's assembled bed re-runs to errors:0, warnings:0 → #714.

    The #717 root fix itself is COMPLETE and merged; only its consumption chain remains.

    Agent: coordination · session ses_f26225bfffferfo4tnJQw1ePqM
    Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

  8. self-assigned this
    on Oct 4, 2026
  9. aitrawog commented on Oct 7, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — superseded: closing this RCA, because the work it asked for landed and what remains is owned by a later, still-open issue.

    The remedy for this issue's authored-data defect merged as opencharly/spec#186 ("per-box candy-version scope + leveled diagnostics (INFO vs WARNING) (#735)", merged 2026-09-29) and opencharly/sdk#324 ("scope candy-version arbitration + notice PER BOX, INFO not WARNING (#735)", merged 2026-09-29).

    The residue is not cured by those two, and that is exactly why this closes rather than claims success: opencharly/charly#739 ("RCA: #717 is NOT fixed — 802 diagnostics (724 from a CONSTANT 'deploy=add_candy' scope label)", still open) shows the symptom survived the mechanism fix as a code bug, and it now owns the work. Closing here so the live finding has one home; if #739 lands and a further mechanism remains, reopen this thread rather than filing a third.

    Agent: dsh-issue-triage
    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions