Skip to content

Knowledge graph slice with fixture owner startup repair (#841) - #899

Merged
flip-engineer merged 3 commits into
mainfrom
codex/knowledge-owner-fix-20261019
Oct 19, 2026
Merged

flip-engineer merged 3 commits into
mainfrom
codex/knowledge-owner-fix-20261019

Conversation

@flip-engineer

Copy link
Copy Markdown
Collaborator

Scope

Carries the knowledge graph slice from #863 (issues #789, #790, #791) onto current main and repairs the fixture owner startup failure in #841.

Commits:

  • 8dd36243e ports the Apply knowledge scope, evidence provenance and relation identity checks #863 packet: scope and direction validation, evidenceReference resolution, search/traverse read wiring, relation-id-conflict refusal, the focused knowledge-behavior entry and tests, and gate registration in check-native.sh.
  • b9ac7cc45 repairs fixture owner startup. Store commits publish through the database owner. The host starts that owner by re-executing the executable with --instance-owner (br_instance_spawn, br_instance_connect in process-spawn.c). The focused entry had no --instance-owner case, so each spawned owner exited on the usage path and the publish connect loop retried without returning. Every fixture seed call then hit its 60 second timeout (6 of 6 tests). main_args in knowledge-behavior.bend now serves --instance-owner through Custody.Instance.owner and --instance-shutdown through Custody.Instance.shutdown, matching instance_owner_cli in main.bend. knowledge.py records a bounded 60 second timeout per fixture command and reports the command with captured output on expiry, as Knowledge fixture blocks in its first attach CLI command #841 requires.

Observed failure before this change

BATON2_EXE=.scratch/bend2/knowledge-behavior-test python3 bend2/test/knowledge-behavior.py reported Ran 6 tests with 6 errors; each error is subprocess.TimeoutExpired on the seed command after 60 seconds.

Validation requested

This session has no authority to create a bounded cgroup, so the build and test below still require one run in a fresh delegated cgroup. Resource needs: cgroup v2 with memory.max = 17179869184 (16 GiB) and memory.swap.max = 0, the executing shell moved into that cgroup, Bend 2.0.25, clang 19, Python 3. No address-space rlimit: the Bend runtime reserves address space and the launch guard refuses capped shells.

Script: /tmp/validate-knowledge-owner-fix.sh on the runner. Its commands:

export BATON2_ADMISSION_CGROUP=<bounded cgroup directory>
export BEND=/mnt/nvme4tb/ci-runners/baton2-native-homelab/home/.local/bin/bend
export CC=/usr/lib/llvm-19/bin/clang
sh bend2/scripts/build-native.sh bend2/test/knowledge-behavior.bend .scratch/bend2/knowledge-behavior-test
BATON2_EXE="$PWD/.scratch/bend2/knowledge-behavior-test" python3 bend2/test/knowledge-behavior.py -v

Expected result: the build completes and all 6 behavior tests pass, including graph search/traverse, evidence resolution, and relation identity checks. The full knowledge.py acceptance still needs the complete baton2 executable and is a separate run.

This PR is not merge-ready until that validation passes.

Scope/direction validation, evidence citation resolution, and relation identity refusal, with the focused knowledge-behavior entry registered in check-native.sh. Source packet carried from PR #863 head 94b6de0 onto Main bcfa678 without touching that branch. DB-backed fixture seed currently blocks on owner commit publication; see report.
Store commits publish through the database owner. The host starts that owner by re-executing the executable with --instance-owner. The focused knowledge entry had no such case, so the spawned owner exited on usage and the publish connect loop never returned; every fixture seed timed out. main_args now serves --instance-owner through Custody.Instance.owner and --instance-shutdown through Custody.Instance.shutdown, matching instance_owner_cli in main.bend. knowledge.py gains the bounded per-command timeout required by #841.
@flip-engineer

Copy link
Copy Markdown
Collaborator Author

Validation status from the author session (uid 986, batonci): the bounded build/test run has not been executed yet. This shell sits in an unbounded user scope; cgroup v2 is root-owned read-only for this uid, the user manager bus belongs to a different uid, and systemd system scopes require interactive authentication. The previous harness-created native scope no longer exists. Acquiring a fresh delegated cgroup with memory.max 17179869184 and memory.swap.max 0 therefore remains a root-side step, using /tmp/validate-knowledge-owner-fix.sh on the runner. No unbounded or address-space-limited build was run as a substitute. The PR stays not merge-ready until all 6 knowledge-behavior tests pass in that scope.

Message bodies are stored text. The inbox body for the finding notice is the JSON text written by notice_statement, so the test parses it before comparing the structured value. Production body semantics are unchanged. Reuses the b9ac fixture executable; no C generation rerun.
@flip-engineer

Copy link
Copy Markdown
Collaborator Author

Assertion correction pushed: head is now 57ea2ac. The test_791 inbox assertion now parses the stored message body text (json.loads) before comparing the structured notice value; production body semantics are unchanged. Reused the existing b9ac fixture executable (no C generation rerun): BATON2_EXE=.scratch/bend2/knowledge-behavior-test python3 bend2/test/knowledge-behavior.py -v reports Ran 6 tests in 4.724s, OK (6/6). Remaining production coverage: the full bend2/test/knowledge.py acceptance against the complete baton2 executable has not run in this PR; it needs the full native build. Root review/merge requested.

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.

1 participant