Skip to content

Scope /ai/predict_am_queries to the window's team - #15555

Merged
IsaiahWitzke merged 2 commits into
masterfrom
factory/team-header-predict-queries
Aug 26, 2026
Merged

Scope /ai/predict_am_queries to the window's team#15555
IsaiahWitzke merged 2 commits into
masterfrom
factory/team-header-predict-queries

Conversation

@warp-agent-staging

Copy link
Copy Markdown
Contributor

Summary

POST /ai/predict_am_queries (Agent Mode next-query prediction) sent no team context. The /ai group's SetActiveTeamFromHeader middleware only picks up the header, so omitting it silently falls through GetActiveTeamOrFallbackToPrincipalGetTeamForPrincipal, which resolves to whichever team happens to have the lowest id — an arbitrary, and possibly wrong, team for a member of more than one.

Changes

  • ServerApi::predict_am_queries now takes a RequestTeamScope and sends it as X-Warp-Team-Uid when present, following the /ai/multi-agent pattern ([multi-team] Scope multi-agent requests to a team #15355).
  • Input::predict_am_query resolves the scope from the live window via UserWorkspaces::team_context_for_operation, pinning it at send time (this call spawns an async request, same as the existing multi-agent send path).

Verification

  • ./script/format
  • cargo clippy -p warp --lib --tests -- -D warnings (clean)
  • No existing unit tests cover this thin network wrapper method; verified by inspection that the header is set conditionally and threading compiles against the live ViewContext<Input> available at the call site.

Send X-Warp-Team-Uid on POST /ai/predict_am_queries, resolved from the
input view's window via RequestTeamScope, so the server no longer
falls back to GetTeamForPrincipal's lowest-team-id default when a
member is on multiple teams.
@cla-bot cla-bot Bot added the cla-signed label Aug 26, 2026
@warp-agent-staging
warp-agent-staging Bot marked this pull request as ready for review August 26, 2026 03:49
@warp-agent-staging

warp-agent-staging Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

This PR was generated with Warp.

Comment @warp-factory on this PR to send it follow-up work.

View run View conversation View on Slack

@IsaiahWitzke
IsaiahWitzke enabled auto-merge (squash) August 26, 2026 03:57
The scope resolution on the preceding line already says it's pinned
at send; the comment only restated that.
@IsaiahWitzke
IsaiahWitzke merged commit 9c25711 into master Aug 26, 2026
26 checks passed
@IsaiahWitzke
IsaiahWitzke deleted the factory/team-header-predict-queries branch August 26, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant