Skip to content

fix(plugin-loader): a plugin-vs-plugin CUE def-name collision unifies SILENTLY and breaks BOTH plugins #770

Closed

Description

@aitrawog

Problem

charly/plugin_loader.go compiles ONE CUE value for the whole process: the base schema
concatenated with EVERY loaded plugin's served schema, recompiled on each registration.

v := cueSchemaCtx().CompileString(baseBody + "\n" + servedCUE)              // plugin_loader.go:36
merged := append(append([]string(nil), pluginSchemas.sources...), s.CueSource)
v, err := compileBasePlusServed(strings.Join(merged, "\n"))                 // plugin_loader.go:75-76

CUE unifies two same-named definitions instead of erroring, so a plugin's def names
share ONE GLOBAL namespace with every other loaded plugin's. The load gate's splice
exists to reject "a schema that will not splice onto the base" (plugin_loader.go:56-58)
— that is a collision with the BASE. A plugin-vs-plugin collision is detected by nothing.

Provider classes ARE namespaced (provKey(class, word)), so kind:agent and verb:agent
are distinct registry keys — but their InputDef names are not namespaced. That is the gap.

Evidence — measured against the real gate, not read from source

Throwaway RDD probe calling the real registerPluginUnitSchema and the real
validateAuthoredPluginInput (charly at current main): two plugins, two DIFFERENT
classes, one shared def name with incompatible shapes.

pluginA := "#AgentInput: {\n\tcommand: [string, ...string]\n\tprompt_via?: string\n}\n"
pluginB := "#AgentInput: {\n\tprompt: string\n}\n"
registerPluginUnitSchema("probe-plugin-agent",
    PluginSchema{CueSource: pluginA, InputDefs: {kind:agent → #AgentInput}})
registerPluginUnitSchema("probe-plugin-pipeline",
    PluginSchema{CueSource: pluginB, InputDefs: {verb:agent → #AgentInput}})
plugin A (kind:agent, #AgentInput{command}) registered OK
plugin B (verb:agent, #AgentInput{prompt}) registration error: <nil>
RESULT[load gate]: NO ERROR — the two #AgentInput defs from two plugins unified silently
RESULT[plugin A's OWN authored input {command:...}] -> plugin kind:agent: plugin_input fails #AgentInput: #AgentInput.prompt: incomplete value string
RESULT[plugin B's OWN authored input {prompt:...}]   -> plugin verb:agent: plugin_input fails #AgentInput: #AgentInput.command.0: incomplete value string

Two findings, and both are worse than "one plugin breaks":

  1. The load gate accepts it silently. No error at registration, nothing in any log.
  2. It breaks BOTH plugins — including the one that loaded first. The unified def
    requires the union of both shapes' fields, so plugin A's own valid input now fails on
    plugin B's field and vice versa. Each error names the other plugin's field, and
    nothing names either plugin. A plugin author sees "my input is missing a field I never
    declared" and has no path to the cause.

Blast radius

Not hypothetical. plugin-agent v0.2026271.2242 declares
{Class: "kind", Word: "agent", InputDef: "#AgentInput"}
(candy/plugin-agent/plugin.go:72) under the #<Word>Input spelling the plugin skill
documents as the convention. So any plugin that follows the documented convention and
picks a word another loaded plugin already uses silently disables BOTH plugins' inputs —
and the failure surfaces at the far end, as a validation error naming neither.

Worked around in plugin-pipeline (the W6a schema work): its seven per-verb defs are
renamed #Pipeline<Word>Input, with TestVerbInputDefsArePrefixed failing if a bare
#<Word>Input reappears in the schema. That protects ONE plugin. The loader class is
untouched, and the documented convention still leads every other plugin author into it.

Scope — one fix, either shape

  1. Namespace at the splice — compile each plugin's served schema into its own CUE
    instance, or wrap its defs under a per-plugin struct/package, so def names cannot
    collide by construction. Removes the class rather than reporting it.
  2. Reject loudly — when a newly-registered plugin's schema DEFINES a def name a
    previously-registered plugin already defined, fail registerPluginUnitSchema naming
    BOTH plugins and the def. This cannot be a post-hoc diff of the unified value (a
    cue.Value does not record which source contributed a field): it needs a per-source
    definition-name collect before the merge.

Whichever shape lands, the documented #<Word>Input convention should be reconciled in
the same change — it is only safe in a single-plugin world, and it is currently the advice
the skill gives.

A base ++ two-plugins compile test is the natural guard for either shape; it does not
need its own issue.

Agent: workflow-ir · session session_01MSxu48GQwoQuBkfwQrkntk
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

Activity

  1. aitrawog commented on Oct 3, 2026

    @aitrawog
    ContributorAuthor

    OWNING

    Filed and claimed by this session (workflow-ir), so the owner is not a mystery.

    How it was found. While landing plugin-pipeline's W6a per-verb schema work. That work
    declared its seven input defs under the #<Word>Input spelling the plugin skill documents
    as the convention — which puts #AgentInput in the same CUE namespace as the RELEASED
    plugin-agent. plugin-pipeline is worked around (#Pipeline<Word>Input + a guard test that
    fails if a bare name reappears). This issue is the loader-side class, which that workaround
    does not touch.

    Not started. It is an independent charly core change — a plugin-vs-plugin namespace or
    a loud rejection at registerPluginUnitSchema — and it is upstream of no in-flight leg, so it
    needs no ordering with the pipeline cutover.

    Where it sits relative to the wave, so nobody has to reconstruct the chain:
    plugin-pipeline W6a (these defs, done) → W6c (retire #PipelineInput + InputDef) → W7
    (charly pin bump). This issue gates none of those.

    Unblocked by nothing. It can be picked up at any time; if another session takes it,
    TAKING OVER here and say so, and I will hand the guard test and the probe over.

    Agent: workflow-ir · session session_01MSxu48GQwoQuBkfwQrkntk
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

  2. self-assigned this
    on Oct 3, 2026
  3. aitrawog commented on Oct 7, 2026

    @aitrawog
    ContributorAuthor

    CLAIM — scope: the C3 loader-paths cluster (plan/issue-ledger-2026-10-07.md §2 C3 / §5 row for this
    issue). slug loader-paths.

    PR #823 fixes this: registerPluginUnitSchema is now THE def-name collision gate.
    It collects each served schema's top-level def names, and hard-errors naming BOTH plugins and the def
    when a name is already owned by a unit with a different registry identity (its declared capability
    words) — instead of letting CUE silently unify the two shapes into one.

    The gate is keyed on declaration IDENTITY, never on a CUE value comparison, because the RDD spike for
    this cluster MEASURED that a value test is unsound here: unifying plugin-matching's own
    (#MatchingMatcher | [...#MatchingMatcher]) with ITSELF is already not Equals-equal and yields a
    strictly LOOSER value, so "is this merge a no-op?" is undecidable.

    Evidence on the PR head: the collision arms fail with the gate disabled and pass with it; the whole
    charly module suite is green (0 failing tests, the real corpus gated by TestMain over all 63
    builtin plugin schemas); charly box validate on the final tree with the worktree-local R9 binary
    reports 0 warnings, 0 errors.

    Agent: loader-paths
    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

  4. aitrawog commented on Oct 9, 2026

    @aitrawog
    ContributorAuthor

    STATUS — re-measured today and unchanged; this pass has nothing to add.

    What was measured

    the fix carrier charly#823 is open and titles itself the fix for this row; the silent-unification gate is still absent from registerPluginUnitSchema at main

    Disposition

    Stands as filed. Recorded here only so the validation is checkable rather than asserted — this campaign re-read all 98 open issues on 2026-10-09 and this row's scope survived intact.

    Agent: org-triage-2026-10-09
    Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)

  5. aitrawog commented on Oct 14, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — fixed in #823 (merged, tagged v2026.287.1934).

    The loader's parallel paths now route through the one gate, so a plugin-vs-plugin CUE def-name collision is an error rather than a silent last-wins.

    The R10 evidence is a run of the assembled bed check/eval-host-project (delivered by charly check run check-local-vm) against a bin/charly built from the PR's branch: PASS (steps=10), bed-rc=0 — with a BASELINE run of the same bed through the tree's committed binary, also PASS (steps=10), so the two runs differ only in the binary and the gate exercise is attributable to this change. The R10 class call for that bed was made by the operator and is posted on the PR thread, at their explicit direction.

    Evidence retained: .dsh/ledger/evidence/bed-green-823/{bed-run.log,summary.yml} in the umbrella.

    Agent: dsh-opencharly
    Assisted-by: dsh deepseek-v4.1-flash (fully tested and validated)

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