Skip to content

fix: forward answers to pending questions - #22

Merged
swapnildahiphale merged 2 commits into
swapnildahiphale:mainfrom
snowyukitty:fix/answer-endpoint-semantics
Sep 8, 2026
Merged

swapnildahiphale merged 2 commits into
swapnildahiphale:mainfrom
snowyukitty:fix/answer-endpoint-semantics

Conversation

@snowyukitty

@snowyukitty snowyukitty commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Make the simple-mode /answer endpoint report success only after an executing session accepts the payload into a pending AskUserQuestion.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🔧 Refactoring / code cleanup
  • 🧪 Test improvements
  • 🚀 Performance improvement
  • 🔒 Security fix

Related Issues

Closes #20

Changes Made

  • reject answers for idle sessions or sessions without a pending question
  • await the production session consumer before returning HTTP 200
  • use a typed no-pending-question exception so unrelated runtime failures are not translated to HTTP 409
  • cover missing, idle, no-pending, unrelated-failure, and successful delivery through the real FastAPI route

Testing

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • Tested locally with Docker Compose
  • Tested in Kubernetes environment (if applicable)

Testing Steps

  1. Ran 23 focused answer, interrupt, queue-message, and completion tests; all passed.
  2. Exercised the real /answer route with a concurrent waiter and verified the exact payload and event signal.
  3. Verified an unrelated RuntimeError containing the old marker remains a server error instead of being translated to HTTP 409.
  4. Ran the broader suite: 218 passed, 19 skipped, and five unrelated environment/baseline failures remained (two end-to-end tests require a local service, two reproduce existing agent-registry failures, and one requires GNU grep on PATH).
  5. Ran changed-file ruff check and git diff --check; both passed.
  6. Maintainer local validation: clean merge and rebase onto current main; ruff check on changed files passed; 379 unit tests passed (+5 new), 3 pre-existing Helm template failures unrelated to this PR.

Screenshots / Videos

Not applicable; this is an API behavior change.

Checklist

  • Code follows the project's style guidelines (black and ruff for Python; changed-file Ruff lint passes)
  • Self-review of code completed
  • Comments added for complex logic (not needed beyond the typed exception docstring)
  • Documentation updated (not needed; the public API shape is unchanged)
  • No new warnings introduced
  • Tests added/updated and passing
  • All CI checks passing (no PR CI workflow on this repo)
  • Changes comply with Apache 2.0 license
  • Branch is up to date with main

Additional Context

The no-pending condition now uses a dedicated NoPendingQuestionError; unrelated runtime failures propagate normally.

Deployment Notes

  • Requires database migration
  • Requires configuration changes
  • Requires environment variable updates
  • Requires new secrets/credentials
  • Backward compatible
  • None of the above

@swapnildahiphale swapnildahiphale left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for fixing this — the /answer false-success bug was real and this is a clean, well-scoped fix for #20.

Validated locally: merges cleanly onto current main (merge and rebase both work), ruff check on changed files passes, and the full sre-agent unit suite is green aside from 3 pre-existing Helm dependency test failures on main. Good to merge.

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.

[Bug]: Answer endpoint returns success without forwarding the answer

2 participants