Skip to content

ref(seer): Filter private fields from explorer chat API response#113125

Open
trevor-e wants to merge 1 commit intomasterfrom
trevor-e/ref/explorer-chat-response-filtering
Open

ref(seer): Filter private fields from explorer chat API response#113125
trevor-e wants to merge 1 commit intomasterfrom
trevor-e/ref/explorer-chat-response-filtering

Conversation

@trevor-e
Copy link
Copy Markdown
Member

@trevor-e trevor-e commented Apr 15, 2026

The explorer chat GET endpoint was forwarding the full SeerRunState from Seer to users via state.dict(), exposing internal fields and metadata. All models also used extra = "allow" which let any undeclared fields from Seer leak through to the response.

Two changes:

  • extra = "ignore" on models used in the chat response, so undeclared fields from Seer are dropped at parse time rather than leaking through .dict()
  • Field(exclude=True) on some fields so they're omitted from .dict() but still accessible as attributes for internal callers (autofix, night shift, etc.)

Also declares fields the frontend consumes that were previously only passing through as Pydantic extras: owner_user_id, todos, tool_links, tool_results, thinking_content, and ToolCall.id.

Related: https://github.com/getsentry/seer/pull/5803 — this change on the Sentry side makes the Seer-side stripping of fields unnecessary for the chat endpoint.

The explorer chat GET endpoint was forwarding the full SeerRunState
from Seer to users, exposing internal fields like usage/cost data,
metadata, and coding agent state. Additionally, all models used
extra="allow" which let any undeclared fields from Seer leak through.

Change extra to "ignore" so undeclared fields are dropped at parse
time, and mark internal fields (usage, metadata, coding_agents) with
Field(exclude=True) so they are omitted from .dict() but still
accessible as attributes for internal callers like autofix.

Also declares fields the frontend consumes that were previously only
passing through as extras: owner_user_id, todos, tool_links,
tool_results, thinking_content, and ToolCall.id.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 15, 2026
@trevor-e trevor-e marked this pull request as ready for review April 15, 2026 22:00
@trevor-e trevor-e requested a review from a team as a code owner April 15, 2026 22:00
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 28e56e6. Configure here.

diff: str = ""

class Config:
extra = "allow"
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.

FilePatch still allows extra fields to leak through

Low Severity

FilePatch retains extra = "allow" while every other model in the chat response serialization chain (ExplorerFilePatch, MemoryBlock, SeerRunState, etc.) was changed to extra = "ignore". Since FilePatch is nested inside ExplorerFilePatch which appears in MemoryBlock.file_patches and MemoryBlock.merged_file_patches, any undeclared fields Seer attaches to file patch objects can still leak through state.dict() to the API response.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 28e56e6. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was intentional since there were some nested fields that were a bit painful to add types for right now. Seems fine to keep as-is for the short term, can follow up.

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

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant