Skip to content

feat(agent): add CUE-generated control plane SDK - #73

Merged
atrawog merged 12 commits into
mainfrom
feat/agent-control-plane
Jul 19, 2026
Merged

atrawog merged 12 commits into
mainfrom
feat/agent-control-plane

Conversation

@atrawog

@atrawog atrawog commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

Makes CUE the author of record for the protobuf transport and adds the generic agent control-plane SDK. The hand-maintained proto/plugin.proto is replaced by a CUE meta-model (protocol/schema/*.cue) rendered by the project-owned internal/wiregen generator (byte-reproducible, locked by TestProtocolDocsComplete); a generic bidirectional Provider.Channel RPC with sequenced/replayed ChannelFrames; the daemon-free durable agent store (agentkit, flock-guarded JSONL/JSON with CUE validation at every mutation); team/delegation validation and an RCA-gated recovery gate; exact-argv local/SSH/nested process transports (kit StartProcess, targetkit gRPC-over-stdio, testkit in-process SSH fixture); content-addressed charly bootstrap delivery; isolated mode-preserving local-package build staging (deploykit/localpkg); new OCI labels agent_provide/terminal_profiles; ProtocolVersion 1→2.

Review-round fixes appended on top of the original series (salvage of validator CHANGES-REQUESTED + independent review):

  • 3d5821a fix(kit,targetkit): own process pipes — the cmd.Wait() monitor raced consumers of StdoutPipe/StderrPipe (os/exec closes those pipes in Wait; flaky read |0: file already closed ~1/10, now a deterministic regression test); pipes are caller-owned os.Pipe() ends. R3: one exported home for SortedEnvPairs/RemoteLaunchCommand/ShutdownProcessGroup (graceful-first: stdin EOF → grace → SIGTERM group → grace → SIGKILL), replacing byte-identical copies in kit and targetkit.
  • bfe5339 fix(protocol,wiregen): restore full proto docs in the CUE wire model — the bootstrap importer kept only the first line of every multi-line comment (emicklei/proto Comment.Message() returns Lines[0]) and shifted trailing comments onto the next element; importer fixed, 17 docs restored from the base .proto, regeneration byte-reproducible, TestProtocolDocsComplete locks doc presence/length/attribution.
  • 8fd8a4d fix(agentkit,sdk,schema): RFC3339Nano timestamps now sort temporally (lexicographic misordered variable-width fractions); AbortRequested returns nil, err on decode failure; ReplayBuffer.Add names the unacknowledged oldest sequence; DecideRecovery documents its durability delegation; terminal_profile singular authored key vs plural wire label documented in place.
  • 0b6cec8 docs(sdk): README enumerates agentkit/targetkit/testkit/wiregen and the wire:gen chain.
  • 084d1ff fix(testkit): the SSH fixture's pipe pumps get the same caller-owned pipe treatment (found by RCA of a 1-in-40 race failure during the final gate) — pumps drain to EOF before exit-status.

Change class

cross-repo — charly/sdk Go producer. Repos + landing order: sdk (this PR) → pkg-arch#5 → plugins#91 → charly#146 (superproject, re-pins gitlinks) → distro-arch#5 (R10 beds).

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

  • The gate for this change class: standalone SDK battery (GOWORK=off go mod tidy && go mod verify && go build ./... && go test ./...) + vet/lint/race + generation no-op (task wire:gen, TestGenReproducible) + the concurrent bed roster charly check run check-tmux-pod / charly check run check-agent-pod (the beds that exercise the process transports, the typed terminal channel, and the agent store).
  • Eval beds run: check-tmux-pod | pod (rootless podman, Arch) | ok | 12 steps | 158s
    check-agent-pod | pod (rootless podman, Arch) | ok | 12 steps | 265s

One binary: charly version = 2026.200.1143 (built from this tree via task build:binary); shared run-calver 2026.200.1205 (.check/<bed>/2026.200.1205/); both beds launched CONCURRENTLY in one batch. An earlier same-day roster (2026.200.1151, same binary) passed check-tmux-pod and surfaced three pi-tui marker failures in check-agent-pod — RCA found the bed asserted markers the TUI never renders; root-fixed in distro-arch#5 commit 7ff39b8 and re-proven green here.

  • Fresh rebuild: task build:binary on the assembled tree; bin/charly version = 2026.200.1143; beds ran the full R10 sequence (image-build → check-image → deploy → check-live → feature-run → fresh charly update rebuild → feature-run-rebuild → cleanup).
  • Did the CHANGED code path execute live? Yes — the beds drive the typed terminal:tmux channel over deployment/SSH/nested routes (the exact transports changed here), the two-process native Pi resume over agentkit, and the tmux process-group lifecycle. The ShutdownProcessGroup SIGTERM-before-SIGKILL ladder is additionally proven by unit tests with trap-printing and TERM-ignoring children.
  • Concurrency: -race -count=20 on ./kit/ ./targetkit/ ./agentkit/ . green (kit 223s); the two beds ran CONCURRENTLY in one batch.
$ GOWORK=off go mod tidy && echo tidy-ok; git diff --stat go.mod go.sum | wc -l
tidy-ok
0
$ GOWORK=off go mod verify
all modules verified
$ GOWORK=off go build ./... && echo build-ok
build-ok
$ GOWORK=off go test ./...
ok  	github.com/opencharly/sdk	...	(ok, 10 packages)
$ go vet ./... && echo vet-ok
vet-ok
$ golangci-lint run
0 issues.
$ gofmt -l . | wc -l
0
$ go test -race -count=20 ./kit/ ./targetkit/ ./agentkit/ .
ok  	github.com/opencharly/sdk/kit	223.1s
ok  	github.com/opencharly/sdk/targetkit	4.5s
ok  	github.com/opencharly/sdk/agentkit	1.9s
ok  	github.com/opencharly/sdk	23.2s
$ task wire:gen && git status --short | wc -l        # regeneration no-op
0
$ go test -run TestGenReproducible ./spec/
ok  	github.com/opencharly/sdk/spec
$ go test -race -count=20 ./kit/ -run TestShellExecutorStartProcessPreservesArgvAndPipes
ok  	github.com/opencharly/sdk/kit	(20/20 PASS — previously ~1/10 flake: read |0: file already closed)

$ CHARLY_REPO_OVERRIDE=github.com/opencharly/charly=$PWD ./bin/charly -C box/arch check run check-tmux-pod # concurrent with check-agent-pod
[image-build] PASS 36.7s · [check-image] PASS 14.2s · [deploy-add] PASS 9.2s · [config] PASS 2.7s · [start] PASS 3.9s ·
[bring-up-members] PASS 0s · [check-live] PASS 41.6s · [feature-run] PASS 7.7s · [update] PASS 29.2s ·
[feature-run-rebuild] PASS 7.8s · [cleanup] PASS 5.4s · [cleanup-members] PASS 0s
charly check run check-tmux-pod: PASS (steps=12) exit=0
$ cat .check/check-tmux-pod/2026.200.1205/summary.yml | tail -2
total_seconds: 158
ok: true

$ CHARLY_REPO_OVERRIDE=github.com/opencharly/charly=$PWD ./bin/charly -C box/arch check run check-agent-pod
[image-build] PASS 1m31.6s · [check-image] PASS 18.4s · [deploy-add] PASS 8.9s · [config] PASS 3.2s · [start] PASS 4.2s ·
[bring-up-members] PASS 0s · [check-live] PASS 1m19.7s · [feature-run] PASS 13.2s · [update] PASS 27.4s ·
[feature-run-rebuild] PASS 12.9s · [cleanup] PASS 5.3s · [cleanup-members] PASS 0s
charly check run check-agent-pod: PASS (steps=12) exit=0
$ cat .check/check-agent-pod/2026.200.1205/summary.yml | tail -2
total_seconds: 265
ok: true
$ grep -E 'pi-tui-(rendered|help-rendered|quit-verify)' .check/check-agent-pod/2026.200.1205/check-live.log
PASS check the Pi-TUI screen renders its control-plane section headers [pi-tui-rendered] exit=0
PASS check the Pi-TUI help view renders the typed terminal command reference [pi-tui-help-rendered] exit=0
PASS check the Pi-TUI exits through its own allowlisted ctrl-c … [pi-tui-quit-verify] exit=0

Changed-path live execution: deployment-grpc-tmux / ssh-grpc-tmux-and-federation / native-pi-two-process-resume /
pi-official-orchestrator-delegation / agent-capability-labels — all PASS in check-agent-pod/2026.200.1205/check-live.log
(82 steps: 82 passed, 0 failed, 9 skipped; skips are verify-only-mode mutating steps).

Attribution tier

analysed on a live system for the appended fix commits at push time; the full fresh-rebuild roster on the final tree is attached above and earns fully tested and validated for the squash. Earlier branch commits carry their original Codex trailers (pushed history is append-only; the validator-composed squash trailer places the one canonical line — the pre-salvage head ee4cba1's high confidence tier was invalid and is superseded by the appended heads 3d5821a…084d1ff).

Harness rulebook compliance

  • R0 skills: go, go-quality, plugin, strict-policy, check, git-workflow loaded before edits; gates run per their prescriptions.
  • R1 RCA + zero warnings: the flaky pipe race was RCA'd to the os/exec pipe-ownership rule and root-fixed in production AND in the testkit fixture (the fixture surfaced during the final race gate and got its own RCA before the fix); race suite re-run green at -count=20; no warning left unexplained.
  • R2 no out-of-scope: every review finding (2 blockers, 2 violations, 7 nits) fixed in this PR; none deferred.
  • R3 no duplication: processEnvPairs/sortedEnv, remoteLaunchCommand/ssh-launch render, and the two process-group close lifecycles unified into kit/process.go; targetkit's private shellQuote folded onto kit.ShellQuote.
  • R4 no workaround: the shutdown ladder replaces force-kill-first with documented graceful-first escalation; no sleeps/retries added (pipe synchronization via channels).
  • R5 hard cutover + grep: hand-maintained .proto workflow removed (wiregen owns it); doc-truncation residue swept with a locking test; git grep 'proto:gen' survives only as the documented wire:gen alias.
  • R6 git safety: appended commits only; no rewrites of pushed history; status/show --stat verified after every commit.
  • R7 runtime gate: bed roster above — not just go test.
  • R8 artifact invariants: task wire:gen byte-reproducible; generated .proto/stubs regenerated, never hand-edited; TestGenReproducible + TestProtocolDocsComplete green.
  • R9 binary == source + deps: N/A to this repo directly (the assembled superproject binary is 2026.200.1143; runtime deps in pkg-arch#5).
  • R10 disposable + coverage: beds are disposable: true; new regression tests fail without their fixes (pipe race test, doc-completeness test, timestamp-sort test — teeth proven against pre-fix code).
  • RDD / ADE / SDD: SDD — wire schema is CUE-authored; regeneration no-op. RDD — the pipe-ownership semantics were spiked against the go1.26.5 os/exec source before the fix. ADE — N/A (no candy change here).
  • Hard cutover: one squash commit lands on main; no TODO/Phase-2 in scope.
  • Kernel/plugin boundary law: SDK stays generic — envelopes, transports, store, no concrete-kind schema; field 12 of ProvidedCapability deliberately left free for the in-flight sdk#72.
  • Disposable-only autonomy: all builds/runs on disposable: true beds or hermetic fixtures.
  • Clean architecture + Go gates: gofmt/vet/lint/test all green (pasted above).
  • CHANGELOG: CHANGELOG/2026.199.1330.md placeholder staged (validator finalizes the merge-time CalVer).

Assisted-by: Kimi Code Moonshot Kimi K3 (analysed on a live system)

Assisted-by: Codex (OpenAI GPT-5.6 Sol; fully tested and validated)
@atrawog

atrawog commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator phase one — FAIL

Validated immutable head d076355deb9a61354f97c002ab24132648c470aa against protected base b24b168717891860e97eb9bb627ec0375a70048b.

Blocking findings:

  1. Mandatory PR evidence is absent. The organization PR template requires a filled change class, exact R10 commands and pasted output, attribution justification, and evidence for every rule. This body contains only a summary and attribution line, so it fails the protected phase-one evidence gate.
  2. Concurrent SDK contract collision. Open SDK feat(proto,spec): F-CLI-NEST — declared subcommand catalogs for command-class plugins #72 and this PR share base b24b168.... SDK feat(proto,spec): F-CLI-NEST — declared subcommand catalogs for command-class plugins #72 assigns ProvidedCapability.subcommands protobuf field 12; this head assigns ProvidedCapability.command_model_json field 12 (proto/plugin.proto:47-50). Those wire meanings cannot coexist at the same field number. The PR neither incorporates nor resolves the concurrent producer change.
  3. SSH placement bug. targetkit.DialProvider applies TargetSpec.WorkingDir and the first hop environment to the local controller process (targetkit/stdio.go:58-62), while the SSH command builder also applies both to the remote launch (targetkit/stdio.go:177-187). A remote-only working directory therefore prevents the local ssh process from starting, and remote target environment variables contaminate the controller-side ssh process.

Per fail-fast policy, R10 was not run after phase one failed. No CalVer finalization, merge, or tag is permitted. Fix the findings, fill the protected template with actual evidence, coordinate the field allocation with SDK #72, and request a fresh validator on a new immutable head.

Assisted-by: Codex (OpenAI GPT-5.6 Sol; fully tested and validated)
@atrawog

atrawog commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator phase one — CHANGES REQUESTED ❌

Validated immutable head d2a1605 against protected base b24b168.

Change class: cross-repo runtime SDK producer; placement: CORRECT. The changed surfaces are generic SDK wire, storage, process, and transport mechanisms rather than a concrete capability.

Independent checklist

  • Protected binding / Git safety — PASS. Candidate and plugins are clean detached worktrees at the recorded SHAs; merge-base and protected AGENTS blob match the operator envelope; diff-check is clean; both candidate commits use the required attribution trailer.
  • Prior validator findings — REPAIRED. The template is now populated; command_model_json is field 13 while SDK feat(proto,spec): F-CLI-NEST — declared subcommand catalogs for command-class plugins #72 retains field 12; SSH working directory and environment are no longer installed on the local ssh carrier.
  • CUE authority / artifacts — PASS. task cue:gen regenerated the CUE-owned protobuf and Go artifacts and left the candidate tree byte-clean. The descriptor and round-trip tests bind command_model_json to field 13.
  • Standalone module hygiene — PARTIAL. GOWORK=off go mod tidy completed and left the tree clean. The exact build gate could not reach compilation because Go 1.26 walked to the validator harness read-only empty /tmp/.git mount and ran git status in /tmp, which exits 128; strace and direct candidate Git commands isolated that boundary. A separately labeled -buildvcs=false diagnostic compiled and ran all SDK tests green, but it is not credited as the required exact gate.
  • R1 / R7 / R10 evidence — FAIL. The PR states that focused tests sent real HTTP/2 gRPC through a real OpenSSH server with remote-only cwd/env and says the changed path executed live. That is not what the test does. targetkit/stdio_test.go TestGRPCOverRealOpenSSH supplies no WorkingDir and no Env. testkit/ssh_process.go serveSSHSession accepts the SSH exec request but discards its payload and starts a fixed helper process. Therefore this test cannot execute or verify the generated remote cd/env command. Remote cwd/env isolation is covered only by the replaced-carrier process-attribute assertion and exact-argv unit assertion. Those are useful regressions, but they are not live execution of the changed remote placement path and do not support the claimed fully-tested tier.
  • R10 roster — NOT RUN. Phase one failed, so check-tmux-pod and check-agent-pod author evidence was not inherited and no CalVer finalization, merge, or tag action is permitted.

Comments considered: the prior validator FAIL identified missing evidence, the field collision, and local SSH cwd/env leakage. All three original code/template findings are dispositioned as repaired on this new head; the repaired body introduces the independently verified R1/R7 overclaim above.

Cross-PR interaction: SDK #72 uses ProvidedCapability.subcommands field 12. This head correctly uses field 13, so the numeric interaction is verified non-blocking for #73. Because #73 makes protocol/schema/plugin.cue authoritative, #72 must move subcommands field 12 into that CUE source and regenerate after #73. The attempted durable coordination comment on #72 was denied by the approval boundary and was not retried; coordination remains BLOCKED.

Decision: FAIL. Add a test that actually executes the produced SSH remote command through real OpenSSH with a remote-only working directory and environment, demonstrates both values on the remote helper, and would fail if either leaked onto the local ssh carrier. Then correct the PR evidence and confidence claim to match what genuinely ran, push a new immutable head, and request a fresh independent validation.

Assisted-by: Codex (OpenAI GPT-5.6 Sol; syntax check only)

Assisted-by: Codex (OpenAI GPT-5.6 Sol; fully tested and validated)
@atrawog

atrawog commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — CHANGES REQUESTED ❌

Change class: charly/sdk Go

Independent checklist

  • PASS 0 — security & anti-tampering. Protected base, rulebook/plugin gitlink, candidate identity, repository scope, and clean-worktree bindings matched the handoff; no exfiltration, weakened gate, or supply-chain manipulation found before fail-fast stopped the run.
  • PASS 1 — description complete. The current PR body fills the protected template and includes its claimed command/evidence matrix.
  • FAIL 2 — change-class evidence. This runtime-class change cannot satisfy R7/R10 while the CUE-owned durable-record path accepts values that violate the schema. The author evidence is not inherited, and fail-fast stopped the independent runtime gates.
  • FAIL 3 — attribution tier. Live-system attribution remains unverified because independent R10 was not run after the candidate-side failure.
  • PASS 4 — R0 skills. The protected SDK/superproject rules and relevant git, check, Go/CUE, agent, strict/cutover, SSH, tmux, local-infra, plugin, and install-plan instructions were loaded and applied.
  • PASS 5 — R1 failure handling. The first independently confirmed candidate anomaly stopped the run; it is not classified as pre-existing, flaky, or out of scope.
  • PASS 6 — R2 scope. The finding is in this PR's newly added durable agent store.
  • PASS 7 — R3 duplication. No blocking duplicate abstraction was found before fail-fast.
  • PASS 8 — R4 workarounds. No blocking sleep/retry/ad-hoc synchronization workaround was found before fail-fast.
  • PASS 9 — R5 cutover. The inspected protocol/CUE and transport surfaces are a hard cutover; no compatibility shim was accepted.
  • PASS 10 — R6/R8/R9 static artifact integrity. CUE owns the new generated types/protobuf source and the generated field allocation is internally consistent; binary/runtime integrity remains uncredited because R10 did not run.
  • FAIL 11 — R10. Not run after the phase-one candidate failure, as required by fail-fast.
  • FAIL 12 — SDD CUE mandate. The authoritative schema constrains UUIDv7 IDs, required strings, and state/event/action enums, but the public durable store bypasses sdk.ValidateGenerated on write and read ingress.
  • FAIL 13 — concurrency mandate. Disposable check-tmux-pod and check-agent-pod were not started after phase one failed.
  • PASS 14 — hard cutover/plan contract. No Phase-2/TODO or transitional implementation was found in the inspected changed surfaces.
  • PASS 15 — architecture placement. Placement is CORRECT: generic transport, process, schema, and agent-control mechanisms belong in the SDK. Mechanical review found no concrete runtime ownership leak; the blocker is validation within the correctly placed store boundary.
  • FAIL 16 — disposable autonomy. Not independently exercised after fail-fast.
  • FAIL 17 — clean architecture + Go gates. Static architecture review found the blocking ingress/isolation defect; gofmt/lint/vet/test/race gates were not run after fail-fast.
  • PASS 18 — CHANGELOG. Present and describes the SDK change.

Comments considered:

  • #5013331756, atrawog — missing body evidence, protobuf field-12 collision, and local SSH cwd/env leakage: verified-non-blocking on this head. The body is complete, command_model_json is field 13, and cwd/env are remote-only for SSH.
  • #5013549099, atrawog — the real-OpenSSH fixture discarded the exec payload and did not exercise remote cwd/env: verified-non-blocking on this head. The fixture now executes the RFC4254 exec payload, and TestGRPCOverRealOpenSSH asserts remote cwd/env plus absence of local-carrier leakage.

Cross-PR interactions considered:

Decision: FAIL on immutable head 5a310e52b0c00fa50c0b3e29bea38e22344ed546.

The new durable store says its records are CUE-generated, but generation only supplies Go shapes; it does not enforce CUE constraints at runtime. agentkit/store.go:65,84,88-119,375-386,408-409 writes and reads public records without calling sdk.ValidateGenerated. Consequently callers can persist nonempty string aliases that violate schema/agent_control.cue:5,47-67—for example malformed UUIDs, an empty idempotency key, or an invalid state. This is not merely permissive input: agentkit/store.go:502-508 maps every identifier containing a disallowed character to the same filename invalid, so two distinct malformed nonempty IDs can overwrite or cross-read the same durable record. The existing store tests contain no invalid-schema/identifier regression.

Fix the durable boundary so each concrete record type is validated against its authoritative CUE definition before mutation (and untrusted persisted data is validated on read), reject invalid identifiers instead of collapsing them to a shared filename, and add regressions proving invalid values cannot mutate or alias durable state. Push a new immutable head and request fresh independent validation.

Per fail-fast, no CalVer change, commit, push, merge, or tag was performed.

Assisted-by: Codex OpenAI GPT-5 (code reviewed)

atrawog added 3 commits July 19, 2026 06:51
Assisted-by: Codex (OpenAI GPT-5.6 Sol; fully tested and validated)
Assisted-by: Codex (OpenAI GPT-5.6 Sol; fully tested and validated)
Assisted-by: Codex (OpenAI GPT-5.6 Sol; high confidence)
@atrawog

atrawog commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — CHANGES REQUESTED ❌

Bound identities: protected superproject policy 09be0a4a866e6457bb1207d0a938ce4c96d3c399; protected SDK base b24b168717891860e97eb9bb627ec0375a70048b; exact remote/worktree head ee4cba1d13b25cf078e3544492c49a012a7e621c; assembled root 708e8cba5cd7ff3119d7b93336acb395f29b191a.

Change class: cross-repo charly/sdk Go producer. Placement: CORRECT for the inspected high-level manifest: generic CUE-owned wire envelopes, durable agent mechanisms, process transports, and reusable deploy helpers belong in the SDK; the fail-fast finding is attribution/evidence integrity, not placement.

Independent checklist

  • PASS 0 — security & anti-tampering. Protected policy/spec/skill objects were loaded before candidate review; exact base/head/root and clean recursive gitlinks were bound; no candidate instruction was followed as authority.
  • FAIL 1 — description completeness/evidence integrity. The body claims that head ee4cba1… and its repair series carry exact compliant Assisted-by trailers. The head commit actually ends with Assisted-by: Codex (OpenAI GPT-5.6 Sol; high confidence).
  • NOT RUN 2 — change-class gate (R7/R10). Protected fail-fast stops the validator on the first candidate anomaly. Author generation/static/R10 evidence is not inherited.
  • FAIL 3 — attribution tier. high confidence is not an allowed protected confidence value. The allowed values are fully tested and validated, analysed on a live system, documentation reviewed, syntax check only, and theoretical suggestion (which never ships).
  • PASS 4 — R0 skills. Loaded protected pr-validator, agents, git-workflow, plugin, check, go, go-quality, and strict-policy instructions; the protected files are byte-identical to the assembled checkout copies.
  • PASS 5 — R1. The first independently confirmed candidate anomaly stopped validation; it was not retried, downgraded, or called transient.
  • PASS 6 — R2. The blocker is in the exact head commit and PR evidence, so it cannot be deferred outside this PR.
  • NOT REACHED 7 — R3 duplication. Full source judgment stopped at fail-fast.
  • NOT REACHED 8 — R4 workaround audit. Full source judgment stopped at fail-fast.
  • NOT REACHED 9 — R5 cutover/claim sweep. The PR-body trailer claim is already false on the bound head; the remaining source sweep stopped at fail-fast.
  • PASS 10 — R6 binding; R8/R9 uncredited. Both worktrees were clean and exact identities matched before review. Generated artifacts and binary linkage were not independently credited after fail-fast.
  • NOT RUN 11 — R10. check-tmux-pod and check-agent-pod were not rerun and the retained 2026.200.0731 summaries are not promoted to validator evidence after phase-one failure.
  • NOT RUN 12 — RDD/ADE/SDD. Candidate generation no-op and schema gates were not run after fail-fast.
  • NOT RUN 13 — concurrency mandate. No validator bed roster was launched after fail-fast.
  • FAIL 14 — hard-cutover evidence contract. The exact-head attribution is not at an allowed proof tier; squash behavior does not legalize an invalid pushed-commit trailer or a false PR-body assertion.
  • PASS 15 — architecture placement (manifest-level). placement: CORRECT; no charly/*.go files are in this SDK PR, so the core alias/kit-import per-item trace is N/A.
  • NOT RUN 16 — disposable autonomy. No validator destroy/rebuild action was performed.
  • NOT RUN 17 — Go quality gates. Generation, standalone tidy/verify/build/test/vet/lint/race, gofmt, and formatter-diff were not run after fail-fast.
  • PASS 18 — CHANGELOG present. CHANGELOG/2026.199.1330.md exists as the placeholder, but no merge-time finalization is authorized.

Comments considered

  • #5013331756, prior missing-template/field-collision/SSH-placement findings: verified-non-blocking for this verdict; later heads addressed them, but they grant no PASS authority.
  • #5013549099, prior real-OpenSSH coverage finding: verified-non-blocking for this verdict; later test changes claim to address it, but full revalidation stopped at the current-head blocker.
  • #5014104606, durable-store CUE/identity-boundary finding: verified-non-blocking for this verdict; later commits add boundary validation/tests, but full revalidation stopped at the current-head blocker.

Cross-PR interactions considered

  • SDK #72 overlaps proto/plugin.proto, generated stubs, and schema.go; its field-12/subcommands work remains a real coordination/rebase interaction. It does not cure this PR's exact-head attribution blocker, and no landing action is authorized.
  • Root #146 consumes this SDK head in the supplied assembled root. This SDK FAIL blocks treating that assembled consumer as landable evidence.

Decision: FAIL on immutable head ee4cba1d13b25cf078e3544492c49a012a7e621c.

Append a normal, non-force fix commit with an allowed exact trailer, correct the PR body so its attribution claim reproduces from git log, and request a fresh no-fork validator on the new head. No generation/static/R10 rerun, CalVer mutation, merge, or tag was performed after this phase-one failure.

Assisted-by: Codex (OpenAI GPT-5.6 Sol; syntax check only)

atrawog added 5 commits July 19, 2026 12:09
The Wait monitor in kit.startCommandProcess and targetkit.newProcessConn
raced consumers of pipes created by cmd.StdoutPipe()/cmd.StderrPipe():
os/exec's Wait closes the pipes it created ("incorrect to call Wait before
all reads from the pipe have completed"), surfacing as flaky
`read |0: file already closed` (~1/10 on the StartProcess pipe test).
The pipes are now created with os.Pipe() and assigned to
cmd.Stdin/Stdout/Stderr directly, so they belong to the caller and Wait
never touches them; the parent's child-side ends close right after Start
(the child holds its own duplicates), so readers see EOF the instant the
child exits. A deterministic regression gate (payload > pipe buffer, so
ReadAll always spans the Wait) fails on every iteration before the fix.

R3 unification — one exported home in kit (targetkit already depends on
the same module; kit is the pure-helper package):

- kit.SortedEnvPairs replaces the byte-identical processEnvPairs
  (kit) and sortedEnv (targetkit).
- kit.RemoteLaunchCommand replaces remoteLaunchCommand (kit) and the
  duplicated `cd <q> && env <q>... <q>argv` render in targetkit's ssh
  launch branch.
- kit.ShutdownProcessGroup replaces the duplicated "close stdin -> grace
  -> SIGKILL process group -> reap" lifecycle in kit.commandProcess.Close
  and targetkit.processConn.closeFn, and turns it graceful-first: stdin
  EOF, one ProcessShutdownGrace, SIGTERM to the group, a second grace,
  and only then SIGKILL as the final escalation (documented on the
  helper). targetkit's private shellQuote folds onto kit.ShellQuote.

Assisted-by: Kimi Code Moonshot Kimi K3 (analysed on a live system)
The CUE protocol meta-model was bootstrapped from proto/plugin.proto, but
the importer kept only the FIRST line of every multi-line // comment
block: emicklei/proto merges a comment run into one Comment whose Lines
hold every line, while Comment.Message() returns only Lines[0]. The
"authoritative" plugin.cue was left with 13+ broken half-sentences and
lost design rationale, and the generated proto inherited the stubs.

- wiregen's commentText now joins every line of the attached comment
  block (leading + inline), and writeDoc preserves internal blank lines
  as bare // lines so paragraph breaks survive the round trip (an empty
  doc still renders nothing).
- plugin.cue's doc: fields are restored from the base proto
  (b24b168:proto/plugin.proto) as proper multi-line CUE strings. The
  restoration also re-homes the docs the bootstrap SHIFTED onto the wrong
  element: a trailing // comment on a one-line `message X {...}` attaches
  to the NEXT element in emicklei/proto, so InvokeReply's doc sat on
  Frame, RunRequest's on RunReply, and so on down the one-line message
  run (Frame's own doc was lost entirely; GetFileRequest carried
  LiveReply's).
- proto/plugin.proto and the Go stubs are regenerated (task wire:gen;
  byte-reproducible, second run is a no-op) and carry the full docs
  again.
- New TestProtocolDocsComplete locks doc presence, byte length, and
  continuation phrases for every documented message/service/method plus
  the attribution of the previously-shifted docs; it fails against the
  truncated file (verified) where the round-trip test cannot.

Assisted-by: Kimi Code Moonshot Kimi K3 (analysed on a live system)
…, docs

Review nits, each verified against the live code:

- agentkit Store.Teams/Sessions/Federation sorted RFC3339Nano timestamps
  lexicographically, which misorders shared-prefix variable-width
  fractions ("...0.900000001Z" sorts before "...0.9Z" as text, yet is the
  LATER time). One shared sortByTimestamp helper now parses once and
  compares time.Time, surfacing a parse error instead of a silent
  misorder (the regression test fails on the lexicographic code with the
  discriminating prefix pair).
- Store.AbortRequested returned a partially decoded *AgentAbortControl
  alongside a non-nil decode error; callers probe `control != nil ||
  err != nil`, so the pair masqueraded as a valid abort request. It now
  returns nil, err.
- ReplayBuffer.Add's "replay capacity exceeded with unacknowledged
  sequence %d" printed the INCOMING frame's sequence; it now names the
  unacknowledged oldest frame whose loss blocks the eviction (pinned by a
  test assertion).
- Workflow.DecideRecovery documents precisely why the decision is not
  recorded and the incident stays awaiting_recovery: agentkit is the
  transport-independent invariant layer, execution is transport work, and
  the #Incident enum has no intermediate state; the owning durable
  component is candy/plugin-agent's applyRecovery (Store.PutRecovery
  planned -> applied/failed, then PutIncident resolved).
- RelayChannel documents the caller's cancellation ownership: when
  provider output finishes first, the input-copy goroutine may still
  block in upstream.Recv() — the caller cancels upstream's context (or
  closes upstream) after return.
- README catches up with the protocol/schema rewrite: the orphaned
  service parenthetical folds into a sentence, cue:gen documents that it
  chains wire:gen (and what wire:gen owns), and agentkit/, targetkit/,
  testkit/, internal/wiregen/ are listed.
- schema/candy.cue terminal_profile documents the deliberate
  singular-authored (env_provide/mcp_provide convention) vs plural
  wire/label (ai.opencharly.terminal_profiles) mapping — renaming either
  side is a format change. task cue:gen propagated the comment into
  spec/cue_types_gen.go (regeneration otherwise a no-op).

Assisted-by: Kimi Code Moonshot Kimi K3 (analysed on a live system)
The sdk/CLAUDE.md signpost's repo-composition enumeration predates the
agent control plane and the CUE wire pipeline: agentkit/, targetkit/,
testkit/, and internal/wiregen were missing, and proto/ was listed
without its protocol/schema source of truth. Same documentation
divergence class as the README tidy in 8fd8a4d.

Assisted-by: Kimi Code Moonshot Kimi K3 (analysed on a live system)
The SSH fixture's serveSSHSession pumped the child's stderr through a
goroutine reading an os/exec StderrPipe while cmd.Wait() ran: Wait closes
the pipes it created, discarding the child's buffered trailing output
before the pump read it ("read |0: file already closed", swallowed by
io.Copy), and the return path's channel.Close could outrun the pump's
final write. Observed live as a ~1/20 flake in
TestSSHProcessExecutorsPreserveRemoteLaunchAndPipes/nested (kit -race
-count=20): stderr = "", want diagnostic. Same ownership defect class as
the kit/targetkit Wait-monitor race, third surface.

The session's three pipes are now caller-owned os.Pipe ends assigned to
cmd.Stdin/Stdout/Stderr (Wait never touches them; the parent's child-side
ends close right after Start so pumps see EOF at child exit), and a
pumps WaitGroup drains BOTH output pumps to EOF before exit-status is
sent and the channel closes — every trailing byte reaches the client
before it learns the command finished. Verified: the previously failing
test passes 40/40 under -race, and the full kit/targetkit/agentkit/root
-race -count=20 gate is green.

Assisted-by: Kimi Code Moonshot Kimi K3 (analysed on a live system)
@atrawog

atrawog commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Bound identities: protected superproject policy 09be0a4a866e6457bb1207d0a938ce4c96d3c399 (worktree AGENTS.md byte-identical); protected plugins gitlink 9ab9b9811b7ab7af46268e550d0f3dddb8852956 (skills loaded from protected objects; the four plugins#91 skill deltas — git-workflow trailer form, go/plugin/check rows — identified and NOT adopted as policy); protected sdk base b24b168717891860e97eb9bb627ec0375a70048b; bound remote head 084d1ffd1d83014d53754070600aa636bb12c272 (= local checkout, clean, merge-base == base).

Change class: cross-repo charly/sdk Go producer (landing order per body: sdk → pkg-arch#5 → plugins#91 → charly#146 → distro-arch#5).

Independent checklist (all re-derived; nothing inherited from the author)

  • PASS 0 — security & anti-tampering (T1–T4). Policy loaded from protected objects, never from the PR; no embedded directives found; no exfiltration/secrets/obfuscation (added-line scan: only the PR's own exact-argv process/SSH launch surfaces with correct POSIX single-quote escaping, test fixtures, label consts); no weakened gates — the change strengthens SDD (hand-maintained .proto → CUE + generator + reproducibility tests); new deps mainstream (emicklei/proto, fsnotify, renameio/v2, google/uuid); sdk's own CLAUDE.md edit is a repo-description paragraph only, no rule text.
  • PASS 1 — description complete. Org template filled: summary accounting for every diff area, change class, exact gate + pasted outputs, attribution with justification, per-rule HOW lines; the salvage history and the invalid high confidence trailer on ee4cba1 are disclosed honestly (superseded by appended heads with compliant trailers).
  • PASS 2 — change-class gate matches evidence (R7/R10). Gate for this class = standalone sdk battery + the concurrent beds exercising the changed paths. I re-ran EVERY gate myself on the exact head (below); the beds (check-tmux-pod, check-agent-pod) are the correct ones — they drive the process transports (kit/targetkit), the typed terminal channel, and the durable agent store (agentkit) that this PR changes. No dry-run/rebuild-alone fraud; no scope-shrinking flags used by me or found in the author evidence.
  • PASS 3 — attribution tier justified. Head 084d1ff trailer Assisted-by: Kimi Code Moonshot Kimi K3 (analysed on a live system) is space-form with an allowed value and was honest at push time (beds not yet re-run on the final tree); the body's claim that the full roster earns fully tested and validated for the squash is independently confirmed by MY OWN fresh roster below — the changed code paths executed live on fresh rebuilds.
  • PASS 4 — R0 skills honored. pr-validator spec, git-workflow, go, plugin, check, strict-policy, agents, protected tmux loaded and applied from protected text; no claim contradicts an owning skill (protected go/plugin skill deltas on wire:gen/kit imports are exactly what this PR + plugins#91 change — consistent as a family, judged here against the rulebook's SDD mandate directly).
  • PASS 5 — R1 zero warnings; no forbidden framing. My gates: tidy → zero diff, vet clean, gofmt clean, golangci-lint 0 issues (isolated per-worktree cache), tests green, regen no-op, race ×20 green; bed step logs contain zero FAIL/WARN lines. The author's earlier pi-tui-marker failure was RCA'd and root-fixed (distro-arch#5 7ff39b8), not dismissed.
  • PASS 6 — R2. Four prior validator rounds' findings all fixed in-branch (field-13 allocation, SSH placement, real-OpenSSH coverage, store validation, trailer tier); nothing parked.
  • PASS 7 — R3 no duplication. SortedEnvPairs/RemoteLaunchCommand/ShutdownProcessGroup have ONE home (kit/process.go); targetkit/testkit reuse it; kit.ShellQuote is the single quoter. Verified in source.
  • PASS 8 — R4 no workaround. No sleeps/blind retries/magic numbers; ProcessShutdownGrace is a named, documented escalation bound in a graceful-first ladder (stdin EOF → grace → SIGTERM group → grace → SIGKILL), not a race-hiding sleep; pipe sync via caller-owned os.Pipe + channels, addressing the real os/exec Wait race mechanism.
  • PASS 9 — R5 hard cutover + grep. proto/plugin.proto now carries the wiregen DO NOT EDIT banner and is generated from protocol/schema/*.cue; no @go(-) additions in the CUE diff; hand-written CLIModel/CLILeaf/CLIArg structs replaced by CUE-generated spec.CLIModel; proto:gen survives only as a 3-line wire:gen task alias with zero in-tree callers and behavior-identical dispatch — considered and dispositioned verified-non-blocking (public contract repo's dev-facing alias, not a dual-mode code path; both names run the identical task).
  • PASS 10 — R6/R8/R9. R6: 11 linear commits ahead of base, append-only over pushed history, no rewrites. R8: task cue:gen (chains wire:gen) on the committed tree is a NO-OP (git status clean after my run); TestGenReproducible + TestGeneratedProtocolReproducible + descriptor/round-trip tests green; new OCI labels agent_provide/terminal_profiles emitted (deploykit/write_labels.go) and extracted (kit/box_metadata.go) with #BoxMetadata CUE fields. R9: bin/charly version = 2026.200.1143, binary newer than every charly/*.go (freshness guard satisfied); runtime OS deps are pkg-arch#5's scope (sibling PR).
  • PASS 11 — R10 disposable, fresh rebuild, coverage. Beds are disposable: true in box/arch/charly.yml (verified); each ran the full sequence (image-build → check-image → deploy-add → config → start → bring-up-members → check-live → feature-run → update (fresh rebuild) → feature-run-rebuild → cleanup → cleanup-members). Regression tests with teeth: pipe-race test forces the race window deterministically (payload > pipe buffer); store tests reject invalid CUE records/malformed UUID aliasing; timestamp test covers the real lexicographic misorder (.9Z vs .900000001Z); field-13 descriptor + wire round-trip test.
  • PASS 12 — RDD/ADE/SDD @100%. SDD: protocol/schema/*.cue is the proto author-of-record (closed #Protocol model + wiregen validation); schema/agent_control.cue + schema/cli_model.cue CUE-source the new wire types; regeneration no-op verified BY ME; no hand-edited *_gen.go; no new @go(-); store validates every record against its CUE def on write AND read (sdk.ValidateGenerated/DecodeGeneratedJSON). RDD: pipe-ownership mechanism spiked against the os/exec source; composition proven on the beds. ADE: N/A (sdk repo ships no candy).
  • PASS 13 — concurrency mandate + anti-cheat. go test -race -count=20 ./kit/ ./targetkit/ ./agentkit/ . → exit 0 (kit 222.8s) on my own run; both beds launched CONCURRENTLY in one batch by me on one binary; no idle/serial-pass reasoning anywhere in the evidence.
  • PASS 14 — hard cutover. Branch accumulates review-round fix commits (allowed); squash lands ONE commit on main; no TODO/Phase-2 in scope.
  • PASS 15 — architecture gate. placement: CORRECT. SDK-only change: CUE wire envelopes (protocol/schema, schema/agent_control.cue, schema/cli_model.cue), kind-blind mechanisms consumed by ≥2 parties (agentkit store/workflow, targetkit/testkit transports, kit process helpers, deploykit/localpkg staging), generic channel primitives (channel.go SequenceGate/ReplayBuffer/RelayChannel). No concrete-kind schema/switch/map; no charly/*.go touched → per-item alias/kit-import trace N/A. Counterfactual-outward checked: agent/terminal semantics stay in plugins (consumer side), the SDK carries only the generic contract — correct layer.
  • PASS 16 — disposable-only autonomy. Both beds disposable: true; no other destroy/rebuild in evidence.
  • PASS 17 — clean architecture + Go gates (my own runs, exact head 084d1ff): GOWORK=off go mod tidy → zero diff; go mod verify → all modules verified; go build ./... → OK; go test -count=1 ./... → all ok; go vet ./... → OK; gofmt -l . → empty; golangci-lint run ./... → 0 issues; -race -count=20 → exit 0.
  • PASS 18 — CHANGELOG present. CHANGELOG/2026.199.1330.md placeholder (H1 matches filename; I finalize the merge-time CalVer in Phase 3).

My own R10 evidence (nothing inherited)

$ GOWORK=off go mod tidy && git status --short            # → empty (no drift)
$ GOWORK=off go mod verify                                # all modules verified
$ GOWORK=off go build ./...                               # OK
$ GOWORK=off go test -count=1 ./...                       # all ok (non-cached)
$ GOWORK=off go vet ./...                                 # OK
$ gofmt -l .                                              # empty
$ GOLANGCI_LINT_CACHE=<isolated> golangci-lint run ./...  # 0 issues.
$ GOWORK=off go test -race -count=20 ./kit/ ./targetkit/ ./agentkit/ .
ok  github.com/opencharly/sdk/kit        222.817s
ok  github.com/opencharly/sdk/targetkit  4.940s
ok  github.com/opencharly/sdk/agentkit   2.295s
ok  github.com/opencharly/sdk            24.884s          # exit 0
$ task cue:gen && git status --short                      # → empty (wire:gen + spec regen NO-OP)
$ go test -count=1 -run 'TestGenReproducible|TestGeneratedProtocolReproducible|TestProtocolDocsComplete' ./spec/ ./internal/wiregen/
ok  github.com/opencharly/sdk/spec               0.276s
ok  github.com/opencharly/sdk/internal/wiregen   0.014s

Concurrent validator roster (one binary 2026.200.1143, shared run-calver 2026.200.1300, launched in one batch from the assembled superproject root with CHARLY_REPO_OVERRIDE=github.com/opencharly/charly=<root>):

$ ./bin/charly -C box/arch check run check-tmux-pod    # exit 0 — 12/12 steps ok, total 166s
$ ./bin/charly -C box/arch check run check-agent-pod   # exit 0 — 12/12 steps ok, total 290s
.check/<bed>/2026.200.1300/summary.yml: ok: true (both); zero FAIL/WARN lines in every step log (both beds)
check-agent-pod check-live.log: agent-capability-labels / native-pi-two-process-resume /
  pi-official-orchestrator-delegation / pi-tui-rendered / pi-tui-help-rendered / pi-tui-quit-verify /
  deployment-grpc-tmux / ssh-grpc-tmux-and-federation — all PASS exit=0

Comments considered

  • 2026-07-18T23:25Z FAIL (head d076355): missing template evidence; field-12 collision with sdk#72; SSH cwd/env applied to local carrier → verified-repaired on this head: template filled; command_model_json is field 13 (protocol/schema/plugin.cue:127, proto/plugin.proto:54), field 12 free in ProvidedCapability; stdioLaunchPlan keeps cwd/env off the local ssh carrier (exec case → local child; ssh case → remote command string only).
  • 2026-07-19T00:41Z CHANGES-REQUESTED (head d2a16057): real-OpenSSH fixture discarded the exec payload → verified-repaired: testkit executes the RFC4254 exec payload via sh -c; TestGRPCOverRealOpenSSH asserts remote WorkingDir+env on the remote helper AND absence of both on the local carrier.
  • 2026-07-19T03:49Z CHANGES-REQUESTED (head 5a310e52): store bypassed CUE validation; malformed IDs collapsed to one invalid filename → verified-repaired: validatedRecordName rejects invalid UUIDv7; marshalGenerated validates on write; DecodeGeneratedJSON strictly decodes + validates on read; filename↔ID consistency enforced; regression tests present.
  • 2026-07-19T07:48Z CHANGES-REQUESTED (head ee4cba1): invalid high confidence trailer → verified-repaired: head 084d1ff carries an allowed-tier space-form trailer; the body discloses the superseded invalid trailer; the squash carries one canonical trailer.

Cross-PR interactions considered

Decision: PASS. All 18 checklist items verified on the exact bound head 084d1ffd1d83014d53754070600aa636bb12c272 by my own re-runs; the prior four rounds' blockers are each independently confirmed repaired. Proceeding to Phase 3: merge-time CalVer finalization on the feat branch, status re-post on the new head, squash merge, and the sdk v0.<YYYYDDD>.<HHMM-stripped> tag.

Assisted-by: Kimi Code Moonshot Kimi K3 (analysed on a live system)

Assisted-by: Kimi Code Moonshot Kimi K3 (fully tested and validated)
@atrawog
atrawog merged commit 76df6c0 into main Jul 19, 2026
@atrawog
atrawog deleted the feat/agent-control-plane branch July 19, 2026 13:15
@atrawog

atrawog commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — landing outcomes (Phase 3, all ALLOWED)

  • charly/pr-validator=success posted on validated head 084d1ffd1d83014d53754070600aa636bb12c272 and re-posted on finalized head bc840f3c858ce13b8feb6e3cf7ff0642683fcfb8 — ALLOWED.
  • Merge-time CalVer 2026.200.1312 finalized on the feat branch (CHANGELOG/2026.199.1330.md → CHANGELOG/2026.200.1312.md, H1 rewritten, append-only commit bc840f3) — ALLOWED, pushed non-force.
  • Squash merge executed with --match-head-commit bc840f3… — ALLOWED. Merge commit: 76df6c096c7698d186c2d4a0f7c4ecf86e934c3a (mergedAt 2026-07-19T13:15:10Z). Tree proof: merged tree 06e31a8f79dacf35e29cc6191e42fc0b14ece0c2 == validated head tree (byte-identical).
  • Tag v0.2026200.1312 (annotated, object ea3b22b71612f495633ea75ff264768182e99398) pushed on the merged HEAD; git ls-remote --tags origin v0.2026200.1312 non-empty — ALLOWED.
  • Feat branch deleted at merge; no force-push, no --admin, no direct push to main at any point.

Assisted-by: Kimi Code Moonshot Kimi K3 (analysed on a live system)

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