Skip to content

feat(ui-api): Ask SSE blueprint factory - #427

Draft
haileyok wants to merge 1 commit into
hailey/ask-ai-2-servicefrom
hailey/ask-ai-3-sse
Draft

feat(ui-api): Ask SSE blueprint factory#427
haileyok wants to merge 1 commit into
hailey/ask-ai-2-servicefrom
hailey/ask-ai-3-sse

Conversation

@haileyok

Copy link
Copy Markdown
Member

Description

Part 3/5 of the Ask AI stack (stacked on hailey/ask-ai-2-service). Adds osprey_worker/ui_api/lib/ask: versioned SSE serialization and create_ask_blueprint(...) — a host-configurable Flask factory that validates the JSON body (strict Pydantic v1), derives the principal from a host-supplied provider (never the body), drives AskService.run_turn behind a safe pre-flight boundary (unexpected host-adapter failures become a safe JSON 500), and streams events with a terminal-seen guard so a started stream always ends in exactly one done/error. Not registered in create_app(); exercised via a dedicated test app. Implements AC4.1–AC4.5.

Checklist

  • Tests pass locally (16 tests via ./run-tests.sh)
  • uv run ruff check . passes
  • uv tool run fawltydeps --check-unused --pyenv .venv passes
  • Updated CHANGELOG.md (deferred — happy to add)

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a6821afc-2b1d-4c6e-bfa8-d1143d436c3a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hailey/ask-ai-3-sse

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Add osprey_worker/ui_api/lib/ask: format_sse (versioned SSE framing that raises
SerializationError on a non-serializable payload) and create_ask_blueprint -- a
host-configurable Flask factory that validates the JSON body (strict Pydantic v1),
derives the principal from a host-supplied provider (never the body), drives
AskService.run_turn behind a safe pre-flight boundary (unexpected host-adapter
failures become a safe JSON 500), and streams events with a terminal-seen guard so a
started stream always ends in exactly one done/error. Not registered in create_app();
exercised via a dedicated test app.

Also widen AskService.run_turn's return annotation to Generator so the transport can
close() it for prompt lock release.

Tests (16 passing under run-tests.sh) cover content-type/framing/versioning, malformed/
wrong-type/missing-provider/ownership/model/lock pre-flight errors, throwing factory/
principal safe 500s, safe provider-failure error frames, serialization-failure
termination, and the terminal guard.

Implements osprey-ask-ai AC4.1-AC4.5.
@haileyok
haileyok force-pushed the hailey/ask-ai-2-service branch from 45f307d to 44cfeca Compare July 14, 2026 22:13
@haileyok
haileyok force-pushed the hailey/ask-ai-3-sse branch from f198727 to 1773779 Compare July 14, 2026 22:13
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