Skip to content

fix(knowledge): a knowledge_record write records no author — pass the tools' existing actorId into the write transaction #206

Description

@drewstone

Version checked

@tangle-network/agent-knowledge 15.0.2 (tag v15.0.2, 1b1408e), the version discovery-lab installs at discovery-lab@3ed49be3. Re-read at origin/main (a7fb5fc7, package version 15.0.3): src/knowledge-tools.ts, src/proposals.ts and src/file-transaction.ts are identical at the two refs, so every line below holds at both.

Defect

Reads are attributed and writes are not, although the tools already hold the actor.

  • createKnowledgeTools takes actorId (src/knowledge-tools.ts:45) and uses it in exactly one place: the search receipt (:99). git grep -n actorId -- src/knowledge-tools.ts returns those two lines.
  • knowledge_record (knowledge-tools.ts:151-164) passes no actor into applyKnowledgeWriteBlocks (src/proposals.ts:42-87), which passes none into commitKnowledgeFileMutations.
  • The transaction manifest schema carries kind, transactionId, purpose, recoveryOwner, pagesDirectory, researchState, createdAt and entries (src/file-transaction.ts:52-63). There is no actor field. recoveryOwner is the closest thing and the tool path never sets it — its only writers are src/kb-improvement/selected-candidate.ts and src/kb-improvement/transition.ts.
  • The event log does have an actor field (src/events.ts:10-31), but only the research loops write events (src/research-loop.ts:298; src/verified-research-loop.ts:348-368), so a tool-driven write produces none.

Measured

Synthetic probe against the installed 15.0.2 build on a temporary store under /tmp, deleted afterwards. Two tool sets with distinct actorIds write pages into one namespace, then every file in the store is searched for either actor string:

P4 receipts actorId A: ["play-1:director-a"] B: []
P4 files naming any writer actor: []

Nine files in the store after the writes; none names a writer. A's search receipt names A, because :99 is the one place the actor is used.

Probe source is in the findings linked below.

Consequence for N directors on one problem

Discovery Lab gives every managed node the four tools with actorId: context.nodeId, over one namespace shared by all directors of a play. Retrieval is therefore fully attributable and authorship is not. When two directors hold different results for one page, nothing in the store says which director wrote which version, so neither a later director nor an operator can weigh a page by its author, ask the author for the evidence behind it, or reconstruct who changed a shared convention.

It compounds the silent overwrite in #205: when one director's page erases another's, the erased text has no author to ask and the surviving text has no author to hold to it. It also limits PR #200 — the retained history it adds records which bytes changed and still not who changed them.

Correct behavior

Pass the actorId the tools already hold into the write transaction's manifest:

knowledge-tools.ts:151-164 forwards options.actorId to applyKnowledgeWriteBlocks, proposals.ts:42-87 forwards it to commitKnowledgeFileMutations, and file-transaction.ts:52-63 gains one optional field beside recoveryOwner, written when present and absent otherwise.

That is one optional string on an existing schema. It also makes PR #200's retained history attributable at no extra cost, since the manifest is the file that history keeps.

Findings

https://github.com/tangle-network/discovery/blob/195852cc3a723511d13e6302791f08da08eeb7fb/docs/research/169-collaboration-primitives.md

Serves tangle-network/discovery#169 (map tangle-network/discovery#136). Related: #151, #200.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions