Skip to content

feat(context): govern and enforce Agent context budgets - #3759

Open
JasonW404 wants to merge 10 commits into
developfrom
fix/context_budget
Open

feat(context): govern and enforce Agent context budgets#3759
JasonW404 wants to merge 10 commits into
developfrom
fix/context_budget

Conversation

@JasonW404

Copy link
Copy Markdown
Member

Summary

Implements the complete context-budget P0-P3 plan: safe capacity configuration, governed model profiles, final Provider-request budget enforcement, compaction, and observable health/usage workflows.

Backend and runtime

  • Validate and persist explicit model capacity limits without manufacturing unknown values.
  • Add model identity, capability-profile matching, field-level provenance, tokenizer governance, count probing, catalog adoption, and lifecycle health.
  • Meter the exact final Provider request, enforce soft/hard budgets, compact context safely, support one-shot recovery, and calibrate estimates from Provider usage.
  • Persist content-free request evidence and expose tenant-isolated operational metrics.
  • Add health, catalog, remediation, and monitoring APIs with existing authorization boundaries.

UI and UX

  • Add validated capacity fields and governed suggestions to model create/edit flows.
  • Add model-capacity health, lifecycle, review, and field-level remediation UI.
  • Show live and persisted context usage, token-component breakdowns, thresholds, count source, compaction savings, and optimization reasons in chat.
  • Add context-budget operations metrics and English/Chinese copy.

Other changes

  • Add governance and observability database migrations.
  • Add acceptance-driven backend, SDK, migration, monitoring, and frontend regression coverage.
  • Preserve old model rows, monitoring records, and conversation history.

Verification

  • All P0-P3 acceptance criteria pass in the specification evidence.
  • Final affected backend gate: 100 passed.
  • Frontend type-check and production build: PASS.
  • Final images: nexent/nexent:context-budget-p3-a33295a and nexent/nexent-web:context-budget-p3-a33295a.
  • Full browser acceptance passed with permanent tenant and real Qwen3.7-plus.
  • Normal trace: f732eb0e01f72174b1234b1ea55e4463.
  • Compaction trace: 9280aa7369d7ea56e546bef742a3fdae; 29,603 to 21,623 tokens, saving 7,980 (27%).
  • Tenant ADMIN remediation and ordinary USER permission checks passed.

Copilot AI lite review requested due to automatic review settings August 24, 2026 08:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants