Skip to content

feat(schema): add CliRequest.env + ProvidedCapability.interactive - #154

Merged
github-actions[bot] merged 4 commits into
mainfrom
feat/check-roster-and-cli-env
Sep 24, 2026
Merged

github-actions[bot] merged 4 commits into
mainfrom
feat/check-roster-and-cli-env

Conversation

@aitrawog

@aitrawog aitrawog commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

The spec-side legs of the plugin-native check-bed roster cutover. THREE changes, two additive wire additions and one namespace-aware resolver replacement.

  1. schema/seam.cue — #CliRequest gains env?: {[string]: string}. The cli host-builder (M4) forks a charly child; the caller passes per-call environment variables as EXPLICIT DATA instead of mutating its own process env. This is what makes the cli host-builder placement-invariant: a compiled-in caller that os.Setenvs isolation vars (CHARLY_REPO_OVERRIDE / CHARLY_DEPLOY_CONFIG / CHARLY_PREEMPT_LEASE) only reaches the forked child when caller and child share a process; an out-of-process caller's os.Setenv lands in the WRONG process. Threading the vars on the request makes the child receive them identically in both placements. ADDITIVE.
  2. protocol/schema/plugin.cue + capability/capability.go — ProvidedCapability gains interactive (proto field 14; Go field on the authoring struct). A class=command capability sets it when it needs a real terminal (shell, logs -f, mcp serve --stdio). Such a command keeps the process-replacing exec lane; every non-interactive command can dispatch through the broker-backed Invoke(OpRun) path, so a command behaves identically compiled-in and runtime-loaded. ADDITIVE.
  3. spec/loadmodel.go — replaces the local-only UnifiedFile.CheckBeds() with the ONE namespace-aware bed resolver: Beds() (recursive local + ns.name enumeration via collectBeds), ResolveBed(ref) (local or ns.bed), and BedScope(ref) (returns the owning UnifiedFile so a namespaced bed's bare from: resolves against its own namespace). This fixes a real defect: a namespaced bed (main.check-*) currently VALIDATES (loaderkit.bedRef supports ns.bed) but CANNOT RUN (the run path looked it up locally only). CheckBeds() had three disagreeing consumers; this is the single replacement. RENAME/REMOVAL (see R5).

Regenerated: proto/plugin.proto, proto/plugin.pb.go, spec/cue_types_gen.go (via task wire:gen + task cue:gen).

New coverage: spec/loadmodel_beds_test.go covers Beds()/ResolveBed()/BedScope().

Additive wire fields only for items 1–2; item 3 is a rename (CheckBeds → Beds) with NO #SchemaVersion bump (the authored charly.yml schema surface is unchanged — this is a Go API change, not a config-format change). No migration.

Closes / relates to: none (first legs of a cross-repo cutover; sdk + charly + plugin-check consumers follow). The rename's consumer updates are in the sdk leg (ValidateCheckBeds/ResolveEntityRef use Beds()/ResolveBed()) and land AFTER this is merged + tagged.

Breaking change + rollback: CheckBeds() is removed/renamed to Beds() — a Go API break for out-of-tree consumers of spec.UnifiedFile. Recovery: switch uf.CheckBeds() to uf.Beds() (the new names are namespace-qualified; a local-only caller gets the same local keys plus ns.* keys). Rollback is a revert of this PR.

Change class

charly-or-sdk Go (the spec contract module). Consumer legs land after this is merged + tagged (SDK-first order).

How R10-tested — exact gate, commands, and pasted output

  • The gate for this change class: task cue:gen reproducibility + go test ./..., AND the new spec/loadmodel_beds_test.go which directly exercises the changed bed-resolution logic and FAILS without it.
  • Eval beds run: N/A (contract module) for deployable beds; the changed bed-logic path is executed by the new unit test, not a bed.
  • Fresh rebuild: N/A — no binary.
  • Did the CHANGED code path execute live? Yes — the new resolver paths ran under go test (pasted below). task wire:gen/task cue:gen executed the generation paths against the edited CUE.
  • Concurrency: N/A.

1. Fresh-rebuild gate output:

$ task cue:gen
cue:gen: regenerated spec/{cue_types_gen.go,vocab_gen.go,version_gen.go}
$ GOTMPDIR=~/.cache/go-tmp go test ./...
ok   github.com/opencharly/spec/exec      12.499s
ok   github.com/opencharly/spec/schema      5.811s
ok   github.com/opencharly/spec/spec        1.322s
... (all packages ok)

2. Each changed code path executing:

$ GOTMPDIR=~/.cache/go-tmp go test ./spec/ -run 'TestBeds_|TestResolveBed_|TestBedScope_' -v
=== RUN   TestBeds_NamespaceAware
--- PASS: TestBeds_NamespaceAware (0.00s)
=== RUN   TestResolveBed_Forms
--- PASS: TestResolveBed_Forms (0.00s)
=== RUN   TestBedScope_OwningNamespace
--- PASS: TestBedScope_OwningNamespace (0.00s)
PASS

3. Docs-only evidence: N/A.

Attribution tier

fully tested and validated — the changed resolver paths ran live under test; the full module battery (incl. the TestGenReproducible generation-drift gate) passed.

Harness rulebook compliance — state HOW each is satisfied (or N/A — <reason>)

  • R0 skills: loaded /charly-internals:go (schema change recipe) and /charly-internals:plugin (capability/wire contract).
  • R1 RCA + zero warnings: generation + full test run produced zero warnings. The namespaced-bed validate-but-not-run defect is RCA'd in the Summary (three disagreeing lookups; local-only run path).
  • R2 no out-of-scope: the resolver replacement is required by the roster cutover (a root config reaches submodule beds as main.check-*); it is in scope, not deferred.
  • R3 no duplication: the new resolver is the ONE replacement for the three disagreeing lookups; the existing tests (resolve_entity_ref_test.go) now route through it.
  • R4 no workaround: Beds() is the explicit-data/one-path fix; no shim.
  • R5 hard cutover + grep — ACTUALLY-EXECUTED sweep:
    $ grep -rnE '\.CheckBeds\(\)' --include=*.go . | grep -v '/.git/'
    ./plugin-check/candy/plugin-check/bed_session.go:341:	node, isBed := uf.CheckBeds()[bed]
    ./charly/charly/check_bed_run_test.go:39:	beds := uf.CheckBeds()
    ./sdk/loaderkit/validate_deploy_hop_test.go:12 (comment)
    
    Consumer origin/main (not a sibling branch) still references CheckBeds/bedRef:
    $ git -C plugin-check grep -nE 'CheckBeds' origin/main -- '*.go'
    origin/main:candy/plugin-check/bed_session.go:341: node, isBed := uf.CheckBeds()[bed]
    $ git -C sdk grep -nE 'CheckBeds|bedRef' origin/main -- '*.go'
    origin/main:loaderkit/resolve_entity_ref.go:41: return bedRef(uf, ref)
    origin/main:loaderkit/validate_check_beds.go:22: for name, node := range uf.CheckBeds() {
    
    These consumer call sites are updated in the downstream sdk + plugin-check legs, which MUST land after this merge+tag (SDK-first order). This is a coordinated cross-repo rename; each leg's own PR carries its sweep. #SchemaVersion is unchanged (the authored config surface is unaffected).
  • R6 git safety: git status checked before commits; no destructive action.
  • R7 runtime gate: N/A — contract module; the changed logic is unit-gated (see *2).
  • R8 artifact invariants: regenerated proto/plugin.proto + cue_types_gen.go; TestGenReproducible proves a clean regeneration is a no-op.
  • R9 binary == source + deps: N/A — no binary, no runtime OS deps.
  • R10 disposable + coverage: N/A (contract module) for beds; spec/loadmodel_beds_test.go ships the coverage that fails without the resolver change.
  • RDD / ADE / SDD: SDD honored — CUE edited first, task cue:gen regenerated, TestGenReproducible green.
  • Hard cutover: atomic commits; no Phase 2/TODO in scope.
  • Kernel/plugin boundary law: the added fields are generic Envelope fields; the resolver is a kind-blind spec.UnifiedFile method (no concrete-kind schema/switch/map).
  • Disposable-only autonomy: N/A.
  • Clean architecture + Go gates: one canonical resolver replacing three; gofmt clean; go test ./... green.
  • CHANGELOG: N/A — this repo's CHANGELOG/<CalVer>.md is written post-merge by tag-on-merge from THIS body.

Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated)

Thread per-call child env on the cli host-builder envelope as explicit data
(placement-invariant cli reentry), and declare a command capability's terminal
need so command dispatch can route non-interactive commands through the
broker-backed Invoke(OpRun) path in both placements.

Additive only: no #SchemaVersion bump, no migration.

Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated)
Beds()/ResolveBed()/BedScope() add namespace-aware bed enumeration + resolution
(the replacement for the local-only CheckBeds()). Ships the coverage that fails
without it.

Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated)
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 4b39a70dbab1f37fc3ba0cbe32281faaad2fd5b6 (branch: feat/check-roster-and-cli-env)

Change class: code/config (spec contract module) — but the diff is NOT the "additive wire additions" the body declares.

Security screen: T3 finding — scope mismatch (code does materially more than the description claims). See Block 1.

Blocks

  1. T3 + A1 — undocumented spec/loadmodel.go change (scope mismatch + incomplete body). The diff rewrites spec/loadmodel.go (+93/-7): it renames CheckBeds() → Beds(), and adds collectBeds, ResolveBed, BedScope, namespaceAt (namespace-aware, recursive bed folding/replacement of loaderkit.bedRef()). This file/behavior is named NOWHERE in the body's Summary of changes (which claims "Two ADDITIVE wire additions" and "the complete spec-side scope") nor in the commit message ("feat(schema): add CliRequest.env + ProvidedCapability.interactive"). A diff item missing from the body's accounting is a defect. Fix: describe the loadmodel.go change in the body (what it does, why, how it was tested), or remove it from this PR.

  2. A2 — change-class / gate mismatch. The body classifies this as a pure contract-module wire addition and answers R10/R7 as N/A … contract module ("N/A … for beds"). But the diff changes bed-enumeration and bed-resolution behavior, which is exactly the surface the "beds" gate exists for. The named gate (task cue:gen + go test ./...) does not exercise the new Beds()/ResolveBed()/BedScope() paths. Reclassify and supply the gate that actually runs the changed bed logic (or justify from the R10 matrix with a real run).

  3. R5 (B10) — false "no identifier removed or renamed" claim + missing sweep/liveness. The body answers R5 N/A — purely additive, no identifier removed or renamed, but CheckBeds() is removed/renamed to Beds() in this same commit (and the new doc-comment states it replaces loaderkit.bedRef()). The R5 answer is contradicted by the diff. Provide the ACTUALLY-EXECUTED grep output for CheckBeds callers (B14(d): an unexecuted sweep claim is FRAUD-class), and, since this is a producer-repo symbol removal, state liveness was checked against the consumer's origin/main (not a sibling unmerged branch).

  4. B12/B13 — new behavior ships no coverage. Beds()/collectBeds/ResolveBed/BedScope/namespaceAt add new namespace-aware resolution semantics, and no _test.go file appears in the diff (the 7 changed files contain no test). The body's R10 coverage claim ("the generation-drift test ships the coverage") covers only the schema additions, not this behavior. Add a test that fails without the new resolution logic.

Minor (confirm before merge): A3 — the footer names deepseek-v4.1-flash as the "Provider Full Model Name"; confirm that is the exact authoring runtime model, not a guessed/placeholder name.

Verdict: BLOCK


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

View action run

Assisted-by: opencode deepseek-v4.1-flash (documentation reviewed)
Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated)
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: aec3c831c9465c1ca7b9107c427a9095bf477081 (branch: feat/check-roster-and-cli-env)

Security screen: PASS
Comments: 1 considered — github-actions[bot] #5822331505 (pinned to stale SHA 4b39a70d, pre-dating commits 7d4e28b + aec3c83): stale-superseded. All four findings re-derived against the current head and resolved — (1) body now accounts for spec/loadmodel.go (Summary item 3); (2) the named gate now executes Beds()/ResolveBed()/BedScope() via spec/loadmodel_beds_test.go with pasted per-test output; (3) R5 now carries an actually-executed sweep plus consumer origin/main liveness greps; (4) coverage now ships and fails without the change. Its minor A3 note is unverifiable from this context (no authoring-runtime evidence to cross-check) → unverified-dismissed, non-blocking.
Checklist: All applicable rules PASS or NA.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 24, 2026 21:18
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 0253c07a2ee1d9073980a3033cc440f4ad6122cd (branch: feat/check-roster-and-cli-env)

Security screen: PASS — T1/T2 clean (no embedded directives; PR body/diff are data only); T3 clean (no secrets, no egress/network, no new deps, no guardrail weakening; scope matches the body's three declared changes); T4 N/A (spec schema/Go contract only, not security machinery).

Comments considered:

  • #5822331505 (SHA 4b39a70d, pre-dates 7d4e28b+aec3c83) → stale-superseded: all four findings re-derived against current state are resolved — (1) spec/loadmodel.go is now Summary item 3; (2) the gate now executes Beds()/ResolveBed()/BedScope() via spec/loadmodel_beds_test.go with pasted per-test output; (3) R5 now carries an executed sweep + consumer origin/main liveness greps; (4) coverage ships in the diff. Its minor A3 model-name note → unverified-dismissed (no authoring-runtime evidence to cross-check; non-blocking).
  • #5822411169 (PASS, SHA aec3c83, one commit behind head) → verified-non-blocking: its substantive claims still hold at the current head; the trailing commit is only the golangci-lint prealloc test fix.

Checklist: All applicable rules PASS or NA. Cross-checked the regenerated plugin.pb.go rawDesc length delta (502→536 = 34 = 2-byte field tag + 32-byte interactive descriptor) and the field-14 numbering, CUE↔proto↔Go↔generated consistency, and the resolver logic against its tests — all internally consistent.

Non-blocking note (B15): 4 commits for one coherent change (schema, test, body re-freeze, lint fix); the docs: re-freeze the PR body commit leaves no file in the final diff — flag for the squash, but no partial/split/deferred scope pattern.

Verdict: PASS


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

View action run

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.

2 participants