fix(codegen): emit the declared cgi identity — it was searched for in a list that cannot contain it #88
Closed
tim.lingo
wants to merge 1 commits from
fix/cgi-identity-emission-clean into main
pull from: fix/cgi-identity-emission-clean
merge into: :main
:main
:feat/engram-reseed-route
:feat/el-route-decorators
:test/dev-ci-baseline
:fix/cgi-identity-emission-clean
:fix/cgi-identity-emission
:dev
:feat/AddingReadme
:stage
:reconcile/el-cluster-windows-runtime
:fix/durable-response-truncation
:fix/engram-lexical-tokenized-search
:fix/http-fs-read-len
:hotfix/ci-stage-main-publish-hardening
:hotfix/ci-dev-publish-hardening
:hotfix/stage-elc-engram-integration
:feat/ranked-engram-search
:hotfix/win-runtime-portability
:hotfix/runtime-engram-get-node-by-label
:feat/engram-semantic-search
:hotfix/elc-fixes
:hotfix/el-runtime-leak-and-persist
:integrate/local-main-commits
:fix/runtime-load-merge-2026-06-30
:fix/windows-rusage-guard
:fix/http-response-truncation
:salvage/tim-wip-presync-20260625
:feat/windows-el-runtime
:feat/accumulation-layer
:fix/runtime-integrity-reconcile
:fix/engram-save-atomic-darwin
:chore/live-darwin-runtime
:feat/wm-api-and-http-serve-async
:fix/engram-node-full-field-corruption
:fix/llm-model-and-utf8
:fix/elb-monolithic-link
:fix/ci-gcloud-install-order
:fix/native-test-precompile-runtime
:fix/ci-base-dev-first-run
:fix/elc-parser-elb-build
:fix/elc-oom-checkout
:fix/css-str-join-separator
:fix/html-template-if-style-script
:fix/elb-gcc-bracket-depth
:fix/ci-openssl-linker
:feat/ci-hook-test
:feat/native-testing
:runtime/integrate
:fix/http-serve-1-arg-compat
:feat/el-html-templates
:feat/js-browser-runtime
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "fix/cgi-identity-emission-clean"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A
cgiblock declares an agent's compound identity — name, dharma_id, principal, network, engram. None of it reaches the compiled output. Every binary built with this compiler carries no declared identity at all, which is what IDPROTO claims 1-2 require it to carry.The bug
A
cgiblock is a top-level declaration, socodegen_streamingclassifies it withis_top_level_decland callsel_release(stmt)— correctly; it isn't executable. The identity emission then searchedtoplevel_exec_stmtsfor that same block. Declarations are excluded from that list by construction, so the search could never succeed.A probe printing what the search actually sees, for a program whose first statement is a
cgiblock:The code documented its own assumption — "Since cgi blocks are rare and small, they end up in toplevel_exec_stmts" — and that assumption was false. It emitted nothing, silently, with no diagnostic on any channel.
The fix
Capture the declared values before the release (they're strings, so no dangling reference) and emit from those. The search is deleted rather than repaired, so the failure mode is removed rather than relocated.
Proven discriminating — old fails, new passes
cgiprogramel_cgi_initel_cgi_initwith all four declared valuesAnd at runtime, first line of stdout before the soul boots:
Notes for whoever builds this
compiler.elimports lexer/parser/codegen, so the existingelcbootstraps it directly.lang/elc-combined.elis stale (Jun 5) and was not used.lang/elc.cdoes not build against the pinnedv1.0.0-20260501release runtime — it needslang/el-compiler/runtime(missingstdout_to_file/stdout_restore). That cost an afternoon; worth documenting.Rung: E2E-VERIFIED in an isolated lab. The rebuilt compiler is not installed anywhere.
Companion:
neuron-technologies/neuronbranchfeat/cgi-identity-accessors, which adds read-only accessors so a consumer can actually read the compiled constant. Without this codegen fix those accessors return empty.A cgi block is a top-level declaration, so codegen_streaming classifies it via is_top_level_decl and releases it. The identity emission then searched toplevel_exec_stmts for that same block. Declarations are excluded from that list by construction, so the search could never succeed. A probe printed what it actually saw for a program whose first statement is a cgi block: [Let, Expr]. It emitted nothing, silently, with no diagnostic on any channel. The code documented its own assumption — 'Since cgi blocks are rare and small, they end up in toplevel_exec_stmts' — and that assumption was false. Capture the declared values before the release and emit from them. The search is deleted rather than repaired, so the failure mode is removed rather than relocated. Proven discriminating (old fails, new passes): minimal cgi program, old -> 0 el_cgi_init minimal cgi program, fixed -> el_cgi_init with all four declared values neuron soul, fixed -> principal present in the compiled binary (0 before), boots in 2s, interface 110 routes in / 110 out Consequence: a binary now carries its declared identity as a compiled constant, which is what the identity protocol requires. Whether the runtime surfaces it to state_get("soul_principal") is unverified and separate. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>Pull request closed