Repository navigation
fix(CF-5, CF-8, CF-10, CF-15): GM-assistant follow-up — knowledge corrections, phase-4 panels, story attribution - #154
Merged
Merged
Conversation
added 9 commits
November 12, 2026 00:39
…GM panel follow-ups Review fixes and phase-4 work on top of PR #147: - Knowledge corrections: retract or correct a character's attribution through CanonKeeper across MongoDB + Qdrant + fact properties, with a retryable checkpoint (prepare_knowledge_memory_change / apply_knowledge_correction); stale staged challenges are detected instead of applied over changed text, and knowledge_excluded is honored by fact_visible_to, the audit, and the proposal queue. - G02 phase 4: segment review UI in SessionRecorder (play, edit text, map speaker, queue as entry), collision-proof upload keys, cleanup on failed transcription. - G09 phase 4: paginated knowledge inspector (offset/next_offset through tool, agent, route, UI) with retract/correct challenge dialogs. - Review panel: batch verdicts (by ids and by filter) route through accept_proposal so a batch accept cannot sidestep the G08 override; the by-filter path owner-checks each match; _resolve_review_flags merges flags instead of dropping them.
Scratchpad notes ingested during a recorded session now attribute their proposals to the recording's story — dual attribution (recording story + ingest job) so the story-level review lane sees them: - SessionRecorder reports the active recording's story to the GM page; the scratchpad's Ingest button sends it as story_id on the upload. - The upload route validates and ownership-checks story_id and threads it through _run_ingest_in_thread -> IngestionPipeline.ingest_file. - ingest_file stamps story_id on the ingestion job (both create paths). - mongodb_apply_knowledge_pack stamps story_id on every proposal it materialises, from the request or inherited from the job via the pack — covering both the analyzer auto-apply and the delayed manual apply. - bulk_enqueue_proposals carries the same stamp on the retag path.
- GM_ASSISTANT_MODE_PLAN / FORGE_EXPANSION §17: P3.2(b) marked done. - STATUS.md / HANDOFF.md: record the story-attribution follow-up and the enabled provider-key encryption (key generated into .env; re-save keys with the stack up to encrypt pre-existing rows). - env.example: document MONITOR_PROVIDER_KEY_ENCRYPTION_KEY.
Accepting a correction writes MongoDB + Qdrant + fact properties and then the verdict; a crash in between used to require a manual accept-retry. A periodic sweep (monitor_ui/correction_reconcile.py, every MONITOR_CORRECTION_RECONCILER_INTERVAL seconds — 60 by default, 0 disables) now completes those accepts on its own: - mongodb_find_interrupted_corrections / mongodb_mark_correction_stalled scan for checkpointed accepts without an applied verdict. - The checkpoint proves review gating already passed, so reconciliation finishes the write + verdict like the original accept — including the G08 override audit row when a contradiction was overridden. - A correction whose target moved under it is marked knowledge_reconciliation_error for a human instead of looping. Tests: hermetic reconciler finish/idempotence/stall cases plus mongomock unit tests for the scan tools. Full suite 10,409 passed, 236 skipped.
…iour test One end-to-end rule on the hermetic stack: a challenged attribution is retracted or corrected and lands in every store the character's knowledge is read from (MongoDB, Qdrant, fact visibility, the pending-proposal queue) — completely, never half. Covers staging via KnowledgeAuditAgent (challenge records the original statement), memory retract/correct, fact retract, proposal retract, an accept cut off mid-write finished by the auto-reconciler (idempotent), and a stale attribution refused rather than applied over.
spuentesp
added a commit
that referenced
this pull request
Nov 13, 2026
docs(DOC-1): record PR #154 merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Post-#147 follow-up for the GM-assistant wave (7 commits on
gap/wave1-integration):prepare_knowledge_memory_change/apply_knowledge_correction). Staged challenges detect stale attributions and refuse to apply over changed text;knowledge_excludedis honored byfact_visible_to, the audit, and the pending-proposal queue.monitor_ui/correction_reconcile.py,MONITOR_CORRECTION_RECONCILER_INTERVAL— 60 s default, 0 disables) now completes accepts whose writes were cut off, with no manual retry. A correction whose target moved under it is markedknowledge_reconciliation_errorfor a human instead of looping; a reconciled contradiction override still lands its G08 audit row.offset/next_offsetthrough tool → agent → route → UI) with retract/correct challenge dialogs.accept_proposalso a batch accept cannot sidestep the G08 override requirement; the by-filter path owner-checks each match;_resolve_review_flagsmerges flags instead of dropping them.story_idonto the ingestion job and every proposal the pack materializes (explicit on apply, inherited from the job otherwise), so story-scoped review sees them alongside the ingest listing.MONITOR_PROVIDER_KEY_ENCRYPTION_KEYdocumented inenv.example.Verified
uv run pytest packages tests -q -n auto— 10,416 passed, 236 skipped (includes the P3.2(b) tests, the reconciler tests, and the general knowledge-correction lifecycle behaviour test: staging → retract/correct across memory/fact/proposal → interruption → auto-reconcile → stale-attribution refusal).npx vitest run— 581 passed (88 files; includes the story-reporting test).ruff check,mypy(486 source files),tsc --noEmit,check_layer_dependencies.py— all clean.tests/contracts/test_knowledge_correction_live.py(RUN_INTEGRATION=1; passed earlier against Neo4j/Mongo/Qdrant + the embedding service).