Miracle778
5a699e24a1
feat(guardrails): expose authenticated runtime context in GuardrailRequest (#3665)
* docs: guardrail runtime attribution spec
* docs: guardrail request attribution implementation plan
* feat(guardrails): add runtime user context and attribution fields to GuardrailRequest
Extend GuardrailRequest with optional runtime attribution fields so that
pluggable GuardrailProviders can access authenticated user context and
tool-call-level attribution:
- Gateway injects user_role, oauth_provider, oauth_id into runtime context
alongside the existing user_id (server-authenticated only, client spoofing
prevented)
- GuardrailRequest gains: user_id, user_role, oauth_provider, oauth_id,
run_id, tool_call_id (all optional, backward compatible)
- GuardrailMiddleware reads these from ToolCallRequest.runtime.context
- thread_id now actually populated from context (was always None before)
- Tests: 15 new/expanded tests covering Gateway injection, runtime context
reading, partial/missing fields, and client spoofing prevention
- Docs: new Runtime Attribution section in GUARDRAILS.md with provider
example and YAML policy illustration
* fix(guardrails): propagate attribution to subagents
* fix(guardrails): complete subagent attribution propagation
---------
Co-authored-by: Miracle778 <miracle778@no-reply.com>
2026-06-21 16:08:25 +08:00
..
2026-06-16 23:20:20 +08:00
2026-03-26 00:14:08 +08:00
2026-06-16 23:20:20 +08:00
2026-06-21 15:47:53 +08:00
2026-06-02 10:03:28 +08:00
2026-05-29 11:36:45 +08:00
2026-06-02 10:03:28 +08:00
2026-04-05 15:35:42 +08:00
2026-06-12 10:20:38 +08:00
2026-06-21 15:55:10 +08:00
2026-05-01 20:19:30 +08:00
2026-06-21 16:08:25 +08:00
2026-06-18 10:45:33 +08:00
2026-05-22 09:19:23 +08:00
2026-03-14 22:55:52 +08:00
2026-06-10 23:26:15 +08:00
2026-03-29 23:53:23 +08:00
2026-03-29 23:53:23 +08:00
2026-05-21 14:36:07 +08:00
2026-03-14 22:55:52 +08:00
2026-06-09 11:56:28 +08:00
2026-06-03 22:02:27 +08:00
2026-06-09 21:58:31 +08:00
2026-03-29 15:31:18 +08:00
2026-03-25 16:28:33 +08:00
2026-04-03 16:03:06 +08:00
2026-06-03 22:02:27 +08:00
2026-05-01 22:19:50 +08:00
2026-06-21 15:47:53 +08:00
2026-04-10 18:16:38 +08:00
2026-04-24 21:19:46 +08:00
2026-03-14 22:55:52 +08:00
2026-04-26 11:09:55 +08:00
2026-05-29 11:36:45 +08:00