Skip to content

fix(adk): preserve A2A user identity before task resolution - #11

Closed
erauner12 wants to merge 2 commits into
mainfrom
fix-adk-preserve-a2a-user-identity
Closed

erauner12 wants to merge 2 commits into
mainfrom
fix-adk-preserve-a2a-user-identity

Conversation

@erauner12

@erauner12 erauner12 commented Aug 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Preserve the initiating A2A user identity in the context returned by the Go runtime call interceptor, so pre-executor task-store callbacks observe the same authenticated user as CallContext.User.

Problem

UserIDCallInterceptor.Before already reads x-user-id from the authenticated A2A request and assigns it to CallContext.User, but it returned the original context unchanged.

Task resolution can occur before KAgentExecutor.Execute adds identity to the invocation context. Pre-executor TaskStore.Get and TaskStore.Save callbacks that read identity from context.Context could therefore fall back to the runtime service identity. This breaks owner-scoped access when a persisted continuation arrives in a later request or process.

Change

userIDInterceptor.Before now returns auth.WithUserID(ctx, userID) after populating CallContext.User. Both identity access paths therefore carry the same authenticated user before stored-task resolution begins.

Trust boundary

This does not add a new identity source or broaden trust in caller-controlled metadata. The interceptor already accepts the authenticated service parameter and exposes it as CallContext.User; this change makes the returned Go context consistent with that existing call identity.

Contract protected

A persisted A2A continuation is a new request. Runtime task callbacks must reconstruct the authenticated owner on every request rather than relying on executor-local state from the original invocation.

The regression test protects both CallContext.User and auth.UserIDFromContext(returnedContext). This server-side contract remains relevant even when an in-repository UI does not exercise cross-process A2A continuation.

Scope and companion seams

This PR changes only the Go ADK runtime context lifecycle. It does not:

  • forward the controller's effective user on the legacy controller-to-runtime hop, tracked in kagent-dev/kagent#2467;
  • implement persistent exact A2A GetTask, tracked in kagent-dev/kagent#2464; or
  • change the Python runtime.

The controller forwarding and runtime context changes are independently testable but complementary for Go-runtime persisted resume.

Changed files

  • go/adk/pkg/a2a/executor.go
  • go/adk/pkg/a2a/executor_test.go

Tests

  • cd go && go test ./adk/pkg/a2a -run '^TestUserIDCallInterceptor$' -count=1 — passed
  • cd go && go test ./adk/pkg/a2a — passed

Validation status

The Go-specific behavior is directly covered by the interceptor regression test. Combined controller-route validation performed with a Python declarative runtime is intentionally not presented as live proof of this Go-only change.

Intended upstream issue: kagent-dev/kagent#2465.

@github-actions github-actions Bot added the bug Something isn't working label Aug 17, 2026
@erauner12
erauner12 force-pushed the fix-adk-preserve-a2a-user-identity branch from 9eadec9 to 409d7f9 Compare August 17, 2026 18:57
@erauner12
erauner12 force-pushed the fix-adk-preserve-a2a-user-identity branch from 409d7f9 to cb75094 Compare August 17, 2026 19:21
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Aug 17, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Aug 17, 2026
@erauner12

erauner12 commented Aug 17, 2026 •

Copy link
Copy Markdown
Owner Author

CI status

The failing go-unit-tests and previous-stable upgrade checks reproduce unchanged on the PR base commit (bc92b68) in upstream main: https://github.com/kagent-dev/kagent/actions/runs/32034286380.

  • go-unit-tests fails while concurrently provisioning shared envtest binaries.
  • The previous-stable upgrade jobs time out with the new controller pod in CrashLoopBackOff.
  • The adjacent upgrade jobs pass.

These failures are therefore unrelated to the changed packages in this PR. The checks can be rerun or the branch rebased after the upstream base-branch failures are resolved.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Aug 18, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Aug 18, 2026
@erauner12

Copy link
Copy Markdown
Owner Author

Superseded for release/v0.10.x by kagent-dev#2483. Retained as a main-oriented forward-port reference; the upstream PR contains the authoritative request-scoping behavior and tests. The source branch is intentionally retained for now.

@erauner12 erauner12 closed this Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant