Skip to content

ui-server: the journal steering inventory classes the disposable index database as a steering input #2026

Closed

Description

@schlessera

Context

Observed on a hosted deployment running 0.43.1: the turn journal classifies the brain's disposable index database (brain.db) as a steering input. It records a steering_change governance event every time the index is touched. Of 22 steering_change events in the retained period, 19 were for brain.db, all with null before/after hashes, and several came from no-tool turns. The ledger of a read-only turn therefore reads "2 changed files · 1 steering". That is false, and it undermines G7, the steering-change review this event exists for. The index is regenerable (brain index --force) and is never authoritative.

Source, at 11655e165:

  • (steeringInventory, packages/ui-server/src/brain/journal-steering.ts:16-66) starts from configuration and steering files, then reads each script/config file it finds. The literal-string loop (:59-63) passes every quoted string without spaces to add (:27-35). add resolves the string against the journal snapshot and promotes any entry it finds to a steering path. Nothing filters out ignored, derived or binary entries. A configuration file that names the index file in a quoted string is enough to make brain.db "steering".
  • (identity, packages/ui-server/src/brain/turn-journal.ts:22) includes the metadata stamp for ignored entries. Every write to the index, which happens on ordinary searches and reindexing, is therefore a change, even with no content hash.
  • packages/ui-server/src/brain/turn-journal.ts:190-198 classifies each changed path in steering.paths as steering and emits one steering_change governance event per observation.

This is a different cause from #1846. #1846 designs how the journal presents operational files and coverage, and it rules out filename-only suppression. This issue is about the inventory promoting a file into the steering class in the first place.

Related: #1846, #1658 (steering-change journaling), #1643 (epic). The configuration-pattern scope issue filed alongside this one changes the same function.

Out of scope

  • How changed ignored files or SQLite sidecars are shown in the journal UI (#1846).
  • Whether an index touch counts as a changed path at all. Only its steering class is in scope here.
  • observedBytes accounting for ignored files. The scope-bytes issue filed alongside this one covers it.
  • Filename-only suppression. A file named brain.db that is not the configured index gets no special treatment.

Scope

Replace indiscriminate quoted-string promotion with data-only reference classification by the role used by supported configuration consumers (maintainer choice D). Inspect those consumers to enumerate concrete supported keys/reference forms and literal module dependencies; document that finite mapping in code and tests. Do not infer a consumed dependency from a filename, extension, quoted string or arbitrary unrecognized configuration property.

  • Known steering/startup roles include consumed instructions/prompts, settings, hook/preload/script entry points and their statically identifiable local steering dependencies. Genuine resources are not excluded merely because they lack a script extension.
  • Output paths, caches, ordinary data and the resolved configured disposable index plus its -wal/-shm/-journal sidecars are not steering merely because configuration names them. Use trusted resolved index identity; no basename-only suppression or credentialed evaluation of repository code.
  • Computed, unsupported, ambiguous or unreadable dependencies remain explicitly unavailable/unknown where they affect coverage. Unknown is neither proof a file steers nor proof coverage is complete. Preserve bounded retained-object/sealed-root readers, scope boundaries and policy exclusions.
  • Keep known steering-surface seed handling distinct from followed-reference roles. ui-server: the steering configuration pattern matches package.json at any depth, flooding coverage with node_modules and cloned workspaces #2028 separately decides which configuration locations seed the inventory. Coordinate the shared function without inventing a prerequisite dependency.
  • Record the finite role mapping, alternatives and coverage limits beside the inventory and in the G7 decision record in the implementation PR. No provider seam, new configuration format, host import/evaluation or journal UI redesign.

Acceptance criteria

  • Enumerate the actual supported configuration consumers/keys/reference forms from source, with input/output/unknown handling and bounded data-only resolution. Tests use real supported configuration fields, not invented properties whose semantics are inferred from their name.
  • A native journal fixture with a configuration naming the resolved index records no steering classification or steering_change event when only that database or its SQLite sidecars change. Cover a trusted already-resolved alternate index identity and an unrelated same-basename resource: no blanket brain.db or extension suppression.
  • Consumed settings/instructions and a genuine supported startup preload/hook/script reference still classify and emit steering_change on edits. Cover a genuine non-script/extensionless resource when a supported consumer uses it in a steering role.
  • The same filename appearing as an output/ordinary-data reference does not become steering; an unrelated quoted string resolving to an existing file is not sufficient. Role-specific positive controls demonstrate the distinction.
  • Computed/unreadable/unsupported references preserve explicit coverage limitations without fabricated consumed paths; inspect no live/credentialed repository code and follow no path outside allowed snapshot scopes.
  • A native journal/event regression fails before the change and passes after; record restored mutation receipts for role filtering and index exclusion, and retain positive genuine-resource controls. Cover both retained and native inventory paths where they share classification logic.

Verification

bun run test packages/ui-server
bun run typecheck
bun run lint
bun run check:pr --base origin/main

Mutation receipt: remove the new guard in add and watch the fixture test fail on the steering-class assertion.

Contract impact

None expected: the steering_change event kind and the journal summary shape are unchanged, and fewer false events are emitted. It changes @schlessera/brain-ui-server behaviour, so it needs a changeset.

Inventory reproduction and selected rule — 2026-10-16

At main 65ed23dc942ecaccbe86ae1beb4af6eeb3ad3eb5, a keyless Bun probe directly called the shipped journalSteeringInputs with synthetic snapshot entries: a root brain.config.ts containing export default { db: "brain.db", script: "./preload.ts" };, an ignored brain.db, and a genuine preload.ts. Actual paths contained all three; expected under the reported requirement is no index steering classification, with the preload retained. This reproduces the inventory promotion, not the downstream governance writer or a native whole-turn capture. The ignored database was not read by the fixture reader.

Source: (steeringInventory, packages/ui-server/src/brain/journal-steering.ts:16-66), especially (const add, the same file:27-35). Existing #1846's approved presentation preserves coverage facts and rejects filename-only suppression; it does not select this inventory rule.

Decision (maintainer, 2026-10-16): Choose D: classify references by their actual supported configuration role. The additional role-aware parsing/mapping work is accepted. The narrow index-only exception, extension/class whitelist and combined whitelist were considered but do not provide the selected distinction between inputs, outputs and data. Dynamic/ambiguous dependencies remain explicitly unknown; data-only inspection never claims proof of execution. The revised scope and criteria above are the selected specification. The quoted-string reproduction below remains historical evidence of the old bug, not proof that an arbitrary script property is a supported startup consumer.

Remove needs: decision and add agent-ready for implementation. Source inspection during review confirmed the quoted-string promotion still exists; no new native runtime proof is claimed.

This advances #1643's truthful steering attribution. Coordinate changes to this function with #2028; neither issue's full implementation inherently depends on the other, so no dependency blocker is invented.

Reproduce both inventory controls

Executed as bun /tmp/brain-triage/steering-repro.ts against the archived inspected main source; exit 0. Equivalent source below imports from a repository-root script. It reads synthetic buffers only.

import { journalSteeringInputs } from './packages/ui-server/src/brain/journal-steering.ts';
const contents = new Map<string, Buffer>();
const entry = (path: string, text: string, ignored = false) => {
 const hash = path; contents.set(hash, Buffer.from(text));
 return { path, scope: '', kind: 'file' as const, mode: 0o644, bytes: text.length, stamp: '1', hash: ignored ? undefined : hash, ignored };
};
const index = journalSteeringInputs([{entries:[entry('brain.config.ts', 'export default { db: "brain.db", script: "./preload.ts" };'),entry('brain.db','sqlite',true),entry('preload.ts','export {};')],missing:[]}],hash=>contents.get(hash)!);
console.log('index-reference',JSON.stringify({paths:[...index.paths],unavailable:index.unavailable}));
const seed = journalSteeringInputs([{entries:[entry('package.json','{}'),entry('node_modules/a/package.json','{}',true),entry('workspaces/odyssey-tools/package.json','{"scripts":{"start":"./start.ts"}}'),entry('workspaces/odyssey-tools/start.ts','export {};')],missing:[]}],hash=>contents.get(hash)!);
console.log('nested-seeds',JSON.stringify({paths:[...seed.paths],unavailable:seed.unavailable}));
if (!index.paths.has('brain.db') || !index.paths.has('preload.ts') || !seed.paths.has('node_modules/a/package.json')) throw Error('reported inventory behavior not observed');

2026-10-16 correction: expanded reference classification to the selected role-aware approach, specified actual-consumer and non-script-resource controls, retained historical reproduction evidence, and removed the superseded pending-rule recommendation. Seed-location selection remains separately owned by #2028.

2026-10-16 source correction: core currently fixes its disposable index to <root>/brain.db (initContext, packages/core/src/lib/context.ts:36-52); its configuration schema has no index-location setting. The alternate-location criterion tests an internal caller-supplied resolved identity, without introducing a repository config field or evaluating configuration to discover it. Default runtime identity continues to follow the current core consumer.

Merge verification — 2026-10-16

Session decision (maintainer, 2026-10-16): Retain the passing test and mutation receipts already recorded for this implementation. Merge without repeating full suites solely because main advanced; resolve actual merge conflicts and validate substantive resolutions, then inspect automatic main proof and address related postmerge failures separately. Older receipts retain their actual tested identities. This supersedes this issue's verification-coordination dependency on #2111; it does not resolve that issue as a global workflow design.

Activity

  1. added
    type: fix
    area: ui-server
    needs: decision
    on Oct 16, 2026
  2. added
    priority: p1
    agent-ready
    and removed
    needs: decision
    on Oct 16, 2026
  3. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Decision (maintainer, 2026-10-16): Choose D: classify followed references by their actual supported configuration role.

    Known steering/startup inputs remain steering, including genuine non-script resources when a supported consumer uses them that way. Output paths, caches, ordinary data and the resolved configured disposable index/SQLite sidecars do not become steering just because they are quoted. Unsupported/computed/ambiguous dependencies stay explicitly unknown. Do not execute repository configuration to discover roles or replace semantics with a filename/extension whitelist.

    The body now requires a finite mapping verified against real configuration consumers, role-specific positive/negative controls and native journal/event regression/mutation evidence. The old synthetic script property remains historical reproduction evidence, not a claim of a supported configuration key. Record the rule and alternatives in the G7 decision record in the same implementation PR. #2028 still owns seed locations; coordinate changes without inventing a dependency.

    Remove needs: decision, add agent-ready; keep the issue open for implementation and proof.

  4. self-assigned this
    on Oct 16, 2026
  5. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Claiming this issue for role-aware steering reference classification and native regression proof. Claim token: p1-2026-role-1016; intended branch: fix/2026-steering-reference-roles. Seed-location behavior stays with #2028; shared-function changes will be coordinated.

  6. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Source correction folded into the body: core currently fixes the index to <root>/brain.db; there is no custom index-location configuration field. Alternate-identity proof exercises a trusted internal resolved identity rather than inventing a config option.

    The native journal regression now reproduces the original steering-class failure on both index identities. Supported-role mapping and the restored role/index mutations are implemented; full server verification and final preflight are running. No repository configuration has been imported or evaluated by the inventory.

  7. added this to the 0.44.0 milestone on Oct 16, 2026
  8. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Implementation and local proof are ready in draft PR #2076, head 02fd70ddb70298119a3ff89dfa345832585dd6e2.

    • Final restored native/retained inventory, native journal/governance-event and alternate trusted-identity capture proof: 22 tests / 120 assertions pass.
    • Committed local preflight: 458 tests / 2,863 assertions pass; strict typecheck, lint, all 1,092 citation checks and pending changeset validation pass. Public API signatures remain unchanged.
    • Original inventory reproduces false native steering classification. Restoring arbitrary quoted-string promotion fails the genuine-input control; removing exact index exclusion fails both default-index journal and alternate-identity native-capture controls. Both mutations are restored.

    The finite supported-role mapping, alternatives and explicit coverage limitations are recorded beside the inventory and in G7. Seed-location selection stays with #2028, without a prerequisite dependency. Core has no configurable index-location setting; alternate identity proof is internal and adds no public option.

    The PR and issue both retain release milestone 0.44.0. Complete selected hosted candidate proof and final merge reconciliation remain. The coordinated worker retains the claim while that proof is scheduled; this comment does not claim CI qualification, merge or release publication.

  9. removed their assignment
    on Oct 16, 2026
  10. added
    blocked
    on Oct 16, 2026
  11. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Implementation and focused proof are preserved in draft PR #2076 at 02fd70ddb70298119a3ff89dfa345832585dd6e2. The current issue body records the verification handoff and canonical dependency #2111. Remaining work is authorized current-candidate confirmation, final review/release-milestone readback, merge and actual-main proof under the settled coordination procedure. This invocation's assignment has been released and read back; the resumable branch is retained. No completed merge is reported.

  12. removed
    blocked
    on Oct 16, 2026
  13. self-assigned this
    on Oct 16, 2026
  14. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Resuming existing PR #2076 under the maintainer session decision to retain passing proof and avoid full refreshes solely for main advancement. Claim token: p1-resume-2026-1016-root. Actual conflicts will be resolved and related postmerge proof inspected.

  15. schlessera commented on Oct 16, 2026

    @schlessera
    OwnerAuthor

    Merged PR #2076 as a268b3d392a218f8875c6a9fae44b6ccc6fdf01c. Issue closure, squash ancestry on main, and release milestone 0.44.0 on both issue and PR are verified. Existing passing test/mutation receipts were retained under the explicit session instruction; actual integration resolutions are recorded in the PR. Automatic main CI remains queued at this readback, so integrated hosted green is not claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ui-serverpriority: p1type: fix

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions