Repository navigation
Fixes #32260: trust signals for AI context — gate pills on Active, read-time staleness stamping - #32261
Conversation
…on Active, read-time staleness stamping
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Hi team, the |
…upstream DQ authorization gate, log placeholder
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
…; count ellipsis inside the excerpt limit
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
…(zero-allowance structural preview)
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
…structural preview to the excerpt limit
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
…l when no caller context exists (persona materialization)
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Hi @pmbrull ! brought the branch upto date with main so that it could be merged safely! please do add the |
Code Review ✅ Approved 3 resolved / 3 findingsImplements active-pill gating and read-time staleness stamping for AI-context knowledge items. Pills in Draft or Archived state are now excluded from agent context, and stale flags with reasons are computed from asset-update timing and upstream data-quality signals. Corrects stale-cue budget reserve sizing, upstream DQ logging, and zero-length excerpt handling. No issues found. ✅ 3 resolved✅ Quality: STALE_CUE_RESERVE (80) is smaller than the rendered cue
✅ Bug: Upstream DQ log drops error detail (arg/placeholder mismatch)
✅ Bug: excerpt(content, 0) throws StringIndexOutOfBoundsException
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
|
c3d6c03
…ntext-memory visibility (#32465) (#32973) * Fixes #32260: trust signals for AI context — gate pills on Active, read-time staleness stamping (#32261) * Fixes #32260: trust signals for AI context — gate pills on Active, read-time staleness stamping * Fixes #32260: address review — exact cue budget sizing, upstream DQ authorization gate, log placeholder * Fixes #32260: charge stale cue to the shared budget pool; count ellipsis inside the excerpt limit * Fixes #32260: guard excerpt against non-positive limits (zero-allowance structural preview) * Fixes #32260: gate upstream DQ behind VIEW_TESTS, bound structural preview to the excerpt limit * Fixes #32260: suppress caller-relative upstream DQ signal when no caller context exists (persona materialization) (cherry picked from commit c3d6c03) * Apply context memory visibility rules on MCP entity reads (#32465) * fix(mcp): apply per-entity visibility rules on direct entity reads * test(mcp): cover the shared-pill lookup and state the rule in comments * review: exercise the sharedWith path, cover the admin branch, correct the scope note (cherry picked from commit d3ab545) --------- Co-authored-by: Arnab Mandal <[email protected]> Co-authored-by: Vishnu Jain <[email protected]>
|
picked to 2.0 here #32973 |



Describe your changes:
Fixes #32260
Knowledge pills (ContextMemory items) attached to an asset flow into AI context bundles (
get_asset_context, persona documents) regardless of lifecycle state, and the bundle never tells an agent whether the knowledge it is receiving is still current. This PR lands PR1 of the three-part plan proposed in #32260:toPillKnowledgeItemnow mirrors the glossary path's approval gating: pills inDraftorArchivedstate with a liveAPPLIED_TOedge are no longer served to agents as current context. Pre-lifecycle memories (no status) remain visible, matching howisApprovedtreats a missing glossary review status.KnowledgeItemgains additivestale+staleReasonsfields, stamped byAIContextBuilderfrom two deterministic, pure-function signals:assetUpdatedAfterKnowledge— the attached asset'supdatedAtis newer than the knowledge item's last update;dataQualityFailing/upstreamDataQualityFailing— the asset's (or a direct upstream's, capped at 3 edges and memoized per bundle) data-quality tests are failing.Stamping is informational only — items are never removed, so agents can weigh the signal instead of silently losing context.
fitItem) so it can never push a bundle past the caller's budget.No new status vocabulary (uses the flag annotation, not
EntityStatus), no new provenance model, no relational migration (additive fields on theKnowledgeItemJSON type;ContextMemoryschema untouched). PR2 (validity fields on ContextMemory) and PR3 (lineage-triggered invalidation) proceed only after this lands, per the issue discussion.Type of change:
High-level design:
aiContext.json(+ generated Java/TS):KnowledgeItem.stale(boolean) andKnowledgeItem.staleReasons(string[]), both optional/absent when no signal fires — backward compatible for existing consumers.AIContextBuilder:isActivePillgate intoPillKnowledgeItem; static, repository-freestampStalenesscomputes signals per pill; asset DQ is fetched once per bundle (shared with the observability section instead of a second fetch); upstream DQ is lazily computed once per bundle and capped atMAX_UPSTREAM_DQ_CHECKS = 3edges.AIContextMarkdown: renders_⚠ Stale — <reasons>._before the excerpt hint;fitItemreservesSTALE_CUE_RESERVE = 80chars for stale items so cue + excerpt stay within budget.Tests:
Use cases covered
get_asset_contextoutputassetUpdatedAfterKnowledgeUnit tests
AIContextBuilderTest(41 total in class, all green): gating, each staleness branch, zero-failure/no-timestamp negative cases, budget reserve, markdown cue.aicontext+ContextMemoryRepositoryTestclasses, plus 83 in the search-bulk-sink/filter/serializer tests that exerciseKnowledgeItemserialization (211 total).make generate,update_typescript_types).Backend integration tests
AIContextMcpITharness; happy to extend it with a stale-pill case if reviewers prefer it here.Ingestion integration tests
Playwright (UI) tests
Manual testing performed
UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Greptile Summary
Adds lifecycle gating and read-time staleness signals for AI-context knowledge items while preserving backward-compatible optional schema fields.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (7): Last reviewed commit: "Merge branch 'main' into pill-trust-gati..." | Re-trigger Greptile