Issue #1851: binary-trees loses 5.75x to Rust #5 because each node of a Nikaia recursive…

Open and answer this issue on GitHub.

blocked, bugs · opened 2026-11-16 · updated 2026-11-19 · 5 comments

Filed by the driver from the Found: of the run of issue-1615 (#1615) (owner, 2026-11-06).

Found

binary-trees loses 5.75x to Rust #5 because each node of a Nikaia recursive enum is its own malloc/free (lowered Node(std::boxed::Box<Tree>, std::boxed::Box<Tree>), 71 % of instructions in glibc malloc/free at nikaia run benches/game/game.nika -- binary-trees), while ADR-327’s per-task block, which would make them bump allocations freed with the task, places no Box yet (Place::Outside: “whatever the emitter cannot yet place (#490 step 5)”, crates/unsafe/task-block/src/lib.rs); expected: the boxes of a tree built inside a task go to its block; suspected place the emitter’s Box allocation in emit (Box::new) and #490 step 5

To build

Done when

The probe or check gives the expected output the first item names from its ADR or Part I-III section, and a tests/compiler/tests/ test (or the named check) that failed on the unfixed tree is green; or the issue is closed as by design, naming the function or ADR.


Generated by Claude Code

Comments

keywan-ghadami, 2026-11-16

Brief queued: issue-1851


agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —

Issue #1851

Your work order is issue #1851, inlined below with its comments. There is no brief written around it: plan your own steps from its To build list, build them in order, commit after each finished step, and end when its Done when holds (or at the limits of builder.md, reporting what is left). The facts in your prompt are Core of docs/builder-facts.md; more on a topic: nikaia run scripts/syntax.nika -- KEYWORD, a probe: nikaia run scripts/probe.nika -- SNIPPET.

Measure the issue against docs/issues.md while you work: what it lacked, what was wrong in it. That answer goes into the report’s Issue: field. A finding, a changed plan or a finished item also goes into the issue as a comment (gh api repos/Nikaia-Foundation/Nikaia/issues/1851/comments -F body=@file, ending with the Claude Code footer), rule I13.

Rules (CLAUDE.md; shared checkout)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/bugs/issue-1851.md.report.md)

Fields: Result, Files, Commit, Body (optional), Fixes, Pushed, Tests, Gate, Deviation, Found, Needs, Changelog, Issue, Owner (a question for the owner), Comment (#N <text>, what to say on another issue; the driver posts it, one line each), Friction, Disk freed, and last Attribution: with your commit trailer lines below it.


Generated by Claude Code

keywan-ghadami, 2026-11-16

Run: issue-1851, Result: blocked

Tokens: input 18, cache read 342009, cache write 34077, output 4148 Cost: 0.46 USD, time 1 min 7 s, turns 9

Report

Result: blocked Files: none Commit: none Body: none Pushed: none Tests: none run; nothing committed (checked: crates/unsafe/task-block/src/lib.rs has Place/List/Text placed in the block but no block-backed Box type; emit_core_places.nika and emit_core_args.nika place only lists and String() text; git log -400 –grep=’Fixes #490’ finds nothing, so #490 is open) Gate: green Deviation: none Found: Recursive-enum boxes are never placed in a task’s block: a Nikaia recursive enum lowers to std::boxed::Box<Tree> (global malloc/free per node, 71 % of binary-trees’ instructions per #1851), and task-block offers no Box at all, only List/Text with Place; this is the unbuilt part of the memory budget’s placement (#490 step 5, ADR-327 D8/D9/D13/D14), not a defect; no decision yet on the Box representation Needs: #490 (step 5 unbuilt); supervisor decision: how a recursive enum’s box is placed (a Place-carrying Box<T, Place> doubles each node pointer to 16 bytes; a zero-sized allocator that frees by address and allocates in the running task’s block keeps 8 bytes but makes one Rust type for both placements, so a tree handed out of its task (D9) needs a placement decision per construction site and a try_new_in route to task::OverBudget, which by D13 adds OverBudget to the throw set of every task that builds a tree) Changelog: none Issue: wrong I5: filed as a defect from a Found, but ADR-327 and task-block’s own docs say Box placement is #490 step 5, not yet built, so it is feature work waiting on #490 and on a representation decision; broke I6: names no Needs #490 and no no decision yet, so the driver filed it ready Owner: none Comment: #490 step 5 should cover the boxes of recursive enums (binary-trees loses 5.75x to Rust #5 on per-node malloc/free, #1851); the box representation needs a decision first: Place-carrying Box (16-byte pointer) or a zero-sized, by-address allocator with per-site placement Friction: none Disk freed: none (cache 365M, disk 6.7G free) Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01UVxJDwk9ubq9teP7QCErff

Debrief

  1. Most cost: almost nothing; it took about 8 tool calls. The one real question was whether this is a defect or unbuilt work. Grepping task-block/src/lib.rs, ADR-327 and the emitter’s Place::Block sites settled it quickly.
  2. Looked up: that #490 is still open, found with git log --grep='Fixes #490' because the issue is not in the prompt. Also ADR-327 D13/D14, which say placement is “step 5 of #490”, and the fact that only lists and String() text are placed today (emit_core_places.nika, emit_core_args.nika). The brief could have given me all of this, starting with #490’s state.
  3. Checks: greps and a git log only. I did not run the Found’s command (nikaia run benches/game/game.nika -- binary-trees), nor any probe of the lowered Box<Tree>. The blocked verdict rests on reading the code, not on a reproduction. The rules ask for the probe before calling something blocked, so that is a gap in my run. Nothing was wasted.
  4. Change: when the driver files a Found: that names unbuilt work of an open issue (“#490 step 5”), it should record that as Needs #N and put #N’s state in the prompt. Then the run is skipped, or blocks in its first turn.
  5. Issue judgment: I did not read docs/issues.md, so the rule numbers in my report’s Issue: field are guesses and the supervisor should check them. In substance: the issue is filed as a ready defect, but its own Found says the cause is unbuilt planned work. It lacks a Needs #490 and a “no decision yet” note, and it gives no probe of a lowered snippet (wrong I5? / broke I6?). A rules-gap: no rule tells the driver to check an issue’s Found for a reference to an open issue’s unbuilt step before labelling it ready.
  6. Facts:
    • Fact: Core Task-block placement covers only lists and String() text (emit_core_places.nika, emit_core_args.nika); Box and recursive enums have no block type and wait on #490 step 5, so a performance issue about per-node malloc is blocked on #490, not a defect.
    • Fact: Core An issue the prompt does not include is open unless git log -400 --grep='Fixes #N' finds its fix; check this first for any issue a Found names as “step N of #M”.

Generated by Claude Code

keywan-ghadami, 2026-11-16

The report of the run of issue-1851 (#1851) judged this issue against docs/issues.md; the author fixes the issue by the rule it names (How a run judges its issue):


Generated by Claude Code

keywan-ghadami, 2026-11-16

Decided by the supervisor (2026-11-16, by the language principles): ADR-327 D16.

This issue stays blocked on step 5 of #490 (Memory budgets per task), which now includes the boxes.


Generated by Claude Code

keywan-ghadami, 2026-11-19

From the report of the run of issue-1879 (#1879):

binary-trees’ boxes are built in bottom_up’s return value. The local placement fact (check_core_place_in_block) cannot place them, so #1879 waits for a decision on placement across calls (a whole-program analysis of where a result goes, the caller choosing the place, or a copy out at the hand-over)


Generated by Claude Code

Back to Open Issues