Skip to content

fix(loaderkit): name an uninitialized submodule instead of reporting a missing file - #361

Merged
github-actions[bot] merged 4 commits into
mainfrom
fix/name-uninitialized-submodule
Oct 8, 2026
Merged

github-actions[bot] merged 4 commits into
mainfrom
fix/name-uninitialized-submodule

Conversation

@aitrawog

@aitrawog aitrawog commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

loaderkit's unified-file walk reports a missing file when the real cause is an uninitialized submodule. Fixes opencharly/charly#847.

A namespaced import whose target is a declared submodule resolves to that directory; the directory exists (a gitlink directory always does), so os.Stat succeeds, the IsDir branch appends charly.yml, and the read fails with a bare ENOENT. On an older engine the same tree surfaced the identical state as json: unsupported value: encountered a cycle via map[string]*spec.UnifiedFile. Neither reading names the cause, and both send the reader into the loader.

That is not cosmetic: the umbrella's pre-commit hook calls charly task …, and Part II rule 2 makes a session worktree the sanctioned place for umbrella work — so a bare ENOENT from the loader silently blocks every umbrella PR from the sanctioned place, and R6 forbids the bypass.

The walk now reports the cause it can prove — the directory is empty and its containing repository declares it as a submodule path in .gitmodules:

submodule "charly" is not initialized: /tmp/wtfix/charly is empty, so
/tmp/wtfix/charly/charly.yml cannot be read; run: git submodule update --init charly (from /tmp/wtfix)

The restraint is the point: a populated directory, an undeclared empty directory, a non-NotFound error and an existing target are all left untouched, so the ordinary not-found path still works for a genuinely wrong ref. A hint that fires on the wrong tree would be worse than the ENOENT it replaces.

How tested

loaderkit, live, in a fresh umbrella worktree that fails on main (4a2fc64: 423 uninitialized submodules, charly/ empty, .gitmodules declaring path = charly), with charly rebuilt against this tree:

$ charly box validate          # before this change: "... reading /tmp/wtfix/charly/charly.yml: open ...: no such file or directory"
charly: error: command "validate": validation error: /tmp/wtfix/charly.yml: import charly ("./charly"):
    submodule "charly" is not initialized: /tmp/wtfix/charly is empty, so /tmp/wtfix/charly/charly.yml
    cannot be read; run: git submodule update --init charly (from /tmp/wtfix)

$ charly task list             # the verb the pre-commit hook calls; same named cause
charly: error: command "task": load project: /tmp/wtfix/charly.yml: import charly ("./charly"):
    submodule "charly" is not initialized: ...

Four tests, one positive and three negative, each pinning one case:

$ GOWORK=off go test ./loaderkit/ -run UninitializedSubmodule -count=1 -v
--- PASS: TestUninitializedSubmoduleIsNamed                 (names the submodule AND the init command)
--- PASS: TestUninitializedSubmoduleIgnoresPopulatedDir
--- PASS: TestUninitializedSubmoduleRequiresDeclaration
--- PASS: TestUninitializedSubmoduleIgnoresExistingTarget

This repository's own gates, on the final tree (.github/workflows/ci.yml):

$ GOWORK=off go test ./...        -> ok   14 packages
$ test -z "$(gofmt -l .)"         -> clean
$ GOWORK=off go vet ./...         -> rc=0
$ for a in amd64 arm64 arm 386; do GOOS=linux GOARCH=$a CGO_ENABLED=0 go build ./...; done   -> ok (all four)

Change classification: fully tested and validated - the changed path executed live on the exact failing tree, this repo's full gate set green on the final tree, and cross-compile clean. The live before/after below was taken on the first revision; this revision changes only the receiver and the prose, and the gates were re-run on it.

Review round 1 — every BLOCK finding fixed in this commit (8f482d0)

A1 — the body asserted a branch form the PR did not use. Corrected: the branch is fix/name-uninitialized-submodule, and fix/ is this repository's prefix for a fix (#353, #359). The R6 bullet now states the real branch.

B14(d) / R2 — "checked and found none" is not evidence. The commands and their output:

$ grep -rn 'import %s' <GOMODCACHE>/github.com/opencharly/[email protected] --include=*.go
(no output)                                  <- spec has no such import-error format

$ ls <GOMODCACHE>/github.com/opencharly/[email protected]/loader/
loader_discover.go                           <- the whole loader package is one file

$ grep -rn '(%q): %w' <GOMODCACHE>/github.com/opencharly/[email protected] --include=*.go
.../[email protected]/exec/deploy_executor_nested.go:327:  return "", fmt.Errorf("NestedExecutor.ResolveHome(%q): %w", ...
.../[email protected]/exec/deploy_executor_ssh.go:285:     return "", fmt.Errorf("SSHExecutor.ResolveHome(%q): %w", ...

Read honestly: the (%q): %w shape does occur in spec — twice, both in exec/, for ResolveHome, with no relation to import resolution. So the accurate statement is: spec's loader has no import-error path at all (import %s absent; the loader package is a single discovery file), and the only similarly-shaped errors elsewhere in spec are executor home-resolution ones. A claim of an empty result would have been wrong; the claim here is the one the output supports.

Non-blocking notes. The unused walker receiver is gone — uninitializedSubmodule is now a plain function (call site and tests updated). The overlapping test the review flagged (…IgnoresExistingTarget passing via the os.Stat short-circuit) is left as-is: it pins the intended case, and the reviewer judged it non-blocking.

Gates re-run on this tree after the changes: go test ./... -> 14 packages ok · gofmt -l . clean · go vet rc=0 · cross-compile amd64/arm64/arm/386 ok · the four targeted tests pass.

Review round 2 — both findings fixed in the same commit as this text

A1 — the body asserted a commit count the branch did not have. The previous revision said "one commit"; the branch carried two. Corrected structurally rather than numerically: the R6 bullet now states the branch's shape (the fix commit and its review-round fix commits, collapsing to one on squash). A corrected number would have been stale the instant this commit landed - the exact defect already measured on charly#861 tonight.

R4 / B8 — unnamed magic number. submoduleRoot bounded its ancestor search with a bare for i := 0; i < 4; i++. It is now maxSubmoduleSearchDepth = 4, with the reason it is four: a gitlink lives directly under the repo that declares it (umbrella/charly), or one level deeper in nested layouts (repo/sub/candy), so four covers every layout the org uses while keeping the search from climbing to the filesystem root on a path that is not in a submodule at all. The bound decides whether the named-cause error fires, so it is named rather than inlined.

Gates on this tree: go test ./loaderkit/ ok · gofmt -l . clean · go vet rc=0 · go build ./... rc=0.

Branch catch-up (after the PASS verdict)

gh pr update-branch was run because the PR read behind when its verdict came back PASS - the org's auto-merge does not merge a stale branch.

The catch-up did not touch the fix, and that is measured rather than assumed:

$ git diff --stat 5dad774 origin/fix/name-uninitialized-submodule -- loaderkit/
(empty)                                   <- the branch's loaderkit equals the reviewed commit
$ git diff --stat origin/main...origin/fix/name-uninitialized-submodule
 loaderkit/uninitialized_submodule_test.go | 88 ++++++
 loaderkit/walk.go                         | 66 ++++++
 2 files changed, 154 insertions(+)

So the live-run evidence above still describes the same code, and this body names no tree hash, so nothing in it is invalidated by the head moving.

Rulebook compliance

  • R0 - git-workflow loaded before any git/PR action; this repo's AGENTS.md read first (Part II rule 4), including its "load these skills first" list and its gate list.
  • R1 - the message was root-caused rather than patched: the site was found by grepping the module cache (grep -rn 'import %s' $GOMODCACHE/github.com/opencharly/ -> loaderkit/walk.go:192), after three greps inside charly/ found nothing. A message a program prints is owned by whichever module built that code.
  • R3 - one place reports the cause; the walk gains one helper and one call site rather than duplicating message text.
  • R4 - no retry, no sleep, no suppression: the walk still fails, it fails informatively.
  • R7 - coverage that can fail without the change, and the changed path executed live (both verbs above).
  • R8 - the emitted artefact here is the error message itself, asserted in the test by its named parts.
  • R6 - the branch carries the fix commit and its review-round fix commits (an earlier revision asserted feat/, which the PR did not use; a later one asserted a commit count, which the next push would have made stale - so the claim is now the branch's shape, not its arithmetic). fix/ is the prefix this repository uses for a fix, cf. #353 (fix/loaderkit) and #359 (fix(vmshared)). The org lands by squash, so one commit is what lands. No force-push, no hook bypass, no direct push to main.
  • R2 - the cutover is this one function's report. The sibling claim is now checkable rather than asserted - see the commands and their real output in "Review round 1" below, including the hit that does exist (exec/ResolveHome, unrelated to import resolution) instead of a claim of an empty result.
  • N/A - R5 (nothing is renamed or removed), N/A - R7a (no live external service is crossed), N/A - R9 (no binary/CalVer artefact is produced by this repo).

Coordination

opencharly/sdk#353 is open on loaderkit too, for the different defect #352 (a missing cycle guard on the namespace fold). It touches namespace_walk.go, project_candies.go and siblings; this change touches walk.go and a new test file - no overlap. Preflight run before this push (gh pr list on this repo, git worktree list, the watch list); no duplicate PR exists for this fix.

Agent: issue-ledger-fanout · session session-66d2db27-61c9-484e-833f-534a3f71de10
Assisted-by: dsh deepseek-v4.1-flash (fully tested and validated)

…a missing file

A namespaced import whose target is a declared submodule directory that exists but holds
nothing - the ordinary state of a fresh `git worktree` - resolved to the directory, had
the unified file name appended, and failed with a bare ENOENT. On an older engine the
same tree surfaced it as `json: unsupported value: encountered a cycle via
map[string]*spec.UnifiedFile`. Neither reading named the cause, and because the umbrella
pre-commit hook calls `charly task ...` from a session worktree, it silently blocked every
umbrella PR from the sanctioned place (opencharly/charly#847).

The walk now reports the cause it can prove: the directory is empty AND its containing
repository declares it as a submodule path in .gitmodules. The message names the
submodule and the command that fixes it. Anything else - a populated directory, an
undeclared directory, a non-NotFound error - is left untouched so the ordinary not-found
path still works for a genuinely wrong ref.

Three negative cases are covered beside the positive one.

Assisted-by: dsh deepseek-v4.1-flash (syntax check only)
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: b2c91eb1a264c809cb04fed32a29927526f7c12a (branch: fix/name-uninitialized-submodule)

Change class: code/config (Go library, loaderkit in opencharly/sdk).

Comments: none present (0 in thread) — nothing to disposition.

Placement: CORRECT — loaderkit is the kind-blind sdk loader mechanism that emits the error, so naming the cause there (one helper + one call site, no core import, no alias growth) is the right layer.

Blocks

  1. A1 — body contradicts the current state (R6 claim). The body's rule-compliance section states R6 as "one commit on a feat/ branch", but the PR's actual branch is fix/name-uninitialized-submodule. The body's own compliance assertion does not match reality. Either correct the claim to the branch actually used, or move the work onto a feat/ branch if the rulebook mandates that prefix — the body may not assert a branch form the PR does not use.

  2. B14(d) / R2 — unexecuted "checked and found none" claim. The body's R2 line asserts "no sibling loader carries the same defect (the spec loader was checked and has no import-error format)" with no pasted command and no output. Per the anti-cheat catalog, "I checked X and found none" is not evidence unless the real command and its real output appear. Paste the actual grep/command and its output showing the spec loader has no import-error path (or fix the sibling if it does). Note the R1 site-finding does paste its grep output (grep -rn 'import %s' $GOMODCACHE/... -> loaderkit/walk.go:192); the R2 sibling claim is the one left unevidenced.

Notes (non-blocking, for the author)

  • uninitializedSubmodule does not use its w receiver — a plain function would suffice; harmless, not a gate failure.
  • TestUninitializedSubmoduleIgnoresExistingTarget passes via the os.Stat(path)==nil short-circuit before any .gitmodules/emptiness logic, so it overlaps …IgnoresPopulatedDir; it still pins the intended case.
  • Attribution trailer is in the correct *Assisted-by: <Harness> <Provider Full Model Name> (<confidence>)* form; the model name could not be cross-checked against runtime evidence in the body (tool-limited, treated as unproven — not a block reason on its own).

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

…heckable

Review round 1 fixes, every finding of the BLOCK, in one commit.

A1: the body asserted "one commit on a feat/ branch" while the branch is
fix/name-uninitialized-submodule. The claim is corrected to the branch actually used;
fix/ is the prefix this repository uses for fixes (cf. #353, #359).

B14(d)/R2: the sibling claim - "no other loader carries the same defect" - was
asserted without a pasted command. The commands and their real output are now in the
body, including the one hit that does exist (exec/ResolveHome, unrelated to import
resolution) rather than a claim of an empty result.

Also, from the review's non-blocking notes: uninitializedSubmodule did not use its
walker receiver, so it is now a plain function.

Gates re-run on this tree: go test ./... 14 packages ok; gofmt clean; go vet rc=0;
cross-compile amd64/arm64/arm/386 all ok; the four targeted tests pass.

Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 8f482d01c0b5d306dbcbbd7413fa7c92796dd723 (branch: fix/name-uninitialized-submodule)

Change class: code/config (Go library — loaderkit in opencharly/sdk; 2 files: loaderkit/walk.go +59, loaderkit/uninitialized_submodule_test.go +88).

Security screen: no T1–T4 finding — no secrets/egress, no guardrail weakening, no scope mismatch (the diff does exactly what the body describes), no embedded directive.

Comments considered:

  • Comment 6068136328 (@github-actions[bot]) — finding 1 (body said feat/, actual branch fix/): stale-superseded — the current body now states fix/name-uninitialized-submodule and explains the correction. Finding 2 (unevidenced R2 sibling claim): stale-superseded — the body now pastes the three real greps and their output, including the honest non-empty hit (exec/…ResolveHome). Note (unused receiver): resolved in this revision (uninitializedSubmodule is now a plain function). Note (overlapping …IgnoresExistingTarget test): re-derived — the test does short-circuit on os.Stat(path)==nil, so it overlaps …IgnoresPopulatedDir, but it still pins the intended case; non-blocking. Note (model name unverifiable): tool-limited, not a block reason on its own.

Blocks

  1. A1 — the body asserts a commit state the PR does not have. The rulebook-compliance section states R6 — one commit on fix/name-uninitialized-submodule, but the PR carries two commits on that branch: b2c91eb1a264 and 8f482d01c0b5 (head). The current body itself documents the second commit ("every BLOCK finding fixed in this commit (8f482d0)"), so the one commit assertion is internally contradicted by the provided commit list. Fix: correct the R6 line to the actual commit state (two commits), or squash to one — the body may not assert a commit count the branch does not have. (This is a new fact introduced by the review-response push; it was not present at the prior review, whose head was b2c91eb.)

  2. R4 / B8 — unnamed magic number. loaderkit/walk.go, submoduleRoot: the ancestor search is bounded by a bare literal for i := 0; i < 4; i++. The bound directly controls whether the named-cause error fires, yet it is an unnamed magic value. Name it (e.g. a named constant for the maximum submodule-search depth) so the heuristic is explicit rather than an inline 4.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

Review round 2, both findings, one commit.

A1: the body asserted "one commit" while the branch carries two. The assertion is removed
rather than corrected to a number: the branch carries the fix commit and its review-round
fix commits, and the org lands by squash - a count would be stale again the moment this
commit lands, which is the exact defect this campaign already measured once.

R4/B8: submoduleRoot's ancestor search was bounded by a bare literal 4. It is now
maxSubmoduleSearchDepth, with the reason it is four rather than any other number: a
gitlink lives directly under the repo that declares it, or one level deeper in nested
layouts, so four covers every org layout while keeping the search from climbing to the
filesystem root on a path that is not in a submodule at all. The bound decides whether
the named-cause error fires, so it is not a detail.

Gates: go test ./loaderkit/ ok; gofmt clean; go vet rc=0; go build ./... rc=0.

Assisted-by: dsh deepseek-v4.1-flash (analysed on a live system)
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: 5dad774d6cc582f9e1ae2de34a283e40f6a0e454 (branch: fix/name-uninitialized-submodule)

Security screen: PASS — no secrets/egress, no guardrail weakening, diff does exactly what the body states, no embedded directives.
Comments considered:

  • 6068136328 (@github-actions[bot]) — stale-superseded: the feat/ branch claim is gone (current body states fix/name-uninitialized-submodule), and the unevidenced R2 sibling claim now carries the three real greps plus their honest non-empty hit (exec/…ResolveHome). Receiver note resolved (uninitializedSubmodule is a plain function).
  • 6068241140 (@github-actions[bot]) — stale-superseded: the "one commit" assertion is replaced by a branch-shape claim that matches the 3-commit list, and the bare for i := 0; i < 4 is now the named maxSubmoduleSearchDepth = 4. Both re-derived against the current head and resolved.

Checklist: All applicable rules PASS or NA. (Placement: CORRECT — the fix lives in the sdk loaderkit mechanism that emits the message; one helper + one call site, no core import, no alias growth. R7 coverage exists — TestUninitializedSubmoduleIsNamed fails without the change — and the changed path executed live in the pasted charly box validate/charly task list output, which matches the error string the code and test assert.)

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 8, 2026 20:21
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: 2cd7451841420535c700533b19f07d1a1a01851b (branch: fix/name-uninitialized-submodule)

Security screen: PASS — no secrets/egress, no guardrail weakening, diff does exactly what the body states (one helper + one call site + one named constant + tests), no embedded directives. Placement: CORRECT — the fix lives in the sdk loaderkit mechanism that emits the message; no core import, no alias growth.

Comments considered:

  • 6068136328 (@github-actions[bot]) — stale-superseded: the feat/ branch claim is gone (current body states fix/name-uninitialized-submodule), and the unevidenced R2 sibling claim now carries the three real greps plus their honest non-empty hit (exec/…ResolveHome).
  • 6068241140 (@github-actions[bot]) — stale-superseded: the "one commit" assertion is replaced by a branch-shape claim matching the current 4-commit list, and the bare for i := 0; i < 4 is now the named maxSubmoduleSearchDepth = 4.
  • 6068323129 (@github-actions[bot]) — PASS at prior SHA 5dad774; re-derived against the current head — the merge commit 2cd74518 adds no diff, so its claims still hold.

Checklist: All applicable rules PASS or NA. (R7 coverage present — TestUninitializedSubmoduleIsNamed fails without the change; the changed path executed live in the pasted charly box validate / charly task list output, matching the error string the code and test assert. The later revisions changed only the receiver, prose, and an inert 4→named-constant, so the live proof stands.)

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot merged commit 54c82a9 into main Oct 8, 2026
6 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Oct 8, 2026
github-actions Bot pushed a commit to opencharly/charly that referenced this pull request Oct 8, 2026
…dule (#863)

* fix(deps): carry the sdk loader fix that names an uninitialized submodule

Consumes opencharly/sdk#361 (merged; tag v0.2026281.2051, commit 54c82a9).

charly's loader is loaderkit in the SDK, so the defect fixed there - a namespaced
import whose target is a declared submodule directory that exists but holds nothing
reported as a bare ENOENT - is only fixed FOR CHARLY once the module requirement moves.
That requirement is the declaration the build reads; the umbrella gitlink is a second
declaration of the same producer and is not touched here.

sdk v0.2026280.2246 -> v0.2026281.2051 in charly/go.mod; go mod tidy moved the two
go.sum lines it owns. Verified at the artefact level rather than by inference: the
rebuilt binary reports dep github.com/opencharly/sdk v0.2026281.2051, with no replace
in go.mod.

Closes #847.

Agent: charly (fan-out prerequisite)
Assisted-by: dsh deepseek-v4.1-flash (fully tested and validated)

* chore: re-trigger on the body that routes the gitlink surface to its named row

R2/B14(b): the body parked a surfaced failure as a separate step. It now names the row
that carries it - #864 - with the measured failure and candidate fixes
pasted there, and the R2 bullet says so. No code change; the tree is identical.

Agent: charly (fan-out prerequisite)
Assisted-by: dsh deepseek-v4.1-flash (fully tested and validated)

* fix(tools): align the lockstep modules with the shared sdk pin

The go check failed on TestContractPinsMatchShared: bumping charly's sdk requirement
moved the SHARED pin to v0.2026281.2051, and the three lockstep tools modules still
required v0.2026280.2246. The test names its own remedy, so it was run rather than
reasoned about: charly task mods-tidy, whose own run and check steps both pass.

Six files move: the go.mod and go.sum of tools/generate-packages, tools/golden-cloudinit
and tools/golden-compile. TestContractPinsMatchShared now passes locally and
bootstrap-charly.sh returns 0.

Agent: charly (fan-out prerequisite)
Assisted-by: dsh deepseek-v4.1-flash (fully tested and validated)
github-actions Bot pushed a commit that referenced this pull request Oct 9, 2026
…ound fired (#363)

A step killed by the per-attempt never-hang bound reported only the mechanism of its death
(`process terminated by signal (signal: killed)` plus the bound line, from #361). That answers
"how long did it run" and not "was the probe making progress or was it wedged?" — and the two
have different owners: a wedged probe is a defect in the probe, a legitimately slow probe needs an
authored `timeout:`.

Where a LOCAL pid exists, the process is the witness, so the kill now says which it was:

- `kit/never_hang_evidence.go` — `KillEvidence` (bound, pid, alive-at-the-bound, silence) plus
  `ObserveLocalKill`, which reads liveness and elapsed silence from INJECTED readings so the
  never-hang path is provable without waiting for a production bound.
- `AnnotateNeverHangKillWithEvidence` is the ONE implementation of the kill annotation;
  `AnnotateNeverHangKill` is its unobserved case, so every existing caller and message is
  byte-identical (R3).
- `kit/images.go` — `runEngineCommand` reads liveness INSIDE `cmd.Cancel` (at the instant the bound
  fires, before our own SIGKILL) and annotates the deadline error. Remote/venue probes have no local
  pid, so they keep exactly the message they had: the qualifier is "where a local pid exists".

Unchanged by design: the never-hang ceiling is still a HANG bound, `ProbeNeverHang` still honours an
authored `timeout:` over the floor, and no timeout was widened (charly#846's isolated-cache fix is
the precedent — the number is the symptom, never the fix).

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

Co-authored-by: charly <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant