Skip to content

Fix: suppress handled chat agent max-turn Sentry events#326

Merged
ohld merged 1 commit into
productionfrom
fix/ffm-1764-chat-agent-max-turns-sentry
Jun 27, 2026
Merged

Fix: suppress handled chat agent max-turn Sentry events#326
ohld merged 1 commit into
productionfrom
fix/ffm-1764-chat-agent-max-turns-sentry

Conversation

@ohld

@ohld ohld commented Jun 27, 2026

Copy link
Copy Markdown
Member

Fixes FFM-1764.

Summary

  • Add chat-agent Sentry scope around the OpenAI Agents runner call so agent events carry explicit chat-agent context.
  • Drop expected agents.exceptions.MaxTurnsExceeded events from the chat-agent path even when Sentry reports them with logger=null / mechanism=openai_agents.
  • Add regression coverage for both scoped chat-agent events and the production webhook event shape.

Verification

  • python3 -m pytest tests/test_sentry_observability.py -q
  • ruff check --fix src/ tests/ && ruff format src/ tests/

Notes

  • Host Python lacks the app agents.exceptions dependency and Docker is unavailable here, so tests/tgbot/test_chat_agent_runner.py could not be collected locally. CI should run it in the app dependency environment.

@ohld

ohld commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

STAFF ENGINEER REVIEW: APPROVED — clean structural review. Checked Sentry suppression scope, chat-agent context lifetime, Agents SDK call sites, secret patterns, and targeted regressions. Codex review found no discrete regression. Local verification: python3 -m pytest tests/test_sentry_observability.py -q passed; tests/tgbot/test_chat_agent_runner.py could not collect on host because agents.exceptions is unavailable in this runtime.

@ohld ohld merged commit efff64e into production Jun 27, 2026
3 checks passed
@ohld

ohld commented Jun 27, 2026

Copy link
Copy Markdown
Member Author

✅ Approved + merged.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant