Skip to content

prescan declares kind words from transitively imported projects that the connect leg's candy map never contains — a declared word that can never connect #1341

Backlog

Description

@aitrawog

Category

category:runtime

Type

type:fix

Remedy / files the remedy will touch

charly/plugin_prescan.go prescanDeclaredPluginWords / prescanImportedProjectEntries / prescanDiscoveredPluginManifests vs connectDeclaredKindsFromProject's ScanAllCandyWithConfigOpts candy map: one shared definition of which candies a project's kind words come from

Cited design decision or org-rulebook rule (or none)

AGENTS.md C4 (two definitions of one set: the declared-word scope and the connectable-candy scope)

Classification

Non-blocking — genuinely separable; left unclaimed for a later session to pick up.

Evidence (verified: commands with output, file:line, measurements)

Same command and throwaway build as #1340. The openwebui registration traced with its call stack (registerDeclaredKind, charly/plugin_prescan.go:140):

$ sort cl-reg.reg | uniq -c
      6 main.prescanPluginManifestData:786 main.prescanDiscoveredPluginManifests:518 main.prescanProjectDir:602 main.prescanImportedProjectEntries:564 main.prescanProjectDir:603 main.prescanImportedProjectEntries:564 main.prescanProjectDir:603 main.prescanImportedProjectEntries:564 main.prescanProjectDir:603 main.prescanImportedProjectEntries:564 main.prescanDeclaredPluginWords:479 main.hostWalkSe…
     13 main.prescanPluginManifestData:786 … (one import level deeper) …

The word arrives through 4-5 levels of import: and a discover: tree. Neither the charly repo nor any of the 12 directories the walk actually loads declares it:

$ grep -rn --include='*.yml' 'plugin-openwebui' <charly worktree, minus .check/.build>
(no output)
$ for d in <the 12 walked dirs>; do grep -rl --include=charly.yml 'kind:openwebui' "$d"; done
(no output)

The connect leg then finds no candy for it: openwebui connected=false err=<nil> on all 53 passes.

Mechanism

prescanDeclaredPluginWords walks the root's discover tree and recursively every imported project's discover tree, registering every kind word any discovered candy's plugin.providers names. connectDeclaredKindsFromProject connects only candies in the project's scanned candy map (ScanAllCandyWithConfigOpts). A candy discovered only inside a transitively imported project is in the first set and not the second, so its word is declared, required at every boundary and never connected.

Missed control

Nothing asserts that every declared kind word is connectable from the same project. finalizeDeclaredKindConnections turns the mismatch into a silent 'did not register' record instead of a finding.

Blast radius

Any project whose import graph reaches a project that discovers a kind plugin it does not itself compose. Combined with charly#1340, every charly command in such a project pays two full loads per walk boundary.

Root fix

Derive both sets from one closure: the declared-word prescan reads the same candy closure the connect leg scans, or the connect leg resolves the candy that declared the word by its ref. Add a test where an import declares a kind its root never composes: the word is either connected or never declared.

Spike (its result, or none with the reason)

none for this mechanism's own fix: there are two plausible scopes (restrict the prescan to the closure the connect leg scans, or widen the connect leg to the prescan's reach), and choosing between them needs the D-LAW plugin-scope decision. The impact is already spiked in #1340: memoizing the failed attempt cut one charly config from 82 s to 26 s with a byte-identical unit.

Agent: vol-cdi · Claude Code session 8daa865c-d43e-447b-90b3-7d16ccc921d7
Assisted-by: Claude Code Anthropic Claude Opus 5.5 (analysed on a live system)

Activity

  1. added
    category:runtime
    type:fix
    on Dec 2, 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

    category:runtimetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions