Skip to content

[AI-BUILDER-21] refactor: combine chat and readiness check#1444

Merged
kevinkim-ogp merged 5 commits intotrunk/aifrom
ai-builder/combine-chat-and-readiness
Mar 10, 2026
Merged

[AI-BUILDER-21] refactor: combine chat and readiness check#1444
kevinkim-ogp merged 5 commits intotrunk/aifrom
ai-builder/combine-chat-and-readiness

Conversation

@kevinkim-ogp
Copy link
Copy Markdown
Contributor

@kevinkim-ogp kevinkim-ogp commented Mar 4, 2026

TL;DR

Combined chat readiness check with the chat streaming API.

What changed?

  • Removed getChatReadiness GraphQL query and resolver
  • Added chatReadinessModel configuration to feature flags
  • Implemented chat readiness checking within the streaming chat API using createUIMessageStream
  • Added getChatReadiness function
  • Created stream utilities for piping web responses to Express
  • Updated frontend to extract readiness status from streaming data annotations instead of separate GraphQL calls
  • Added comprehensive test coverage for error handling scenarios

How to test?

  1. Start a chat conversation in the AI Builder
  2. Send a message and verify the response streams correctly
  • There should no longer be additional call to get the chat readiness, it now comes at the end of the chat stream.
  • Verify that 'Preview steps' button is shown when the chat is ready to generate steps.
  • Verify that readiness status resets to false when sending new messages.

Why make this change?

This prepares for the next PR where we automatically start previewing the steps without user clicking on the button.

Copy link
Copy Markdown
Contributor Author

kevinkim-ogp commented Mar 4, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kevinkim-ogp kevinkim-ogp marked this pull request as ready for review March 4, 2026 14:52
@kevinkim-ogp kevinkim-ogp requested a review from a team as a code owner March 4, 2026 14:52
Comment thread packages/backend/src/routes/api/chat/index.ts
@datadog-opengovsg

This comment has been minimized.

Comment thread packages/backend/src/routes/api/__tests__/chat.test.ts Outdated
@kevinkim-ogp kevinkim-ogp force-pushed the ai-builder/refactor-feature-flag branch from e933200 to d77b9f3 Compare March 6, 2026 07:11
@kevinkim-ogp kevinkim-ogp force-pushed the ai-builder/combine-chat-and-readiness branch from dac773f to c355b2b Compare March 6, 2026 07:11
Copy link
Copy Markdown
Contributor

@pregnantboy pregnantboy left a comment

Choose a reason for hiding this comment

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

lgtm and works

Copy link
Copy Markdown
Contributor Author

kevinkim-ogp commented Mar 10, 2026

Merge activity

  • Mar 10, 9:17 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 10, 9:27 AM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 10, 9:27 AM UTC: @kevinkim-ogp merged this pull request with Graphite.

@kevinkim-ogp kevinkim-ogp changed the base branch from ai-builder/refactor-feature-flag to graphite-base/1444 March 10, 2026 09:24
@kevinkim-ogp kevinkim-ogp changed the base branch from graphite-base/1444 to trunk/ai March 10, 2026 09:25
@kevinkim-ogp kevinkim-ogp force-pushed the ai-builder/combine-chat-and-readiness branch from f44f443 to d0a45d5 Compare March 10, 2026 09:26
@kevinkim-ogp kevinkim-ogp merged commit 4bde4ac into trunk/ai Mar 10, 2026
2 checks passed
@kevinkim-ogp kevinkim-ogp deleted the ai-builder/combine-chat-and-readiness branch March 10, 2026 09:27
kevinkim-ogp added a commit that referenced this pull request Mar 10, 2026
### TL;DR

Combined chat readiness check with the chat streaming API.

### What changed?

- Removed `getChatReadiness` GraphQL query and resolver
- Added `chatReadinessModel` configuration to feature flags
- Implemented chat readiness checking within the streaming chat API using `createUIMessageStream`
- Added `getChatReadiness` function
- Created stream utilities for piping web responses to Express
- Updated frontend to extract readiness status from streaming data annotations instead of separate GraphQL calls
- Added comprehensive test coverage for error handling scenarios

### How to test?

1. Start a chat conversation in the AI Builder
2. Send a message and verify the response streams correctly

- [x] There should no longer be additional call to get the chat readiness, it now comes at the end of the chat stream.
- [ ] Verify that 'Preview steps' button is shown when the chat is ready to generate steps.
- [ ] Verify that readiness status resets to false when sending new messages.

### Why make this change?

This prepares for the next PR where we automatically start previewing the steps without user clicking on the button.
kevinkim-ogp added a commit that referenced this pull request Mar 26, 2026
### TL;DR

Combined chat readiness check with the chat streaming API.

### What changed?

- Removed `getChatReadiness` GraphQL query and resolver
- Added `chatReadinessModel` configuration to feature flags
- Implemented chat readiness checking within the streaming chat API using `createUIMessageStream`
- Added `getChatReadiness` function
- Created stream utilities for piping web responses to Express
- Updated frontend to extract readiness status from streaming data annotations instead of separate GraphQL calls
- Added comprehensive test coverage for error handling scenarios

### How to test?

1. Start a chat conversation in the AI Builder
2. Send a message and verify the response streams correctly

- [x] There should no longer be additional call to get the chat readiness, it now comes at the end of the chat stream.
- [ ] Verify that 'Preview steps' button is shown when the chat is ready to generate steps.
- [ ] Verify that readiness status resets to false when sending new messages.

### Why make this change?

This prepares for the next PR where we automatically start previewing the steps without user clicking on the button.
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.

2 participants