Skip to content

A worktree-built charly loads plugin binaries from the INSTALLED package's /usr/lib/charly/plugins — six weeks of API drift, and R9's binary-equals-source does not cover it #328

Closed

Description

@atrawog

What happens

A charly binary built from a worktree loads plugin binaries out of
/usr/lib/charly/plugins/ — the FHS path belonging to the system-installed package, which is
a different build of charly entirely. When the two disagree on the plugin API version, the run
emits an error pair per attempt and continues degraded:

[WARN]  charly.plugin: plugin failed to exit gracefully
[ERROR] charly.plugin: plugin process exited: plugin=/usr/lib/charly/plugins/plugin-secrets
        id=2245248 error="signal: killed"
warning: baked plugin /usr/lib/charly/plugins/plugin-secrets: connect: plugin client:
        incompatible API version with plugin. Plugin version: 1, Client versions: [2]

On this host the installed package is opencharly-git 2026.187.2228-1 (7 July); the worktree
binary is 2026.230.1238. Six weeks of API drift, and the dev binary reaches into the old one's
plugin directory without a word about the mismatch until a connect fails.

Why it is a product defect, not a dirty host

bakedPluginDir (sdk/deploykit/bake_plugins.go:36) exists so a DEPLOYED container — which has
neither a candy tree nor a Go toolchain — can still reach its baked providers. That is the right
mechanism for its case. What is wrong is that the same absolute path is consulted by a binary that
does have a candy tree and a toolchain, and that has no relationship to whatever produced those
files.

This collides directly with R9 (binary equals source). The point of building the worktree binary
and invoking it through that worktree's bin/ is that what runs IS what the tree says. A plugin
binary from an unrelated installation, six weeks stale, silently violates that — and unlike the
binary itself there is no charly version to catch it.

Severity: it is no longer silent

The bed diagnostics gate now fails a step whose log carries error-tier lines even under a zero
exit code. So this skew turns into a hard bed failure:

charly check run check-githubrunner-pod: [config] FAIL after 9.125s: config exited 0 but its log
  carries 2 error line(s)

check-githubrunner-pod reaches config and dies there, on a host whose only fault is an old
package. Three steps before it — image-build, check-image, deploy-add — all pass.

That is the gate working as designed, and it is also what makes this worth fixing rather than
tolerating: the failure is real, reproducible, and points at the wrong thing.

Two separable questions

  1. Should a non-installed binary consult bakedPluginDir at all? The candidate rule: consult
    it only when the running binary IS the installed one (os.Executable() resolving inside the
    package's own prefix), or when nothing else can provide the plugin. A worktree binary has its
    own plugin build path and should prefer it unconditionally.
  2. Should a recovered version mismatch log at ERROR? charly recovers — the run continues and
    config exits 0. The [ERROR] lines come from go-plugin's own logger for the killed child, so
    the mismatch is reported at a severity charly did not choose and does not mean. A skew charly
    handles should read as one line at warning tier naming both versions and the remedy, not as an
    error pair per attempt.

Reproduce

  1. Have an installed opencharly-git older than the worktree by at least one plugin-API bump.
  2. task build:binary
  3. ./bin/charly -C box/cachyos check run check-githubrunner-pod
  4. Observe: image-build / check-image / deploy-add PASS, config FAILs on the error lines above.
  5. pacman -Q opencharly-git and /usr/bin/charly version confirm the installed side (here it
    panics outright: duplicate command name "update" in command "CLI").

Related

Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)

Activity

  1. atrawog commented on Aug 28, 2026

    @atrawog
    ContributorAuthor

    Validation (2026-08-28) — STILL VALID, needs bed verification

    Verified against current charly main. plugin_loader.go still has bakedPluginDir = "/usr/lib/charly/plugins" and bakedPluginDirs() still returns $CHARLY_PLUGIN_DIR first, then the FHS path (lines 403-411). A worktree-built charly can still reach into the installed package plugin directory. The comment at :402 notes the mount-namespace masking idea was considered but not implemented.

    Full verification needs a live run of a worktree-built charly to confirm it loads from the installed path. Value: HIGH — this caused six weeks of silent API drift; dev integrity.

  2. atrawog commented on Aug 28, 2026

    @atrawog
    ContributorAuthor

    Final validation (2026-08-28) — VERIFIED LIVE (confirmed still valid)

    Live check with a fresh worktree-built charly (built from current charly main at a2cc84b8), strace of the plugin-dir access:

    $ strace -f -e trace=openat /tmp/charly-bin/charly version 2>&1 | grep 'usr/lib/charly/plugins'
    [pid 2871350] openat(AT_FDCWD, "/usr/lib/charly/plugins", O_RDONLY|O_CLOEXEC|O_DIRECTORY) = 4
    [pid 2871350] openat(AT_FDCWD, "/usr/lib/charly/plugins/generate-packages.providers", O_RDONLY|O_CLOEXEC) = 4
    [pid 2871350] openat(AT_FDCWD, "/usr/lib/charly/plugins/plugin-candy.providers", O_RDONLY|O_CLOEXEC) = 4
    ...
    

    The worktree-built binary opens /usr/lib/charly/plugins and reads the INSTALLED package's .providers files — the exact defect the issue describes. bakedPluginDirs() still returns $CHARLY_PLUGIN_DIR first, then the FHS path (plugin_loader.go:403-411).

    Status: VERIFIED — keep open. Value: HIGH (caused six weeks of silent API drift; dev integrity).

  3. atrawog commented on Aug 29, 2026

    @atrawog
    ContributorAuthor

    Closing: the fix landed and merged on main. Verified against the current state of main — the fix is present (see the validation comment for the specific evidence).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions