Skip to content

fix(assistant): enforce message limit before streaming - #333

Merged
kl3inIT merged 2 commits into
mainfrom
fix/assistant-query-limit-alignment
Aug 7, 2026
Merged

fix(assistant): enforce message limit before streaming#333
kl3inIT merged 2 commits into
mainfrom
fix/assistant-query-limit-alignment

Conversation

@kl3inIT

@kl3inIT kl3inIT commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • align the Assistant request, OpenAPI contract, composer, and saved drafts at 1,000 characters
  • reject oversized questions through request validation before controller work opens an SSE stream or creates a conversation turn
  • show an accessible character counter and retain the 1,000/1,001 boundary in backend, unit, and browser regressions

Verification

  • ./gradlew :apps:api:check (Java 25 container + Testcontainers)
  • ./gradlew :apps:api:test --tests "*AssistantChatRequestValidationTests*"
  • pnpm --filter @orgmemory/web check:api
  • pnpm --filter @orgmemory/web test:unit (102/102)
  • pnpm --filter @orgmemory/web build (lint, typecheck, production build)
  • Assistant Playwright message-limit regression (Chromium)
  • Assistant Playwright pipeline: all 21 cases passed across final clean-server runs; one local performance-budget run measured 516.6 ms against 500 ms under host load, then the exact test passed in isolation
  • pnpm release:check
  • independent final staged review: pass; zero security concerns, logic errors, or suggestions

Operational notes

  • no database migration or configuration change
  • patch release entry included
  • production verification will use the normal main-based image and deploy pipeline

Summary by CodeRabbit

  • New Features
    • Assistant messages are now limited to 1,000 characters.
    • The composer displays a live character count and prevents additional input beyond the limit.
    • Overlong messages are blocked with an error notification before submission.
  • Bug Fixes
    • Existing saved drafts exceeding the limit are automatically truncated.
    • Requests over the limit are rejected without starting a response stream.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • apps/docs/generated/openapi.public.json is excluded by !**/generated/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6d10f536-0f62-4ae7-abaf-1937e231ffb6

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
📝 Walkthrough

Walkthrough

The Assistant message limit is reduced to 1,000 characters. API validation, web composer input, draft storage, accessibility behavior, and boundary tests now use this limit.

Changes

Assistant message limit

Layer / File(s) Summary
Server message validation
apps/api/src/main/java/com/orgmemory/api/assistant/AssistantChatRequest.java, apps/api/src/test/java/com/orgmemory/api/assistant/AssistantChatRequestValidationTests.java
API validation accepts messages up to 1,000 characters and rejects 1,001-character messages before service access.
Web composer and draft enforcement
apps/web/src/features/assistant/assistant-message-constraints.ts, apps/web/src/features/assistant/assistant-draft-storage.ts, apps/web/src/features/assistant/assistant-draft-storage.test.ts, apps/web/src/features/assistant/components/assistant-page.tsx, apps/web/test/e2e/assistant-pipeline.spec.ts, .tegami/2026-08-07-assistant-message-length.md
The web composer and draft storage use the shared 1,000-character limit. The composer truncates input, shows a character counter, blocks oversized submissions, and includes boundary coverage.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: enforcing the Assistant message limit before streaming begins.
Description check ✅ Passed The description explains the outcome, verification evidence, operational impact, and release notes; the required documentation section is not explicit but the content is mostly complete.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/assistant-query-limit-alignment

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.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Tegami

This repository uses Tegami to manage releases. When your changes affect published packages, add a changelog file under .tegami/ before merging.

Create a changelog → · Changelog format

Release preview

Package Bump Version
orgmemory minor 0.2.00.3.0

Changelogs in this PR

Changelog Title
2026-08-07-assistant-message-length.md Fixes

Run pnpm run tegami locally to create a changelog interactively.

Managed by Tegami.

@kl3inIT
kl3inIT merged commit e71975a into main Aug 7, 2026
18 checks passed
@kl3inIT
kl3inIT deleted the fix/assistant-query-limit-alignment branch August 7, 2026 09:09
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