Skip to content

Week 9-10: Integration testing + fix chat stream error handling - #559

Open
ashike24 wants to merge 10 commits into
GenAI-Security-Project:mainfrom
ashike24:feat/week9-10-integration-testing
Open

Week 9-10: Integration testing + fix chat stream error handling#559
ashike24 wants to merge 10 commits into
GenAI-Security-Project:mainfrom
ashike24:feat/week9-10-integration-testing

Conversation

@ashike24

@ashike24 ashike24 commented Aug 7, 2026

Copy link
Copy Markdown

Summary

Week 9-10 integration testing pass across existing deliverables (challenge library, rate limiting). No new features — this PR validates prior work and fixes one real bug found along the way.

What's in this PR

  • Bug fix: ChatAssistantBase.stream_response() had no error handling around the OpenAI responses.create() call. Any LLM failure (auth, timeout, outage) crashed the SSE stream silently, leaving the user stuck on "Thinking..." forever. Now wrapped in try/except, logs the error, and streams a clean user-facing message instead.

Testing done

  • Full test suite baseline: 398 passed, 26 skipped, 6 failed (all pre-existing, matches Week 3-4 report — not regressions)
  • Live integration test via Docker: confirmed 25 challenges / 43 badges load correctly
  • Reproduced the chat hang bug live in browser, fixed it, re-verified fix live + via logs
  • Re-ran LLM test suite post-fix: 82 passed, 0 regressions
  • Rate limiting validated live against running app: requests 1-10 return 200, requests 11+ return 429 (matches configured AGENT_RATE_LIMIT_MAX=10 / AGENT_RATE_LIMIT_WINDOW_SECONDS=60)

Notes for reviewer

  • 429 response body currently renders a "400 Bad Request" styled error page (status/content mismatch) — flagging for visibility, not fixed in this PR
  • Testing blocked in places by missing local OPENAI_API_KEY (pre-existing gap, documented since Week 7-8)

ashike24 added 10 commits May 29, 2026 17:23
Wraps the OpenAI responses.create() call in ChatAssistantBase.stream_response()
with a try/except. Previously any failure (auth error, timeout, transient
outage) crashed the SSE stream unhandled, leaving the user's browser stuck
on 'Thinking...' forever with no feedback. Now logs the error and streams
a clean user-facing message instead.

Found during Week 9-10 integration testing. Verified via live browser test
and full LLM test suite (82 passed, 0 regressions).
@ashike24

ashike24 commented Aug 7, 2026

Copy link
Copy Markdown
Author

Note for reviewer: this PR shows as including changes from #521 (challenge library) and #532 (rate limiting) since neither has been merged into main yet - this branch was built on top of my existing work. Once #521/#532 are reviewed and merged, this diff will narrow down to just the Week 9-10 changes (the chat.py bug fix). Happy to rebase/split this differently if you'd prefer - just let me know.

@ashike24

Copy link
Copy Markdown
Author

Closing this in favor of a single combined final submission: #567, which includes the chat stream fix from this PR along with everything else from the program.

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