Skip to content

refs.DownloadRepo populates every declared submodule, so a repo with submodules cannot be a corpus source (the umbrella is one) #279

Closed

Description

@aitrawog

The defect

sdk/candywalk's corpus walk resolves every @github.com/opencharly/... ref through
spec/refs.DownloadRepo, and DownloadRepo calls populateSubmodules — which initializes every
submodule the fetched repo declares
and fails the whole fetch when one cannot be reached. That is
correct for --repo (a whole project a user drives with the charly binary), and fatal for a
corpus-source fetch, which needs only the repo's own files (its charly.yml and .agents/ trees).

Measured in CI, on opencharly/marketplace#566, pinning opencharly/opencharly at a tag:

$ charly marketplace generate --root . --out .
charly: resolving github.com/opencharly/opencharly:v2026.296.2037 (222 resolved, 1175 queued)
Downloading github.com/opencharly/opencharly:v2026.296.2037...
charly marketplace: collect entities: resolve @github.com/opencharly/opencharly:v2026.296.2037:
  downloading github.com/opencharly/opencharly:v2026.296.2037:
  populating submodules in /home/runner/.cache/charly/repos/github.com/opencharly/[email protected]:
  exit status 128
fatal: could not read Username for 'https://github.com': terminal prompts disabled
fatal: clone of 'https://github.com/opencharly/charly-registry' into submodule path
  '.../charly-registry' failed
error: could not write config file .../.git/modules/pod-osm-tools/config: No such file or directory
fatal: could not set 'core.worktree' to '../../../pod-osm-tools'
rc=1

Two independent submodules kill it — one needs credentials the CI runner does not have
(charly-registry), one fails on a path that no longer exists in its own .git/modules
(pod-osm-tools) — and populateSubmodules turns either into a failed corpus walk.

Why it blocks

A skill lives with the code, plugin or config it describes (umbrella AGENTS.md Part II #5), and the
umbrella is the only home the three GENERAL-GUIDANCE skills have (agents, cutover-policy,
root-cause-analyzer). It cannot be the corpus source for them while a repo with submodules cannot be
fetched for its own files. Locally the fetch appears to work because the cache already holds a
populated copy — so this defect is invisible until the gate runs on a cold runner, which is exactly
where it surfaced.

Mechanism (read from the code)

spec/refs/git.go
  268: // populateSubmodules initializes EVERY submodule a freshly-fetched repo declares.
  ...
  func populateSubmodules(targetDir string) error {
      ... git submodule update --init --depth 1 -q ...
      return fmt.Errorf("populating submodules in %s: %w", targetDir, err)

DownloadRepo has no way for a caller to say "files only". The corpus walk is a caller that wants
exactly that: it reads a manifest and a skills tree, never a submodule.

Root fix (one of)

  1. A fetch MODE on the downloader — DownloadRepo(repoPath, version string, opts …FetchOption) with
    FilesOnly(), or a sibling DownloadRepoFiles, threaded through candywalk.RemoteResolver (which
    is already a caller-supplied seam) and used by the two out-of-process generators. Corpus sources are
    fetched files-only; --repo keeps populating submodules.
  2. A per-ref opt-out — the pin contract gains a marker (e.g. a files-only ref form or a
    corpus: wrapper) so a corpus generator can name a repo it needs only the tree of.

(1) is the smaller contract change and keeps the --repo semantics that populateSubmodules was
written for.

Missed control

The corpus walk's own resolver seam was assumed to be "just a fetch". Nothing exercised it against a
repo that declares an unreachable submodule, so the failure mode was unrepresented in every test: the
walk's fixtures are local directories, and the cached fetches are warm. A cold-runner arm over a
submodule-bearing repo would have caught it before a PR.

Related

  • opencharly/sdk#455 / opencharly/sdk#467 — the sibling producer defect on the same corpus walk (the
    raw-text ref scan).
  • opencharly/opencharly#600 — the skills migration whose last structural step (the umbrella as a
    corpus source) waits on this.

Agent: charly

Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (analysed on a live system)

Activity

  1. aitrawog commented on Oct 23, 2026

    @aitrawog
    ContributorAuthor

    CLAIM — spec#279 is mine: a files-only fetch mode in spec/refs, then the corpus-source chain. Slug charly-spec279.

    Scope I take, producer-first: spec/refs gains the files-only fetch (DownloadRepoTrees + a mode-keyed cache entry + a cache predicate that certifies a tree export) → PR → merge → tag; then plugin-marketplace adopts it for the corpus generator (refs.DownloadRepoTrees in readkinds.go) → PR → merge → tag; then marketplace refs PR adds opencharly/opencharly as a DIRECT ref + regenerates, with the drift gate green on a cold CI run.

    Candidate chosen and why (statement now, evidence in the PR): the issue's candidate 1, as a SIBLING function rather than an options type, because the criterion is certify exactly what the reader needs: candywalk.RemoteResolver is func(repoPath, version string) (string, error), so a sibling with that exact signature threads through the existing seam with no sdk change at all, while DownloadRepo keeps the --repo semantics populateSubmodules was written for. The files-only export gets its OWN cache key (<repo>@<version>.tree), because content determines the key: a tree export is not a valid --repo cache and a populated export is a superset, so sharing one key would make each caller re-download the other's entry on every run.

    The control I will not repeat: my repro and my proof both empty the cache through the real mechanism (CHARLY_REPO_CACHE → a fresh directory), never a warm ~/.cache/charly/repos. opencharly/[email protected] is already warm HERE — that is exactly the trap this issue was filed for.

    A3. This session's delivered system message reads, verbatim: You are a coding agent powered by the deepseek-v4.1-flash model. — harness DeepSeek Harness, model deepseek-v4.1-flash; cited with opencharly/opencharly#538.

    Agent: charly-spec279

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

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

    @aitrawog
    ContributorAuthor

    STATUS — spec#279 is FIXED and open for review: #281, head 3410404, and the three skills it unblocks are now measurable from the umbrella.

    What the defect was, measured COLD this time. Fresh CHARLY_REPO_CACHE, the real
    charly marketplace generate, opencharly/opencharly:v2026.296.2037 (412 declared
    gitlinks): rc=1 —

    charly marketplace: collect entities: resolve @github.com/opencharly/opencharly:v2026.296.2037: downloading github.com/opencharly/opencharly:v2026.296.2037: populating submodules in …: exit status 128
    fatal: Unable to create '…/.git/modules/charly/shallow.lock': File exists.
    fatal: Fetched in submodule path 'charly', but it did not contain 52145aff… Direct fetching of that commit failed.
    

    Two of three cold attempts failed in that step; the third succeeded end-to-end in 3m17s —
    same function, same wrapper. Every one of the 412 submodules is REACHABLE from this host,
    so the proximate cause here is not the CI's auth failure but a second defect in the same
    call: the population takes >4 minutes (measured with ps -eo etime while it was still
    running) under a 60s transfer bound, and the retry then collides with the killed attempt's
    residue. Filed as #280; non-blocking for this fix, because a files-only
    fetch never populates.

    The fix. refs.DownloadRepoFiles(repoPath, version) — the files-only fetch, with
    refs.DownloadRepo unchanged for --repo. It shares candywalk.RemoteResolver's exact
    signature, so the corpus generator passes it as the existing seam with no SDK change. It
    has its own cache KEY (<cache>/.files/<repo>@<version>, a mode directory so the basename
    keeps the <repo>@<version> shape plugin-marketplace's resolve.go parses) and its own
    freshness predicate (a tree export is complete without submodule content; a whole-project
    export never is).

    Cold, after the fix, same command:

    Downloading github.com/opencharly/opencharly:v2026.296.2037 (files only)...
    generate rc=0        # 12s end-to-end for all three refs, from an empty cache
    

    The umbrella actually WINS the twin, measured. With BOTH [email protected]
    and opencharly/[email protected] pinned directly, the generated corpus's
    internals/skills/agents/references/hooks-and-lifecycle.md is byte-identical to the
    umbrella's authored file and DIFFERS from the carrier's today — the discriminator being
    exactly the reference file, since the three bodies are identical in both sources.

    Chain from here (producer-first): spec#281 → merge → tag → plugin-marketplace
    adopts refs.DownloadRepoFiles (its resolver line is already changed and its call-site
    test fails without it) → marketplace refs PR adds the umbrella as a DIRECT ref + the
    regenerated corpus, with the deploy workflow's cold-runner drift gate as the acceptance
    arm. The carrier layer-charly-internals can then drop its last three — the two
    .github-owned ones (git-workflow, repo-setup) are still FILED, so it still cannot be
    archived.

    A3. This session's delivered system message reads, verbatim: You are a coding agent powered by the deepseek-v4.1-flash model. — harness DeepSeek Harness, model deepseek-v4.1-flash; cited with opencharly/opencharly#538.

    Agent: charly-spec279

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

  4. added a commit that references this issue on Oct 23, 2026
    317df91
  5. aitrawog commented on Oct 23, 2026

    @aitrawog
    ContributorAuthor

    STATUS — the producer is LANDED and TAGGED: spec v0.2026296.2332 (PR #281), and the consumer leg is open: opencharly/plugin-marketplace#49.

    leg state
    opencharly/spec#281 — the files-only fetch MERGED, tag v0.2026296.2332, all four checks green (validate / validate PASS on attempt 1, go CI PASS, validate / lint PASS, validate / arm PASS)
    opencharly/plugin-marketplace#49 — adopt it as the corpus resolver OPEN, head 3409741, spec v0.2026296.1036 → v0.2026296.2332, one-line resolver swap + a call-site test that fails without it
    marketplace refs PR — umbrella as a DIRECT ref next, after #49 merges and tags; the corpus is already regenerated here and the delta is exactly one file (below)

    The corpus delta is one file, on the full 226-ref list, generated COLD (CHARLY_REPO_CACHE emptied, 361 SKILL.md, 496 artifacts, 0 new files):

    internals/skills/agents/references/hooks-and-lifecycle.md   # the umbrella's, not the carrier's
    

    That is the discriminator, and it is the only one there is: the three bodies are byte-identical in both sources, so what moves is the agents REFERENCE file. Measured with BOTH
    [email protected] and the umbrella pinned directly: published == the
    umbrella's file (0d5c8c98…), ≠ the carrier's corpus copy (5848ee0c…).

    Pin chosen: opencharly/opencharly:v2026.296.2254 (the newest merged umbrella tag, not
    the .2037 the withdrawal recorded). .agents/ is byte-identical at both tags — measured,
    blob for blob — so the pin names the current tag without moving a body.

    layer-charly-internals after this lands: it CAN drain its last three (agents,
    cutover-policy, root-cause-analyzer) — their umbrella copies are now publishable — but it
    still holds git-workflow and repo-setup, whose config home (opencharly/.github) is not
    a corpus source. So it still cannot be archived, and I did not touch it: the carrier's drain
    is the held carrier's own PR.

    Two sibling findings filed from this work, both non-blocking and neither absorbed here:
    #280 (the population runs a >4-minute operation under the 60s transfer
    bound and its retry collides with the killed attempt's residue — the proximate cause of my
    own cold rc=1) and opencharly/plugin-docs#23 (the docs generator is the same walk's
    sibling consumer and still populates).

    A3. This session's delivered system message reads, verbatim: You are a coding agent powered by the deepseek-v4.1-flash model. — harness DeepSeek Harness, model deepseek-v4.1-flash; cited with opencharly/opencharly#538.

    Agent: charly-spec279

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

  6. aitrawog commented on Oct 23, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — the fix landed as #281 (squash 317df91, tag **v0.2026296.2332) and the consumer chain is in flight: plugin-marketplace candy/plugin-marketplace/v0.2026296.2345, marketplace#567 (the umbrella as a DIRECT ref + the regenerated corpus).

    Cold evidence, both directions, on opencharly/opencharly (412 declared gitlinks), fresh CHARLY_REPO_CACHE:

    # BEFORE — whole-project fetch, charly marketplace generate
    … populating submodules in …/[email protected]: exit status 128
    generate rc=1
    # AFTER — files-only fetch
    Downloading github.com/opencharly/opencharly:v2026.296.2037 (files only)...
    generate rc=0

    --repo still populates (arm 2) and a genuinely unreachable declared submodule still fails that fetch loudly (arm 3); the files-only fetch has its own cache entry (<cache>/.files/<repo>@<version>) and its own freshness predicate, so the two modes never judge each other's export.

    Two sibling findings filed rather than absorbed: #280 (the population runs a >4-minute operation under the 60s transfer bound and its retry collides with its predecessor's residue — the proximate cause of my own cold rc=1) and opencharly/plugin-docs#23 (the docs generator is the same walk's sibling consumer).

    Agent: charly-spec279

    Assisted-by: DeepSeek Harness 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