Repository navigation
Restore AI budget and authentication fixes that never reached main - #46
Merged
Merged
Conversation
This was referenced Oct 13, 2026
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.
Main 7831282 still has the account/scope races and budget bypasses fixed in #39, #42 and #43. Those PRs were merged into their feature-branch bases after #37 had already been squashed into main; their fixes and regression tests therefore never reached main.
Reapply the reviewed patches together: atomic in-flight budget reservations and embedding/enrichment accounting; request-local authentication snapshots; and scoped-agent credential escalation prevention. Correct the security-audit integration record. This PR targets main directly.
Reproduction on current main: Alice's interleaved account request returns Bob; anonymous and limited-token requests inherit other credentials; scoped tokens mint/harvest unrestricted tokens; publisher AI usage stays zero; and embeddings/negative-overflow accounting bypass budgets. The copied original regressions fail before restoration and pass afterward.
Validation: full go test -race -timeout 10m ./... with only the environment-blocked TestCLI_Serve_Unix_Curl explicitly skipped, plus go vet. PostgreSQL remains covered by CI. Existing web baseline is 101 passing tests. No new AI behavior is added here; the per-account consent policy will be a separate change.