Revert "ref(seer): Filter private fields from explorer chat API response"#113195
Closed
Revert "ref(seer): Filter private fields from explorer chat API response"#113195
Conversation
…nse (#113125)" This reverts commit a2b4584. Adding `Field(exclude=True)` to `SeerRunState.metadata` (and `coding_agents`, `usage`) causes `trigger_push_changes` to raise `SeerPermissionError` — the `open_pr` path calls `client.get_run(run_id)` which round-trips the state through `.dict()`, dropping `metadata` and failing the `state.metadata.get("group_id") != group.id` check in autofix_agent.py, which the endpoint surfaces as 404. Breaks `test_open_pr`, `test_open_pr_with_repo_name`, and `test_open_pr_without_repo_name` in `GroupAutofixEndpointExplorerRoutingTest`. Agent transcript: https://claudescope.sentry.dev/share/jrltmqqO9R5-5IFIdaBmPVdw_GfoseCtIvlM1JXrb90
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Reverts #113125 (commit a2b4584).
Why
Adding
Field(exclude=True)toSeerRunState.metadata(andcoding_agents,usage) breaks theopen_prautofix path.trigger_push_changesinsrc/sentry/seer/autofix/autofix_agent.pycallsclient.get_run(run_id), which round-trips the state throughSeerRunState.dict(). Withexclude=True,metadatais dropped, so the subsequentstate.metadata.get("group_id") != group.idcheck raisesSeerPermissionError, which the endpoint converts to a 404.Breaks these tests in
GroupAutofixEndpointExplorerRoutingTest:test_open_prtest_open_pr_with_repo_nametest_open_pr_without_repo_nameThe original PR's goal (not leaking private fields from the chat GET endpoint) is still worth doing — but it needs to avoid mutating
.dict()on fields that internal callers (autofix, night shift) rely on. Recommended follow-up: filter at the chat endpoint's serialization layer instead of at the model level.Test plan
GroupAutofixEndpointExplorerRoutingTestpass locallyAgent transcript: https://claudescope.sentry.dev/share/UNpzUgEqDq3qylO2yWNXUNup8rl7E67hslWFRdN21Mo