Skip to content

fix(knowledge): report real write access for a never-written store - #192073

Merged
VACInc merged 2 commits into
mainfrom
fix/knowledge-unprovisioned-status
Nov 4, 2026
Merged

VACInc merged 2 commits into
mainfrom
fix/knowledge-unprovisioned-status

Conversation

@VACInc

@VACInc VACInc commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Summary

High Level TLDR

A brand-new Knowledge store reported writesEnabled: false from knowledge_status until something wrote to it. The skills and scribe prompts already tell the model "that's normal, keep going", but a weaker model took the status at face value and stopped without saving anything. Status now reports the write access the caller's first call will actually have, so an empty store no longer looks like a blocked one.

Root Cause

knowledge_status opens the store with provision: false (correct: status must not create stores). For any non-ready store it returned the shared notReady shape, which hard-coded writesEnabled: false, even for unprovisioned, where the caller's very next Knowledge tool call creates the store and writes succeed. The ready path computed real access (policy.writesEnabled plus the caller's grant); the unprovisioned path skipped it.

Callers papered over this in prose: skills/shared/setup.md ("A brand-new store reports … writesEnabled: false … That is normal: continue") and the scribe access step ("a vault that was never written reports writes off until its first write").

Observed before: a "Learn from conversations"-style ingest run on a fresh store with deepseek-v4-flash called knowledge_status, saw store: "unprovisioned", writesEnabled: false, empty vault, and ended with Scribe status: failed — … no write could be authorized … the store unprovisioned … 0 claims and 0 pages were written. After a setup turn created the store, the same model and prompt ingested normally.

Change

  • service.ts status: compute canWrite once (unchanged logic) and report it for unprovisioned stores. initializing, unavailable and recovery-required still report false. Status still never provisions.
  • skills/shared/setup.md (+ regenerated references/setup.md copies): writesEnabled on a new store already says whether you may write; stop only when it is false.
  • scribes-catalog.ts access step: drop the "reports writes off until its first write" workaround.

Scope boundary

No change to provisioning, grants, operator inspection, store states, the status schema, or when stores are created. Operators (who cannot write through status context) and read-only grants still see false; plugin writesEnabled: false still wins.

Verification

  • extensions/knowledge/src/stores.test.ts "passive discovery…" now asserts a fresh store reports writesEnabled: false to an operator reader and true to an agent tool, and that status still creates no store directory. (Folded into the existing test so the PR adds no net test lines.)
  • Fails on main (Expected true, Received false); passes with the change.
  • node scripts/run-vitest.mjs run extensions/knowledge: 59/59 files pass.
  • pnpm check:changed: everything passes except the dead export scan, which fails on files this PR does not touch (extensions/nostr/browser/components.tsx, ui/src/pages/channels/view.config.tsx, ui/src/pages/channels/view.shared.tsx; same on main). Formatting fixed and rechecked.

Real behavior proof

Self-hosted Gateway on a loopback port with an isolated state dir, Knowledge as the memory slot, writesEnabled: true, deepseek-v4-flash as the agent model, fresh empty state. Before: the first ingest turn stopped at knowledge_status with 0 writes (status quoted above). The fix was validated at the tool contract level by the test above; the end-to-end model rerun on the patched build was not repeated.

What was not tested

  • A rerun of the weak-model ingest turn against a build containing this patch.
  • Conversation-partition and shared-store grants beyond what existing tests cover; the access computation itself is unchanged and shared with the ready path.
  • Unprovisioned status still reports scope: "private" for every caller, as before. A conversation-audience caller without a grant would really write to its conversation partition; that pre-existing reporting gap is unchanged here.

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reports caller write access for an unprovisioned Knowledge store and removes the corresponding skill and scribe workarounds.

Example: An owner agent calls knowledge_status with writesEnabled enabled before its first Knowledge use.

  • Before: Status returns store: "unprovisioned", vault: "", writesEnabled: false.
  • After: Status returns store: "unprovisioned", vault: "", writesEnabled: true without provisioning the store.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and source-consistent, but supplied after-fix evidence does not exercise the shipped ingest flow.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A model can interpret a fresh Knowledge store as write-disabled and stop ingestion without saving anything.
Reason: Accurate status removes a demonstrated model-facing contradiction, and this maintainer-authored PR establishes direction without adding configuration or changing write authority.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it corrects a misleading status on current main with a focused change, and source review found no concrete introduced defect.

Priority: P2
Reviewed head: bb6b3bbef2814d9a831007729627422a0613cdf2

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Show the fresh-store ingest flow through an isolated Gateway on the patched build, from writable unprovisioned status through a successful save.
Agent review details

How this fits together

Knowledge tools resolve the caller's store and partition through the plugin service; status returns availability and access information, while subsequent authorized tool calls provision storage.

flowchart TD
  A[Agent or operator] --> B[Knowledge service]
  B --> C[Principal and grant resolution]
  C --> D[Store registry]
  D --> E[Nonprovisioning status response]
  D --> F[Authorized tool provisioning]
Loading

Technical review

Best possible solution:

Keep status nonprovisioning while using the existing access calculation for unprovisioned stores and removing the obsolete caller workarounds.

Do we have a high-confidence way to reproduce the issue?

Current-main source directly establishes the false status for unprovisioned stores; the PR also reports an affected real ingest turn, but this review executed no target code.

Is this the best way to solve the issue?

The patch fixes the reporting owner, preserves provisioning and authorization, and updates the shared guidance and generated consumers without introducing another policy path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1248bee4959b.

Provenance checked

  • Knowledge status and shared setup guidance changes intended behavior with a stated reason (65ad180: Bundling preserved lazy store creation and nonprovisioning inspection; the setup guidance compensated for fresh-store status.)
  • Conversation grant calculation keeps the original intent (3a5a369: Owner grants distinguish private read access from permission to save; the patch retains this calculation unchanged.)
  • Scribe access instruction changes intended behavior with a stated reason (ed23336: Readable scribe prompts put access checks inline; correcting status makes the never-written-store exception unnecessary.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit 65ad180 adds extensions/knowledge/src/service.ts:408 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 65ad18005286; files: extensions/knowledge/src/service.ts)

PR surface

Source +4, Tests +22, Docs 0. Total +26 across 12 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 15 11 +4
Tests 1 22 0 +22
Docs 9 45 45 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 82 56 +26

Labels

Label changes:

  • add P2: Misleading fresh-store status can stop optional Knowledge ingest before saving, with limited blast radius.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Misleading fresh-store status can stop optional Knowledge ingest before saving, with limited blast radius.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 3, 2026, 11:43 AM ET / 16:43 UTC.

@VACInc
VACInc merged commit 96dc3b7 into main Nov 4, 2026
101 of 102 checks passed
@VACInc
VACInc deleted the fix/knowledge-unprovisioned-status branch November 4, 2026 17:27
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 5, 2026
…penclaw#192073)

* fix(knowledge): report real write access for a never-written store

* test(knowledge): fold unprovisioned status check into passive discovery test

---------

Co-authored-by: VACInc <[email protected]>
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
…penclaw#192073)

* fix(knowledge): report real write access for a never-written store

* test(knowledge): fold unprovisioned status check into passive discovery test

---------

Co-authored-by: VACInc <[email protected]>

(cherry picked from commit 96dc3b7)

Private LOCAL11.8 preparation; canonical integration pending.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 73bf343bf33bbb837f82e5846d9ec60168d8eace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. plugin: knowledge rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant