Skip to content

fix(knowledge): reject malformed record proposals before writing - #213

Merged
drewstone merged 1 commit into
mainfrom
fix/knowledge-record-admission-20260916
Sep 16, 2026
Merged

drewstone merged 1 commit into
mainfrom
fix/knowledge-record-admission-20260916

Conversation

@drewstone

Copy link
Copy Markdown
Contributor

Change

Make knowledge_record describe the complete FILE grammar and reject malformed, unsafe, or empty proposals before any page write. The shared parser no longer absorbs a later page into an unterminated earlier block. Direct applyKnowledgeWriteBlocks retains its explicit partial-result API.

Reproduction and proof

The retained mech-interp-foundations-pi-20260915k run made 13 knowledge_record calls. Twelve completed with no written pages; the partial probe swallowed the next page into the first. All 13 exact inputs replayed against the original published Knowledge 16.0.0 matched the original results. Two short public arguments are retained in src/knowledge-record.test-fixture.ts, identifying immutable result blob sha256:0cce0601a94050e27acd4c918b2b7bb9037265f43bfc5a38408140b3a177882b.

Original implementation: focused regression run 8 failed / 8 passed.
Fixed: 38/38 focused tests on macOS and Linux. Correcting only the required closer saves the intended page.

Verification

  • Complete local Linux suite: 894 passed, 12 skipped; 90 files passed, 3 skipped; exit 0.
  • Full lint: 255 files; source and contract typechecks; build.
  • API record unchanged: 997 exports / 6 entrypoints.
  • Package clean install, declarations, exports, CLI, and re-pack; publint and attw ESM.
  • Skills, path containment, post-commit version check, and diff check.
  • Independent source review completed by the coordinating agent.

Earlier failed local samples remain disclosed: macOS has 49 Linux-directory-descriptor failures, reproduced unchanged on base; first container archive included AppleDouble metadata; an init-less container retained a killed descendant as a zombie, reproduced on base; concurrent overlay I/O caused 16 timeouts. The final Linux run uses clean committed source, proper init, isolated Linux test directories, and serialized workers without weakened assertions or timeouts.

Version: 17.0.2. Scope: two production files plus tests/docs/package version.
Rollback: revert this commit and publish a new patch; do not overwrite an existing npm version.

Related system issue: SYS-006 — outcome: fixes — proof: b9b590e (malformed shared-memory admission path; not a claim that all memory issues are closed).

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@drewstone
drewstone merged commit ee172b1 into main Sep 16, 2026
2 checks passed
@drewstone

Copy link
Copy Markdown
Contributor Author

Knowledge 17.0.2 release proof

PR #213 is merged and the registry package passed its changed-behavior check.

Local verification before merge

The complete Linux suite passed: 90 files passed, three skipped; 894 tests passed, 12 skipped.
The total was 906 tests.
Focused regression and core tests passed 38/38 on macOS and Linux.
Both maintained packed-consumer optimizer checks passed locally, with no model calls.
Typechecks, lint, build, package checks, version check, merge-tree, and Git hooks passed.
The public surface stayed at 997 exports across six entrypoints.
Earlier failed substrate samples remain recorded in the PR; this release does not erase them.

Exact registry artifact

The tarball was downloaded independently and its SHA-512 and SHA-1 matched registry metadata at 2026-09-16T03:38:46Z.

package: @tangle-network/agent-knowledge@17.0.2
tarball: https://registry.npmjs.org/@tangle-network/agent-knowledge/-/agent-knowledge-17.0.2.tgz
bytes: 851190
sha1: 1ccf4de0b8cc6b3997aaf024b3a218fd02e342b2
integrity: sha512-xPXGeDT8e7ag4Fz/lzZLLaNE29sWi9qyCr33KFP9kQ8MBBS2nw9R82KejJFDkvaKNm3zxI7iF4bms13PfJH3LA==

The publishing log records signed provenance at https://search.sigstore.dev/?logIndex=2854716174.
The registry exposes its attestation at https://registry.npmjs.org/-/npm/v1/attestations/@tangle-network%2fagent-knowledge@17.0.2.

Published behavior

A fresh Linux arm64 container installed the exact registry package, not local dist.
It ran Node v24.20.0, Eval 0.182.0, and Interface 2.0.0.
It imported the public createRunScopedStores and createKnowledgeTools APIs.

Check Result
Exact archived input call_c7f00a4f364547e689127ba0 Rejected with the required terminator in the error; complete store snapshot unchanged
Exact archived input call_c41bc0d3c0644fb0936b78f3 Rejected for unclosed blocks; complete store snapshot unchanged
First input with only its closing delimiter corrected One page written; no warnings; saved bytes exactly probe line one\n
Fresh store and tool instances reading that run Resolved glm-b-tmp-format-probe; exact saved text returned
Fresh reader searching for the text Returned the page; retrieval receipt verified against actual visibility
Tool description and JSON input schema Both contain the complete ---END FILE--- delimiter

The consumer exited zero.
It used zero model calls.
The receipt digest was sha256:924ffed86d96c94f54ad18460d9df29ac1a6b45a648c874a7e18656e262b3738.
The test store was disposable; its receipt file is not a retained research artifact.
The first container setup attempt failed before execution because its daemon could not mount the host fixture path.
The successful check passed the unchanged archived arguments through stdin instead.

This proves package admission and retrieval behavior, not production Runtime adoption or a second research director's decision.
Runtime integration and production delivery remain with their assigned owner.

Related system issue: SYS-006 — outcome: fixes — proof: #213 and registry @tangle-network/agent-knowledge@17.0.2.
This line concerns malformed shared-memory admission, not every SYS-006 failure.

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