Skip to content

Measure indirect-reference decomposition with an out-of-band seeded referent - #2251

Merged
malibio merged 3 commits into
mainfrom
issue-2248-seeded-referent
Aug 23, 2026
Merged

malibio merged 3 commits into
mainfrom
issue-2248-seeded-referent

Conversation

@malibio

@malibio malibio commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Closes #2248 — this time for real. Follows #2250, which explicitly did not.

The finding that made this possible

Two prior attempts failed, and their failures generalise into one rule:

No value a scored turn writes can be the referent. Every scalar the agent writes is replayed by terse_write_fact, so the target is always sitting in the prompt as literal text.

A genuinely indirect reference therefore needs a referent the agent never wrote.

What this adds

EvalFixture.seedGroup(env, group) — establishes graph state before a group's first turn, through the CLI. completed_writes is built only from a turn's own tool executions, so seeded nodes leave no trace in the rendered prompt: not a title, not a property, not an id.

Worth being precise about the design stance, since I initially read it as a blocker: "assert, do not own" and "never starts or seeds anything" are about daemon and database lifecycle — the caller starts the daemon and owns the DB, and still does. Writing nodes through the CLI is something the runner has always done for every group; newChat creates the chat node exactly this way. The hook names an existing capability rather than adding a new kind of power.

Scenario 13 seeds three incident records, one of which Rowan was on call for, then asks: "The incident Rowan was on call for — mark it resolved." Nothing in history identifies it. The model must look it up.

Both halves proved, per the #2242 discipline

Proof What it establishes
scenario_13_seeded_referent_is_absent_from_history Renders the real history and asserts the on-call name, all three titles, the type and the property name are absent — with a positive assertion so it cannot pass vacuously on an empty render (the trap that let scenario 12's proof look sound)
scenario_13_ideal_lookup_then_write_is_accepted Against a live backend: the property filter returns the one matching incident and not the other two, and the write persists. This is the fragile half — a filtered search_nodes routes through QueryService, a different code path from every other scenario

toolSequence is live again — honestly this time

Scenario 13 is the only scenario whose route is genuinely forced: the id cannot be known without a read. That is the one condition under which asserting a subsequence is truthful, and a new invariant pins that it is asserted nowhere else — reviving it on a turn where a direct write is also correct is the mistake #2242 removed from scenario 6 and #2250 removed from 12d.

Two things found while building this

A title leak, pinned rather than assumed away. a_turns_own_write_leaks_its_targets_title_via_the_evidence_block: the Fact: line for an update_node is id-and-values only, but the evidence block renders update_node "<summary>", and write_summary_arg resolves an update's summary through content/title — so the node's title reaches the prompt. Harmless for 13 as written (single-scenario group, nothing reads that history), but a live constraint on ever extending that group, and completely silent if unpinned.

A real collision, caught by the new invariant on its first run. The invariant asserting no prompt names the seeded titles or type immediately failed: scenario 8c's prompt already contained the name I'd picked for the on-call value, which would have put the referent into a shared chat's history. I renamed the seeded value rather than 8c's prompt, since ids are the baseline join key and rewording 8c would change what it measures.

Verification

  • bun run test:all exits 0; all three new tests confirmed running inside it
  • bun run quality:fix clean; full pre-push gate green
  • Frontend baseline unchanged: 227 files / 4794 tests
  • Matrix now 8 groups, 27 scenarios, 21 scored

🤖 Generated with Claude Code

https://claude.ai/code/session_012A1ryuphm1PidSY1KTvcKG

…eferent (closes #2248)

Adds scenario 13, whose referent the agent never wrote — the thing #2248 asked
for and that two prior attempts could not provide.

THE FINDING THOSE ATTEMPTS PRODUCED. Scenario 6 asserted a resolve-then-act
chain for "the five-day one"; #2242 found the referent was a direct string
match, because a create_node write is replayed into later turns as a terse fact
carrying its property values AND its id inline. Scenario 12 then keyed off a
COMPARATIVE over three written values; #2250's review found that fails the same
way for a subtler reason — the values are all inline, so the ranking is
derivable in-context without reading anything.

Generalised: NO VALUE A SCORED TURN WRITES CAN BE THE REFERENT. Every scalar the
agent writes is replayed, so the target is always in the prompt as literal text.
A genuinely indirect reference needs a referent the agent never wrote.

WHAT MAKES THAT POSSIBLE. `EvalFixture.seedGroup` establishes graph state before
a group's first turn, through the CLI. `completed_writes` is built only from a
turn's own tool executions, so seeded nodes leave no trace in the rendered
prompt — not a title, not a property, not an id.

This is not a reversal of the harness's "assert, do not own" stance, which is
about DAEMON AND DATABASE LIFECYCLE: the caller starts the daemon and owns the
DB, and still does. Writing nodes through the CLI is something the runner has
always done for every group — `newChat` creates the chat node exactly this way.
The hook names that existing capability rather than adding a new kind of power.

Scenario 13 seeds three incident records, one of which Rowan was on call for,
and asks to resolve "the incident Rowan was on call for". Nothing in history
identifies it, so the model must look it up. Both halves proved rather than
assumed, per the #2242 discipline:

- `scenario_13_seeded_referent_is_absent_from_history` renders the REAL history
  and asserts the on-call name, all three titles, the type and the property name
  are all absent, with a positive assertion so it cannot pass vacuously.
- `scenario_13_ideal_lookup_then_write_is_accepted` proves against a live
  backend that the property filter returns the one matching incident and NOT the
  other two, and that the write persists.

`toolSequence` is live again, on 13, and honestly: this is the only scenario
whose route is forced, because the id cannot be known without a read. A new
invariant pins that it is asserted nowhere else — reviving it on a turn where a
direct write is also correct is the mistake #2242 removed from scenario 6 and
#2250 removed from 12d.

Also found while proving the absence, and pinned rather than assumed away:
`a_turns_own_write_leaks_its_targets_title_via_the_evidence_block`. The Fact:
line for an update_node is id-and-values only, but the evidence block renders
`update_node "<summary>"`, and `write_summary_arg` resolves an update's summary
through content/title — so the node's title reaches the prompt. Harmless for 13
as written (single-scenario group, nothing reads that history) but a live
constraint on extending it, and silent if unpinned.

A second new invariant asserts no prompt anywhere names the seeded titles or
type. It caught a real collision on its first run: scenario 8c's prompt already
contained the name originally chosen for the on-call value, which would have
put the referent in a shared chat's history. Renamed the seeded value rather
than 8c's prompt, since ids are the baseline join key.

test:all exits 0; quality:fix clean. Frontend baseline unchanged at 227/4794.
Matrix is now 8 groups, 21 scored scenarios.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_012A1ryuphm1PidSY1KTvcKG
@malibio

malibio commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator Author

Code Review — PR #2251

Review Type: Initial Review
Scope: be36f0ea on e1450d6e (6 files, +624/−11)
Verification run: bun test scripts/eval/fixtures/agent-matrix.test.ts 69 pass · cargo test -p nodespace-daemon --lib scenario_13 1 pass · plus one new empirical probe of my own (below), which is where this review turns.


Summary

This is the third attempt at #2248, and it is materially the strongest. seedGroup is the right primitive, the snapshot interaction is genuinely correct, the --runs/noUnexpectedNodes reasoning mostly holds, and the discipline of proving both halves (absence + winnability) is exactly what #2242 established.

But the central claim is stated too broadly, and the overreach is load-bearing:

"seeded nodes leave no trace in the rendered prompt at all — not a title, not a property, not an id."

The first half is true. The not a property clause is false, and I confirmed it by execution, not by reading. seedIncidents creates a schema as well as three instances, and the schema — including the field name on_call, the exact property the reference keys off — is retrieved semantically and interpolated verbatim into the system prompt via {{ workspace_context }}.

This is the same failure shape as 6 and 12 in its structure — a passing absence test that asserts the wrong channel — though it is less severe in consequence: what leaks is the vocabulary, not the answer. Scenario 13 still cannot be won without a read. So the scenario survives; its description does not, and one assertion (incident_report / on_call "never in any prompt") is now provably wrong about the system it claims to guard.

Findings 1 and 2 should land before merge. Both are comment/test corrections plus one small design decision — no rewrite of the scenario is required, which is the good news here.


Requirements Check — #2248

Criterion Status
Chain whose referent is genuinely not recoverable from history ✅ Met. Verified independently — see Finding 1 for the one qualification
Referent absent proved by rendering actual history, not assumed ⚠️ Partially. Proved for the history channel; the system-prompt channel was not checked, and it leaks
toolSequence revived end-to-end ✅ Met — with a caveat (Finding 3)
Winnability proved before assuming the scenario tests what it claims ✅ Met, on a live backend, including the discrimination assertion
Designed against #2243 outcome scoring (end clause + trajectory diagnostic) ✅ Met — end scores, expect is diagnostic

Findings

🔴 Finding 1 — The "no trace at all" claim is false: the seeded schema (including on_call) reaches the system prompt

📁 scripts/eval/types.ts:264-289 · scripts/eval/fixtures/agent-matrix.ts:1482-1560 · packages/daemon/src/services/local_agent_service.rs:4146-4170

The absence proof covers exactly one channel — node_history_from_messages. It is correct about that channel. But seedIncidents does not only create nodes; at agent-matrix.ts:519-536 it creates a schema:

name: SEEDED_TYPE,                       // "incident_report"
description: "A production incident and who was on call for it",
fields: [
  { name: SEEDED_ONCALL_FIELD, type: "text" },   // "on_call"
  { name: "resolved", type: "boolean" },
]

That schema reaches the prompt through a path the tests never touch:

  1. local_agent_service.rs:594 — schema_retrieval_query(&prior_history, &user_message). Scenario 13 is the first turn, so the query is the bare prompt: "The incident Rowan was on call for — mark it resolved."
  2. local_agent_service.rs:596 → context_ops::build_workspace_context → semantic_search_nodes_of_type(q, "schema", …) at context_ops.rs:320-327, with SCHEMA_SIMILARITY_THRESHOLD = 0.2 (context_ops.rs:70). Against a schema whose description is literally "A production incident and who was on call for it", a 0.2 threshold is not a near-miss — this retrieves.
  3. context_ops.rs:407-420 renders it through EntityTypeDescriptor::render_line().
  4. local_agent_service.rs:600-602 → set_session_context → agent_loop.rs:1420-1423 TemplateContext.workspace_context → prompt_assembler.rs:285, whose template body is literally "…{{ workspace_context }}".

I did not infer this. I ran it against the real renderer:

CONTEXT BLOCK>>>

EXISTING SCHEMAS (do not recreate these; do not copy their fields onto a new type):
- incident_report "incident_report" -> on_call: text; resolved: boolean

<<<END

So of the six strings the daemon test asserts absent, two are present in the prompt on the very turn being scored: incident_report and on_call.

What this does and does not break. Being fair to the change: the leak is the vocabulary, not the answer. The three titles and the value rowan→search index corruption mapping do not leak — those live only in instance nodes, and instances are never retrieved into workspace context (only "schema"-type nodes are). The model still cannot know which incident is Rowan's without a read. Scenario 13 remains winnable, remains a genuine decomposition test, and is not a repeat of 6/12 in effect.

What breaks is the claim, and it is not cosmetic:

  • types.ts:277-279 — "no trace in the rendered prompt at all — not a title, not a property, not an id" is false on the property clause, and this is the doc a future author will design the next seeded scenario against.
  • The daemon test's own rationale for asserting incident_report absent — "If this leaked, the model could enumerate by type without ever resolving the on-call property" (local_agent_service.rs:4193-4195) — describes a leak that is actually happening, in the prompt, right now. The test passes while the hazard it names is live.
  • agent-matrix.ts:1510-1512 — "leave NO trace in the rendered history — not a title, not a property, not an id" has the same defect.

Recommendation. Do not weaken the scenario; correct the claim and close the gap where it is real:

  1. Rewrite the claim to name the channel it actually proves: "…leave no trace in the rendered history. The seeded type and its field names do reach the system prompt via semantic schema retrieval (build_workspace_context); the seeded instances — the titles and the on-call mapping — do not, which is what keeps the referent unresolvable without a read."
  2. Fix the daemon test's incident_report / on_call rationale, which currently asserts absence on the grounds of a hazard the system does not actually prevent. Either scope the docstring to the history channel explicitly, or better —
  3. Add a test on the leaking channel, in the spirit of a_turns_own_write_leaks_its_targets_title_via_the_evidence_block: pin that the seeded schema renders into workspace context and that the seeded instances do not. That is the honest inverse pair, and it is the test that would have caught this. The probe above is ~25 lines and needs no daemon.

Engineering principle. An absence proof is only as strong as its channel enumeration. Two prior attempts shipped a false central claim behind a passing test; the fix each time was to widen what the proof covers, not to widen the prose. This one narrowed the prose's scope while widening its claim.


🟡 Finding 2 — The neverInAnyPrompt invariant asserts something the system contradicts

📁 scripts/eval/fixtures/agent-matrix.test.ts:829-861

const neverInAnyPrompt = [
  "search index corruption", "checkout latency spike", "auth token expiry storm",
  "incident_report",   // ← reaches the system prompt
  "on_call",           // ← reaches the system prompt
];

The test scans fixture-authored prompt strings only. Within that scope it passes and is worth keeping. But it is named and documented as a guarantee about prompts, and for two of its five entries that guarantee is false at runtime for reasons no fixture edit can affect.

This is the more dangerous half of Finding 1, because it is the artifact a future author will trust. Someone extending seeded scenarios will read "no prompt names the type" and design against a property the system does not provide.

Recommendation. Split the list by what is actually true, and say so:

// Instance-level facts: absent from BOTH fixture prompts and the runtime
// system prompt (instances are never retrieved into workspace context).
const neverAnywhere = ["search index corruption", "checkout latency spike",
                       "auth token expiry storm"];

// Schema-level names: kept out of FIXTURE prompts so no scenario hands them
// over conversationally. They DO reach the system prompt at runtime via
// semantic schema retrieval — this asserts fixture hygiene, not absence.
const notInFixturePrompts = ["incident_report", "on_call"];

Same coverage, no false guarantee. Engineering principle: a test's name and comment are part of its contract; an assertion that is true only within an unstated scope must state that scope.


🟡 Finding 3 — toolSequence is not as forced as claimed; resolve_query is a legitimate route

📁 scripts/eval/fixtures/agent-matrix.ts:1536-1548 · scripts/eval/fixtures/agent-matrix.test.ts:863-875

The claim is that 13 is "the only scenario whose route is genuinely FORCED." Half true, and the half that is true is the important half: a read is forced — a bare update_node cannot work, since no id exists in context. That is a real and new property, and it is what 6 and 12d lacked. Credit where due.

But toolSequence: ["search_nodes", "update_node"] asserts more than "a read happened" — it names which read. resolve_query is a live, registered tool (packages/agent/src/local_agent/tools.rs:669, :1622) built for precisely this shape, and #2248's own text describes the target capability as chaining resolve_query → act. A model that resolves via resolve_query and then writes correctly scores the diagnostic red for a correct answer.

The author's comment acknowledges this and argues the disagreement is "exactly the disagreement worth reading after a run." Under #2243 that argument is substantially stronger than it was for 6 or 12d: expect is now a diagnostic, not the score. A red trajectory against a green outcome is a signal, not a failure. So this is not the same mistake — the blast radius has genuinely changed.

Where it still misleads is the invariant test at :863-875, whose comment states 13's route is forced full stop, generalising a property that holds only for the read/no-read distinction. The pin is worth keeping; its justification is overstated.

Recommendation (non-blocking, cheap): keep toolSequence, and narrow the comment to what holds — a read is forced; which read is not, and a resolve_query route will show as a trajectory disagreement against a passing outcome. That is acceptable only because expect is diagnostic under #2243; it must not be restored to a scoring role on this scenario. Alternatively search_semantic/get_node are also reachable routes worth naming.


🟡 Finding 4 — --runs re-seeds and duplicates the incidents, breaking 13 from rep 2

📁 scripts/eval/runner.ts:775-794 · scripts/eval/fixtures/agent-matrix.ts:502-546 · scripts/eval/runner.ts:1068-1087

The author's defence — "a re-run against a dirty database is already outside the harness's contract (preflight asserts an isolated DB)" — is sound for re-invoking the script. It does not cover --runs, which is in-contract, in the same process, and which the runner itself documents as sharing state:

📁 runner.ts:1055-1058 — "no --between-runs command — reps share one daemon and one database, so each rep starts from the state the previous one left."

runRep calls seedGroup unconditionally per rep. So bun run eval:agent --runs 3 (with no --between-runs, the documented default) yields:

  • rep 1 — 3 incidents, exactly one with on_call: rowan ✅
  • rep 2 — 6 incidents, two with rowan ❌
  • rep 3 — 9 incidents, three ❌

From rep 2 the on_call = rowan filter returns multiple matches. The model faces a genuinely ambiguous request; whichever it picks, contentMatches: "search index corruption" may or may not hold, and the winnability test's own discrimination assertion (matrix_scenario_winnability.rs:775-785) no longer describes the live state. Worse, the failure is silent and directional — it looks like model non-determinism, which is exactly what --runs/pass^k exists to measure. Given the memory that evals here have already silently measured stale state once, this is the trap worth closing.

Note the other groups are unaffected: they rebuild state per rep and their clauses are diff-based.

Recommendation — pick one, all cheap:

  • Preferred: make seedIncidents idempotent on instances the way it already is on the schema — query node query --type incident_report first and return early if the three exist. Two extra CLI calls, no contract change.
  • Or: have the runner call seedGroup only on rep 1 and document that seeded fixtures require --between-runs for multi-rep.
  • Or, minimum: fail loudly — if instances already exist, throw an EnvironmentError. Consistent with the runner's existing "environment failure, not scenario failure" stance and strictly better than silent duplication.

Engineering principle. Correctness under a supported flag is not "out of contract." A defence that relies on a purged DB should be enforced by the code, not asserted in a comment.


🟢 Finding 5 — The absence test models a history that never occurs, and the "stricter case" argument is only half right

📁 packages/daemon/src/services/local_agent_service.rs:4163-4170, 4172-4186

The docstring is admirably candid: 13 is the first turn of its group, so real history is empty, and the test instead uses an unrelated two-message exchange, justified as "the stricter case."

For the negatives that reasoning is correct and the choice is right — a non-empty rendered string is a real search space, and the positive assertion at :4180-4185 correctly forecloses the vacuous pass that let 12's proof look sound. Good.

Where it is incomplete: the negatives are then only proved for this history, and the test's value lies in what it would catch on change. If node_history_from_messages ever gained a graph-reading step (a summary block, a recent-nodes preamble), a fabricated unrelated history would exercise it under different inputs than the real empty one.

Suggestion (non-blocking): add a second, three-line case asserting the real shape — node_history_from_messages(vec![user_turn("The incident Rowan was on call for — mark it resolved")]) renders the user turn and nothing about the seeded incidents. Cheap, and it pins the configuration that actually runs. Keep the current case for its stricter-search-space value; the two are complementary, not redundant.


🟢 Finding 6 — Verified correct, no action (recording what I checked so a re-review need not redo it)

  • seedGroup placement vs. the pre-turn snapshot — 📁 runner.ts:775-794. The claim that seeded nodes land in before and never register as createdNode holds. Seeding runs after newChat and before the first captureSnapshot, and captureSnapshot (graph.ts:190-230) folds schema list into its query set, so incident_report instances are enumerated in before. updatedNode is therefore the correct clause and createdNode would correctly fail.
  • noUnexpectedNodes with three seeded nodes — 📁 end-state.ts:376-386. Filters diff.addedNodes only. Seeded nodes are in before, never in addedNodes, so the clause is unaffected. Correct.
  • EnvironmentError on seed failure — 📁 runner.ts:783-791. Right call: a silent seed failure would score as a string of model failures. Matches the runner's existing environment/scenario split.
  • Seeding via CLI, not a store — consistent with newChat; the "assert, do not own" rebuttal in types.ts:281-286 is fair. The stance is about daemon/DB lifecycle, and this does not touch it.
  • The pinned title leak (a_turns_own_write_leaks_its_targets_title_via_the_evidence_block) — pinning current behavior is the right call, the write_lines scoping at :4270-4280 is a genuinely careful distinction (user prompt replay vs. established fact), and the stated mitigation ("do not add a second scenario to 13's group") is correct for the channel it describes. Note it is now doubly justified: Finding 1 gives an independent reason a second scenario in that group is hazardous.
  • Production code untouched — the entire daemon diff is inside #[cfg(test)] (verified: #[cfg(test)] mod tests opens at :2354, so every insertion at :4146+ is inside it).
  • Project standards — no lint suppression, no #[allow(dead_code)], no #[deprecated], no console.log, no new dependencies, no .md files added to this repo, no back-compat shims. Clean.
  • Stale comments — scenario 6's comment (agent-matrix.ts:719-726) and 12's (:1313-1321) are both correctly updated from "still open / dead" to point at 13. No stale "toolSequence is used by no live scenario" text survives. ✅

🟢 Finding 7 — Nits

  • 📁 scripts/eval/fixtures/agent-matrix.ts:453-454 — double blank line after assertExpectation's closing brace. quality:fix evidently tolerates it; still noise.
  • 📁 scripts/eval/fixtures/agent-matrix.test.ts:874-876 — trailing double blank line before the next test.
  • 📁 scripts/eval/fixtures/agent-matrix.ts:487-500 — runNs duplicates runCli in graph.ts:107-121 almost exactly (same spawn shape, same JSON handling, same error text). Two copies of the CLI-invocation contract will drift. Consider exporting runCli from graph.ts and importing it. DRY, and low-risk.
  • 📁 scripts/eval/fixtures/agent-matrix.ts:551-560 — seedIncidents creates then immediately updates each node with two properties. node create accepting properties inline (as create_node does in the winnability test at matrix_scenario_winnability.rs:757-767) would halve the CLI round-trips and make the seeded rows byte-closer to the tool path they are claimed to match. Worth a look only if the CLI supports it.

Recommendation: REQUEST CHANGES

Blocking:

  • Finding 1 (🔴) — the "not a property" claim is false and empirically disproved; the seeded type and on_call reach the system prompt via schema retrieval. Correct the claim in types.ts, agent-matrix.ts and the daemon test's rationale, and add a test on the channel that actually leaks.
  • Finding 2 (🟡) — split neverInAnyPrompt so the invariant stops asserting a runtime guarantee the system does not provide.

Strongly recommended in the same pass:

  • Finding 4 (🟡) — close the --runs duplication, by idempotence or by a loud failure. --runs is a supported flag, so this is in-contract.
  • Finding 3 (🟡) — narrow the "route is forced" comments to "a read is forced."

Findings 5–7 are optional.

Net-positive judgement. I want to be clear that this is not a rejection of the approach. seedGroup is the correct primitive, it is wired correctly, the snapshot and noUnexpectedNodes reasoning is right, and scenario 13 genuinely does what #2248 asked — its referent really is unresolvable without a read, which is more than 6 or 12 could say. The leak I found weakens the description, not the measurement.

But the specific failure mode this issue exists to prevent is a matrix that claims coverage it does not have, and the specific mistake both prior attempts made is an absence proof that asserted the wrong property while passing. Shipping a third iteration whose headline claim — "not a title, not a property, not an id" — is demonstrably false on the property clause, and whose test docstring names a hazard that is live in production, would repeat the pattern one more time. The corrections are small and the scenario survives them intact; they are worth making before this becomes the reference design for the next seeded scenario.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated pragmatic-code-review: REQUEST CHANGES (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.

… fix two --runs defects

The review found the headline claim false on one clause, and it is the third
time an absence proof in this area asserted the wrong channel. Verified
independently before acting.

THE LEAK. `seedIncidents` creates a SCHEMA as well as three instances, and
workspace context retrieves schemas semantically (SCHEMA_SIMILARITY_THRESHOLD
0.2) and interpolates them into the system prompt. So the seeded type name and
its field names — including `on_call`, the property 13's reference keys off —
are in front of the model on the scored turn. "Seeded nodes leave NO trace in
the rendered prompt — not a title, not a property, not an id" was wrong on the
property clause.

SEVERITY, stated rather than softened: what leaks is the VOCABULARY, not the
ANSWER. Only `"schema"`-type nodes are retrieved that way, so the three titles
and the `rowan` -> `search index corruption` mapping stay out. Knowing an
`incident_report` type exists with an `on_call` field tells the model how to
ASK; it does not tell it which incident to update. The read is still forced and
scenario 13 still measures what #2248 asked for. The description was wrong, not
the measurement.

Fixed by pinning the boundary rather than restating the claim:
- New `scenario_13_seeded_schema_reaches_the_prompt_but_its_instances_do_not`
  (packages/core/src/ops/context_ops.rs) asserts the schema DOES render and
  instance data does NOT. Both directions, so if instance content ever starts
  reaching workspace context that test fails and 13's degradation is caught —
  which the history-side proof alone would not have noticed.
- The claim in types.ts, the fixture group header, and the daemon test's own
  rationale all now name the channel they cover. The daemon test's
  `incident_report`/`on_call` assertions are kept (history is still a channel
  they have no business appearing in) but no longer imply the model cannot see
  them.
- The `neverInAnyPrompt` invariant is split: titles are a real guarantee
  (absent from every channel); the schema names are fixture tidiness only. A
  future author designing against "the model has never heard of on_call" would
  have been designing against something this fixture cannot deliver.

TWO --runs DEFECTS, both of which would have surfaced as model
non-determinism and corrupted the pass^k measurement --runs exists to produce:
- DUPLICATION: seedGroup runs per rep, so rep 2 had two `rowan` incidents and
  rep 3 three, at which point the on-call filter stops identifying one node.
- NO-OP: 13's turn sets `resolved: true`, and `updatedNode` scores off the
  DIFF. Left as rep 1 finished it, rep 2's correct write produces no
  `changedNodes` entry and scores red. Found by tracing the clause rather than
  by running --runs.
Seeding now queries by type, creates what is missing, and RESETS what is
already there.

Also: narrowed the "route is forced" claim in both the fixture and the
invariant. A READ is forced; WHICH read is not — `resolve_query` reaches the
same node. Acceptable only because `expect` is a diagnostic and not the score
(#2243), and now said so explicitly rather than overstated a third time. Added
`scenario_13_runs_with_no_prior_history` to pin 13's real (empty) history shape
alongside the stricter non-empty case.

test:all exits 0; quality:fix clean. Frontend baseline unchanged at 227/4794.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_012A1ryuphm1PidSY1KTvcKG
@malibio

malibio commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed review — 2a1de449

All 5 substantive findings addressed, 0 skipped.

🔴 Finding 1 — the leak

Confirmed independently, and the catch is a good one. I re-derived it rather than taking it on trust: context_ops.rs:322-327 retrieves "schema"-type nodes at SCHEMA_SIMILARITY_THRESHOLD = 0.2 and renders them into {{ workspace_context }}. seedIncidents creates a schema, so incident_report and on_call are in front of the model on the scored turn. The claim "not a title, not a property, not an id" was wrong on the property clause.

This is the third time an absence proof here asserted the wrong channel, and that pattern is worth naming: each time, a passing test created confidence in a claim it didn't actually check.

Severity — agreed, and I've stated it in the code rather than softened it. What leaks is the vocabulary, not the answer: only "schema"-type nodes are retrieved, so the three titles and the rowan → search index corruption mapping stay out. Knowing the type and field exist tells the model how to ask, not which incident to update. The read is still forced.

Fixed by pinning the boundary, not restating the claim. New scenario_13_seeded_schema_reaches_the_prompt_but_its_instances_do_not asserts the schema does render and instance data does not — both directions, so if instance content ever reaches workspace context that test fails. The history-side proof alone would never have noticed. The claims in types.ts, the group header, and the daemon test's rationale now each name the channel they cover.

🟡 Finding 2 — invariant asserting a guarantee the system contradicts

Split into two lists with the distinction stated: titles are a real guarantee (absent from every channel); schema names are fixture tidiness only. Your framing of the risk was the persuasive part — a future author designing against "the model has never heard of on_call" would be designing against something this fixture cannot deliver.

🟡 Finding 4 — --runs duplication, plus a second defect it led me to

Both fixed. Seeding now queries by type, creates what's missing, and resets what's there.

Tracing the first one surfaced a second you didn't name, and it's the worse of the two: 13's turn sets resolved: true, and updatedNode scores off the diff. Left as rep 1 finished it, rep 2's correct write produces no changedNodes entry and scores red. So --runs would have failed 13 on every rep after the first even with duplication fixed. Both surface as model non-determinism, corrupting exactly the pass^k measurement --runs exists to produce.

🟡 Finding 3 — toolSequence overstated

Narrowed in both the fixture and the invariant: a read is forced; which read is not — resolve_query reaches the same node. Now says so explicitly, including that this is tolerable only because expect is a diagnostic rather than the score (#2243). Overstating it a third time was the specific trap worth avoiding.

🟢 Finding 5 — history shape

Added scenario_13_runs_with_no_prior_history pinning 13's real (empty) shape alongside the stricter non-empty case. Complementary, as you noted.

🟢 Finding 7 — nits

Formatting handled by quality:fix. Left runNs as-is: graph.ts's runCli isn't exported and widening its visibility to dedupe a 12-line helper trades a real API-surface change for a cosmetic gain.

Verification

bun run test:all exits 0 — all four scenario-13 tests confirmed running inside it. quality:fix clean. Frontend baseline unchanged at 227/4794. Full pre-push gate green.

Re-review

RE-REVIEW NEEDED. A 🔴 was addressed by adding a test in a package this PR previously didn't touch (nodespace-core), and the seeding logic changed shape (query/create/reset). Worth a pass on whether the scoped claims now match what the tests establish — the specific thing that went wrong twice before.

@malibio

malibio commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator Author

Code Review — PR #2251 (Re-Review)

Review Type: Re-Review — scope limited to 2a1de449. Prior review covered be36f0ea.

Previous Review Summary

Count Status
Previous recommendations 7 (1 🔴, 3 🟡, 3 🟢)
Addressed 6 🔴 F1, 🟡 F2/F3/F4, 🟢 F5, 🟢 F6
Declined with reasoning 1 🟢 F7 (runNs/runCli DRY) — accepted, see below
Not addressed 0
New issues found 2 (2 🟢)

The 🔴 is genuinely resolved, and resolved the right way — by narrowing the claim to what is provable rather than by weakening the test until it passed. I re-executed the renderer and re-read the retrieval path to confirm the new claims independently rather than taking the comments at their word.


Verification Performed

I checked every load-bearing assertion against the source rather than the prose describing it.

1. updatedNode really does require a changedNodes entry — the author's second --runs defect is real.

📁 scripts/eval/end-state.ts:288-313 searches diff.changedNodes only. 📁 scripts/eval/graph.ts (diffSnapshots) admits a node to changedNodes only when b.content !== a.content || stableStringify(b.properties) !== stableStringify(a.properties). A node left at resolved: true by rep 1, written to resolved: true again by rep 2, produces byte-identical properties and therefore no entry — so updatedNode falls through to the no existing node was updated to match [...] failure at line 308. Confirmed: the defect exists, was not named in my prior review, and would have manifested as rep-1-passes / rep-N-fails, i.e. as fake model non-determinism in exactly the pass^k number --runs produces. Good catch, and the class of bug (a correct write scoring red because scoring is diff-based) is worth remembering beyond this scenario.

2. Reset-vs-snapshot ordering is correct.

📁 scripts/eval/runner.ts:786-788 calls fixture.seedGroup(env, group); the before snapshot is captured at 📁 scripts/eval/runner.ts:835-839, strictly after. So the reset to resolved=false lands in before, and the turn's write to true yields a real diff. The runner's own comment at 778-780 already documents this ordering as intentional. Correct and complete.

3. CLI JSON shapes match what the seeding code parses.

  • node query --json → 📁 packages/cli/src/output.rs:39-46 print_node_list emits {count, collection_id, nodes: [...]}. The {nodes?: []} branch is the live one; the bare-array branch is dead but harmless.
  • node_to_json (📁 packages/cli/src/output.rs:92-101) emits id as the bare id and content as the title. The .replace(/^nodespace:\/\//, "") is a no-op on this path — consistent with the pre-existing create path directly below it, so I'd keep it for symmetry rather than flag it.
  • resolved=false parses as a JSON boolean via 📁 packages/cli/src/commands/node.rs:80-90 parse_property, matching what the create branch writes. No string/boolean asymmetry between the two branches — I specifically checked for this, since a "false" vs false split would make rep 2's before differ from rep 1's and produce a spurious diff.
  • schema list → same print_node_list shape (📁 packages/cli/src/commands/schema.rs:108-116), consistent with the pre-existing schema branch.

4. Partial-seed state is handled. The present Map is keyed per title and consulted per incident, so 2-of-3 present resolves to two resets and one create. --limit 50 against three seeded incidents has ample headroom.

5. Failure modes. runNs throws on non-zero exit, and 📁 scripts/eval/runner.ts:789-795 wraps seedGroup into an EnvironmentError — so a failed query is a loud environment fault, not a silent mis-seed. Correct: silence here is what would corrupt the measurement.

Tests run — all green:

  • cargo test -p nodespace-core --lib scenario_13 → 1 passed
  • cargo test -p nodespace-daemon --lib scenario_13 → 2 passed
  • cargo test -p nodespace-agent --test matrix_scenario_winnability → 9 passed
  • bun test scripts/eval/fixtures/agent-matrix.test.ts → 69 passed, 508 assertions

Requirements Check (#2248)

This closes #2248. More than that: the PR now measures the thing the issue asked for and documents the boundary that made the two prior attempts wrong, which is the more durable contribution.


Findings

🔴 Critical

None.

🟡 Important

None.

🟢 Suggestions

🟢 1. The new test's negative half is vacuous by construction — and the comment implies it is a live tripwire.

📁 packages/core/src/ops/context_ops.rs:539-556

This is the one place where the prose still reaches slightly past what the code can deliver, so it is worth naming precisely even though nothing here is wrong.

The four negative assertions loop over instance strings and assert they are absent from format_for_prompt output. But relevant_schemas is Vec<SchemaNode>, and SchemaNode (constructed at 📁 packages/core/src/ops/context_ops.rs:596-636) has no field capable of holding an instance title or a property value — only id, content (the display name), fields (names/types), and templates. format_for_prompt (📁 packages/core/src/ops/context_ops.rs:406-425) renders only through EntityTypeDescriptor::render_line(). There is no input to this test that could make those four assertions fail, short of a caller hand-constructing a SchemaNode whose content is literally "search index corruption".

The docstring says the test is "Pinned in both directions" and that "if instance CONTENT ever started reaching workspace context, [this] test fails". It would not. The type system already prevents that, and if someone widened WorkspaceContext to carry instance nodes, they would add a new field — which this test does not read.

To be clear about severity: the positive half is the valuable half, and it is sound. It is what refuted the original 🔴, and it will genuinely fail if the schema block stops rendering type or field names. The negative half is harmless and cheap. My concern is only that a future reader trusting "pinned in both directions" would believe they have a regression alarm they do not have.

Suggested wording, replacing the "Pinned in both directions" paragraph:

The negative assertions are structurally guaranteed rather than contingent: WorkspaceContext carries SchemaNodes, which have no field for instance titles or property values. They are written out anyway to make the boundary legible at the point a reader is asking about it — but they are documentation, not a tripwire. A change that routed instance data into the prompt would do so through a new field this test does not read, and would need its own assertion.

Engineering principle: a test's docstring should describe the guarantee it actually enforces. An overstated one is worse than no test, because it suppresses the instinct to write the real check — which is the precise failure mode this PR exists to correct, applied one level up.

🟢 2. notInFixturePrompts is a lint wearing an invariant's clothes.

📁 scripts/eval/fixtures/agent-matrix.test.ts:862-882

The split into neverReachesTheModel / notInFixturePrompts is exactly right, and the comment is honest that the second is "tidiness only". Two smaller notes:

  • Both loops share identical structure and could be one loop over [[list, message], ...]. Minor; the duplication buys clear per-list failure messages, so I would leave it.
  • The test name — "no prompt names scenario 13's seeded target" — now covers two claims of different strength. Consider "scenario 13's instance data reaches no prompt; its schema vocabulary is merely kept out", or split into two tests. Not blocking; the in-body comments carry the distinction well enough.

On the declined suggestion (🟢 F7, runNs/runCli DRY)

The decline is reasonable and I accept it. I verified runCli is module-private (📁 scripts/eval/graph.ts:108). Exporting a helper from a scoring module so a fixture can save ~12 lines widens an API surface to serve a consumer it was not designed for. YAGNI and interface-minimality both favor the duplication here, and the two functions are free to diverge (different error framing) without a shared-helper negotiation. Correct call.


Comment-by-Comment Audit

This was the crux of the request, so here is each changed comment against what the code establishes:

Location Claim Verdict
📁 scripts/eval/types.ts:276-292 "absent from the rendered chat history entirely"; schema vocabulary DOES reach the prompt; instance data does not ✅ Accurate. Correctly scopes to completed_writes and names the channel.
📁 scripts/eval/fixtures/agent-matrix.ts:1558-1580 Same boundary, plus "seeding hides the answer, not the vocabulary" ✅ Accurate and well-framed.
📁 scripts/eval/fixtures/agent-matrix.ts:1588-1598 "A READ is forced… WHICH read is not" ✅ Accurate. The resolve_query caveat is the right narrowing.
📁 packages/daemon/src/services/local_agent_service.rs:4213-4224 "Absent from HISTORY… but NOT absent from the prompt overall" ✅ Accurate, and the "do not read these two lines as proof" warning is exactly the right instinct.
📁 scripts/eval/fixtures/agent-matrix.test.ts:839-845 neverReachesTheModel — "absent from chat history AND from workspace context, which retrieves only "schema"-type nodes" ✅ Verified against 📁 packages/core/src/ops/context_ops.rs:320-327 — retrieval is scoped to node_type == "schema" and re-resolved from get_all_schemas(), so instance nodes cannot enter.
📁 scripts/eval/fixtures/agent-matrix.test.ts:862-869 notInFixturePrompts — explicitly NOT a runtime guarantee ✅ Accurate; the disclaimer is the important part and it is present.
📁 scripts/eval/fixtures/agent-matrix.test.ts:905-917 toolSequence limit, expect-is-diagnostic ✅ Accurate.
📁 packages/core/src/ops/context_ops.rs:491-518 New test docstring ⚠️ Accurate except "Pinned in both directions" / "that test fails" — see 🟢 1.
📁 packages/daemon/src/services/local_agent_service.rs:4238-4247 scenario_13_runs_with_no_prior_history — "Trivial by construction, and that is the point" ✅ Accurate and self-aware about being trivial. This is the disclosure style 🟢 1 asks for, applied correctly — which is why the gap in the other docstring stands out.

One sentence overstates, in a way that is documentation-only and cannot produce a false pass. Everything else matches.


Assessment

This revision does the thing that neither prior attempt nor the first revision did: it establishes the boundary empirically, then narrows every claim to sit inside it. The author also found a defect I missed (the updatedNode/diff interaction under --runs) and fixed it correctly, including the snapshot-ordering subtlety. Verifying the reset lands before the pre-turn snapshot is not obvious, and it is right.

The remaining finding is a docstring that promises a tripwire the type system already makes unnecessary. That is a real note — this PR's whole subject is claims outrunning their evidence — but it is one paragraph of prose in a test whose valuable half works, and it cannot cause a false pass. Net positive by a wide margin.

Recommendation: APPROVE — with 🟢 1 worth a one-paragraph edit before or after merge, author's call.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated pragmatic-code-review (re-review): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.

…it is not

The re-review approved, leaving one documentation-only finding. Fixing it rather
than deferring, because it is the same CLASS of error as the three defects that
preceded it: a comment asserting a test guards something it does not actually
check.

`scenario_13_seeded_schema_reaches_the_prompt_but_its_instances_do_not` has two
halves of very different strength, and the docstring described them as one:

- The POSITIVE half is real. It is what refuted the original "no trace in the
  prompt at all" claim, and it fails if schema rendering stops including type
  or field names.
- The NEGATIVE half is vacuous by construction. Verified: `relevant_schemas` is
  `Vec<SchemaNode>`, and SchemaNode carries only id, content (display name),
  fields and templates — no field can hold an instance title or property value,
  so no input to `format_for_prompt` could make those four assertions fail.

Saying it was "pinned in both directions" therefore promised a tripwire that
does not exist. What actually protects scenario 13 is that
`semantic_search_nodes_of_type` retrieves only `"schema"`-type nodes; if that
widens, instance data reaches the prompt, 13's referent becomes directly
matchable, and NO test in this repo fails. That is now written down at the
fixture, in types.ts, and in the test itself, naming the retrieval call as the
thing to check before changing workspace context.

Also split the prompt-scanning invariant into two named tests. One name was
spanning a real guarantee (incident titles reach the model through no channel)
and mere housekeeping (schema vocabulary is kept out of prompts for clarity,
though the model sees it anyway via workspace context). A single name covering
both would let the weaker claim borrow the stronger one's credibility.

Declined the runNs/runCli DRY suggestion, which the re-review accepted:
`runCli` is module-private in graph.ts, and exporting a scoring-module helper to
save ~12 lines in a fixture widens an API surface for a consumer it was not
designed for.

test:all exits 0; quality:fix clean. Fixture invariants now 70 tests.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_012A1ryuphm1PidSY1KTvcKG
@malibio

malibio commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed re-review — 2c7dd2c6

Re-review approved with one 🟢 documentation finding. Fixed rather than deferred, because it is the same class of error as the three defects that preceded it in this issue: a comment asserting a test guards something it does not actually check. Deferring it would have left the fourth instance of that pattern in the tree.

🟢 1 — the vacuous negative half

Confirmed by reading the type. SchemaNode (packages/core/src/models/schema_node.rs:47) carries id, content (display name), version, timestamps, is_core, fields and templates. Nothing can hold an instance title or property value, so no input to format_for_prompt could make those four negative assertions fail. Calling it "pinned in both directions" promised a tripwire that does not exist.

The docstring now separates the halves explicitly: the positive half is real content (it refuted the original 🔴 and fails if schema rendering drops type/field names); the negative half records an invariant rather than policing one.

More usefully, it now names what nothing guards: scenario 13 depends on semantic_search_nodes_of_type retrieving only "schema"-type nodes. If that widens, instance data reaches the prompt, 13's referent becomes directly matchable, and no test in this repo fails. That is written at the fixture, in types.ts, and in the test — pointing at the retrieval call as the thing to check before changing workspace context.

🟢 2 — test name spanning two claims

Split into two named tests. no prompt names scenario 13's seeded incident titles is the real guarantee (titles reach the model through no channel); seeded schema vocabulary is not restated in fixture prompts is housekeeping, with its comment stating plainly that the model does see that vocabulary via workspace context. A single name over both would let the weaker claim borrow the stronger one's credibility — the mechanism behind every defect in this issue.

🟢 3 — DRY suggestion

Left declined; thanks for confirming the trade. runCli is module-private in graph.ts, and exporting a scoring-module helper to save ~12 lines in a fixture widens an API surface for a consumer it was not designed for.

Verification

bun run test:all exits 0 · quality:fix clean · fixture invariants now 70 tests · full pre-push gate green.

Re-review

NO RE-REVIEW NEEDED. Comment-only changes plus one mechanical test split; no assertion logic, seeding logic, or scenario semantics changed. The one substantive edit — the split — was verified by the suite going 69 → 70 with zero failures.

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.

Matrix no longer measures indirect-reference decomposition — build a chain whose referent is not recoverable from history

1 participant