agent: builder model: opus max_turns: 90 budget_usd: 18 —
last()/first()/get() or m[k], handed back by value, reaches rustc (E0308) instead of NK1131Blocks: none (a workaround in tools/ waits for it; moved from the main lane by the architect, 2026-10-31)
Score: compiler bug, false acceptance (nikaia check passes, rustc refuses), and it forced a workaround into tools/ (debt, CLAUDE.md Fix, do not work around); bugs-first default of docs/priorities.md. One cause traced.
Found while building #859 step 4. let s = path.last() ?? return null then return s, over a Vec of a type that does not copy, lowers s as &T and rustc stops with E0308. The issue’s own probe used a described type; a user struct shows it the same way.
struct Sym { name: String, n: i64 }
fn last_sym(path: Vec[Sym]) -> Sym? {
let s = path.last() ?? return null
return s
}
Lowered: fn last_sym(path: &[Sym]) -> Option<Sym> { let s = match path.last() { Some(v) => v, None => return None }; Some(s) }.
Rows (all probed; every one passes nikaia check and fails in rustc today):
last()).path.first().path.get(i) (i: i64 a second parameter).return path.last() directly (no let).fn from_map(m: collections::HashMap[i64, Sym]) -> Sym? { let s = m[1] ?? return null; return s } (use std::collections at the top).let v = [Sym {..}, Sym {..}]; let s = v.last() ?? return null; return s.b, must stay): let s = path.last()?.clone() ?? return null; return s.Vec[String] row a runs (tiering, ADR-282), leave it.Nikaia never copies behind your back. Part I and Part III already say so for both halves: a map’s value that does not copy, kept where a T? of its own is wanted, “is written m[k]?.clone()” (Part I, 10-nikaia-light.md ~1766-1770); and NK1131 refuses a piece of a borrowed subject handed back by value, “a let over a place” among the borrowed subjects (Part III, 30-nikaia-tooling.md:1746, the NK1131 also sentence). An element read by first(), last(), get(i), m[k] or m.get(k) is a view of what the list or map keeps (owned or lent alike), so rows a-f are NK1131, with the help …?.clone(). Not a silent clone; not a new code.
let shape; row d unverified)check_core_a_lent_place_given_away (check_core_leaves.nika:74) refuses a name given away whole only when the local’s view_of is set (Expr::Variable arm, :82-121; if (local.view_of == "" && !a_let_view) || !keeps { return }). view_of is set in one place only, the for mut binding (check_core_stmt.nika:1646, local.view_of = dotted_path(world, iter) ?? ""). A let bound to an element read through ?? with a jump fallback never sets it, so the return passes. Row d (return path.last() with no name) is a method call, which the function’s match value has no arm for: it is the same rule, but the architect did not trace which arm it needs.
check_core_leaves.nika: :74 check_core_a_lent_place_given_away (:82 the Variable arm and its message for an element, :113-119; the Field arm after it); the NK1131 callers at a return: :49-64 (check_core_a_lent_place_given_away(state, world, host, value, span, true, true)).check_core_stmt.nika: :531 check_core_stmt_let (where the let should record view_of for an element read through ?? with a jump fallback: return, continue, break, throw); :1646 the for mut model.check_state.nika:69 view_of on a local.check_exprs.nika:316 a_fallback_beside_what_a_map_holds (NK1185, the same “never a copy behind your back” wording for maps).check_core_flow.nika:1208 let frame = state.scope[state.scope.len() - 1].clone() (in check_core_flow_changed_copies; the if state.scope.len() == 0 { return } above it goes with it).crates/nikaia-std/src/tools/lowered/, regenerated by lower-std.docs/builder-facts.md first.NK1131 at the return: a let bound to X.first(), X.last(), X.get(i), X[k] of a map or X.get(k) of a map through ?? with a jump fallback records view_of = X when the element’s type does not copy (use the same “does not copy” test the Variable arm already uses: copies_plainly, state.copied, copies_in_the_package, text excluded). Row d is refused the same way at the call. The message names the list (… it is an element of \path`, which …), the help Write `path.last()?.clone()` for a copy (the read as written, then ?.clone()). Row g still runs and prints b`. An owned local (row f) is the same refusal; word its note so it does not say “lent” (the list keeps its element). If a row cannot be reached without a fact the checker lacks, stop on that row (see Stop).30-nikaia-tooling.md:1746, after the sentence ending “a result declared ref T is the view and is not asked.”, add: “So is an element read by first(), last() or get(i) of a list, or by m[k] or m.get(k) of a map, handed back by value directly or through a let that binds it with ?? and a jump: what the list or map keeps is lent, owned list or not, and the help writes …?.clone().” (No version line: the supervisor raises it.)check_core_flow.nika:1208 becomes let frame = state.scope.last()?.clone() ?? return and the len() == 0 guard above it goes; lower-std.tests/compiler/tests/an_element_read_handed_back_by_value.nika + .stderr with rows a-f (one function each, a main that calls none of them is fine if the checker reports all six; else split per row into as many files as needed, same name with a suffix), and tests/compiler/tests/an_element_read_copied_with_clone.nika + .stdout with row g and the ?.clone() form of rows b, c, e. Commit check: an element read by last/first/get or a map, handed back by value, is NK1131 (Fixes #1044).Both tests pass through nikaia test --project tests/compiler; the refusal test fails on the unfixed compiler (run rows a-f on the current binary before your first edit and keep the result under Tests:); the tests nikaia run scripts/where.nika -- NK1131 check_core_a_lent_place_given_away check_core_stmt_let lists pass (the crates/nikaia/tests/it/ ones by their filter, singly); lower-std fixpoint clean; cargo build --profile fast -p nikaia; clippy; the guard set of .claude/agents/builder.md green (the sequences/corpus guard counts the tools’ own code: a new refusal that fires on tools/*.nika is a finding in our code, fix that line with ?.clone() in the same commit and name it in Body:); pushed. Changelog: one line. Stop about 15 turns before max_turns, commit what is finished and report partial.
An edit is needed outside check_core_leaves.nika, check_core_stmt.nika, check_state.nika, check_core_flow.nika, a tools/*.nika line the new refusal fires on (fixed with ?.clone()), their lowered twins (and lowered.rs), files lower-std rewrites because of your change, 30-nikaia-tooling.md (step 2’s sentence only) and the two tests; an error in another agent’s file; a row needs a rule Part I does not give (then Result: blocked, Needs: owner decision). tests/compiler failures from a binary vanishing mid-run (another agent rebuilding) are not yours: run the named tests singly instead.
Not yours, never stage: every file git status shows modified or untracked at your start (today among them crates/rs2nika/convert/*, a stray file whose name starts ork in the tree)), and every docs/briefs/* file except your report. docs/briefs/b859c-type-argument.md belongs to another session.
docs/builder-facts.md first. develop in the main checkout; git status at start: other agents’ uncommitted files are not yours, never touch or stage them.git add <files> only; commit after each step; git push origin develop fast-forward, no rebase (rejected: report Pushed: rejected, go on committing).cargo fmt, cargo clippy --all-targets -- -D warnings, scripts/pre-push-check.sh, and the gate of .claude/agents/builder.md (#852).CHANGELOG.md, badges; no new NK code. New tests in Nikaia only; never the full suite. No foreground sleep, no polling; scripts in files.std or the toolchain lacks stops the work: no code around it unless an ADR or Part I-III refuses it (name it). Else Result: blocked, Found: gap + probe, Needs: owner decision (CLAUDE.md, A missing form stops the work).NIKAIA_CACHE_LIMIT=2G; at most two clones with target/ in the machine; delete your own clone’s target/ and target/release/nikaia-scratch at the end; report GB freed.Pushed: line names the pushed sha. A report without a Pushed: line, or with a placeholder left in (TC, DISK), is not done and cuts the batch (k3a1 2026-10-29: Result: done, nothing committed)./home/user/Nikaia/docs/briefs/bugs/b8-1044-last-view-handed-back.md.report.md)Fields of docs/architect.md, Briefs and reports: Result: done|noop|partial|blocked (the bare word alone on that line: Result: done, never a summary after it, which cuts the batch, b869a 2026-10-27; Owner: is a question for the owner or none, never a role), Files, Commit, Body (optional, one paragraph for the commit message), Fixes, Pushed, Tests, Gate (green|red), Deviation, Found, Needs, Changelog, Owner, Disk freed, and for a move Rs2nika: (the kept N of M lines of rs2nika --score, then the three costliest hand edits; none for a task that moves no Rust, none (redesign) for a brief with Shape: redesign and no Convert: line). none where nothing, and then the bare word: Deviation: none (a note) cuts the batch (batch.nika compares exactly); a note goes into the commit message. Found: is only for a defect outside your change (it cuts the batch); a process event such as another session resetting or rewriting your files is no Found:, it goes under Needs: (m3a 2026-10-28); a converter draft that came out wrong is no Found:, it is one of the costliest edits under Rs2nika:, which the converter lane reads (e12-4b 2026-10-27); how you solved your own step goes into the commit message. Deviation: is only a step of the brief built otherwise than written or not built (a choice the brief left to you, such as keep what X needs and say so, is no deviation: it goes into the commit message; nor is building two steps in one commit when every step is built, e12-3a 2026-10-27, nor a step another commit on develop already built, shown by your test failing with that commit’s change reverted, b889 2026-10-27: name the commit in Body:, nor a test’s expected .stdout/.stderr taken from what the program really prints where the brief’s sketch of it was short or wrong, b934 2026-10-29: say so in Body:, nor a lowering that follows the ADR governing it where the brief’s expected lowering contradicts that ADR, b933 2026-10-29: name the ADR in Body:, nor a lowering other than the brief’s where rustc cannot take the brief’s, b1029 2026-10-31: say why in Body:, nor re-keying an allow-list entry (KNOWN) whose hash changed for the same program and the same reason, b-fixforward-sweep2 2026-10-28: say so in Body:, nor an existing test’s expected .stdout/.stderr updated because your change rightly changes the message it prints, b1012b 2026-10-31: name the test in Body:); how you verified (e.g. a test not run against the unfixed compiler) goes under Tests:. A noop says why under Tests: (what was probed), not under Deviation:. Final answer, one line: done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).
Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01GFeMqxRbtUMiGVyDMxsvEq