Open
Conversation
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 problem does this PR solve?
Issue Number: ref #xxx
Problem Summary:
From the user spec and design package, the core problem is not just missing code paths—it is missing product-level memory guarantees for agent applications:
This PR delivers the first end-to-end TiDB Agent Memory baseline to close that gap.
What changed and how does it work?
1) Business value: consistent memory UX across clients
Aligned with the user spec goal (consistent memory experience with TiDB guarantees), this PR establishes a unified memory data plane contract so client integrations can rely on one behavior model for store/search/pack/trace workflows.
2) Business value: safe multi-tenant foundation you can trust
Milestone A outcomes are now executable:
This reduces isolation risk and gives operators a governance baseline for shared-agent deployments.
3) Business value: predictable recall quality and cost
Milestone B delivers deterministic hybrid retrieval and token-budgeted context assembly with guardrails, plus lifecycle core controls (pause/resume/cancel, idempotence/recovery). This improves answer consistency under retries and limits latency/cost spikes from unbounded candidate expansion.
4) Business value: production hardening for debugging and compliance
Milestone C delivers observability/explain surfaces, adapter conformance path, and security hardening (redaction/privileged access/purge safety), so teams can diagnose why memory was selected or denied and enforce policy consistently.
5) Business value: rollout confidence and operator readiness
A5/B5/C5 evidence docs and backlog gate reconciliation were added to make release readiness explicit and reproducible (canary/rollback rehearsal scope + command evidence), enabling staged rollout with lower operational risk.
User-facing outcomes (from spec perspective)
Check List
Tests
Manual validation commands executed:
make bazel_preparemake lintgo test -run '^(TestBootstrap|TestUpgrade|TestVersionedBootstrapSchemas)$' -tags=intest,deadlock ./pkg/session -count=1go test -run '^(TestAgentMemoryTenantContextFailClosed|TestRunAgentMemoryPipelineTenantContextFailClosed|TestAgentMemoryAuditStorageCardinalityUnderLoad)$' -tags=intest,deadlock ./pkg/planner/core -count=1go test -run '^TestAgentMemoryContextSysVarsConcurrentIsolation$' -tags=intest,deadlock ./pkg/sessionctx/variable -count=1make failpoint-enable && (go test ./pkg/planner/core -run 'TestObserveAgentMemoryPipelineNormalPath|TestObserveAgentMemoryPipelineErrorPathAlwaysSampled|TestObserveAgentMemoryPipelineSuccessSamplingControl|TestObserveAgentMemoryPipelinePayloadCaptureOptIn|TestBuildAgentMemoryExplainStages|TestBuildAgentMemoryExplainStagesErrorPath|TestRenderAgentMemoryExplainRowsStable|TestQueryAgentMemoryTraceRowsStableOrder|TestAssembleAgentMemoryContextBudgetAndManifest|TestRunAgentMemoryPipelineDeterministicOutput|TestRunAgentMemoryPipelineLifecycleStateInfluence|TestAgentMemoryTenantContextFailClosed|TestAgentMemoryRetrievalFallbackWarning|TestRankAgentMemoryCandidatesDeterministic' -tags=intest,deadlock && go test ./pkg/session -run 'TestAgentMemoryAdapterVersionNegotiation|TestAgentMemoryAdapterConformanceEndToEnd|TestAgentMemoryAdapterCompatibilityMatrix|TestApplyAgentMemoryRedactionByRole|TestApplyAgentMemorySecurityPolicyTenantIsolation|TestApplyAgentMemorySecurityPolicyPrivilegedTenantScoped|TestValidateAgentMemoryPrivilegedAccessReason|TestAgentMemoryPurgeWorkflowCheckpointRecovery|TestAgentMemoryLifecycleTaskIdempotenceAcrossRetries|TestAgentMemoryLifecyclePauseResumeCancelConcurrentSafe|TestAgentMemoryLifecycleCheckpointRecovery|TestAgentMemoryLifecycleFilterArchivedDefault' -tags=intest,deadlock && go test ./pkg/sessionctx/variable -run 'TestAgentMemoryContextSysVarsConcurrentIsolation|TestAgentMemoryContextSysVars|TestAgentMemoryHybridRetrievalSysVars' -tags=intest,deadlock); rc=$?; make failpoint-disable; exit $rcgo test ./br/pkg/restore/snap_client -run TestMonitorTheSystemTableIncremental -tags=intest,deadlockSide effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.