Skip to content

feat(assistant): improve core chat interactions - #289

Merged
kl3inIT merged 7 commits into
mainfrom
feat/assistant-interaction-foundation
Aug 4, 2026
Merged

feat(assistant): improve core chat interactions#289
kl3inIT merged 7 commits into
mainfrom
feat/assistant-interaction-foundation

Conversation

@kl3inIT

@kl3inIT kl3inIT commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • make starter prompts server-owned and keep actor/conversation drafts in bounded session storage
  • share one server-owned answer UUID across streaming and transcript persistence
  • add actor-owned helpful/not-helpful feedback with opaque lookup, composite tenant integrity, replay, and cascade deletion
  • add fresh-turn retry plus focus and scroll recovery coverage using existing AI Elements primitives
  • record the pinned Onyx behavior study and independent architecture challenge

Verification

  • Narrow affected tests pass.
  • Completion-grade repository gates pass or are explicitly scoped out.

Evidence:

  • ./gradlew.bat --no-daemon clean test (108 tasks)
  • web lint, typecheck, 65 unit tests, production build, and generated-client drift
  • Assistant Playwright pipeline: 10/10
  • product OpenAPI contract generation from the live Spring context
  • docs check and production build: 120 API paths, 147 static pages

JetBrains inspection was unavailable; successful Java compile and the full Gradle suite are the documented project fallback. The local Node 23.11.1 runtime produced the repository's Node >=24 engine warning, but all web/docs gates completed.

Documentation impact

  • I updated the relevant English and Vietnamese pages under apps/docs, or this change has no reader-visible product/API/UI/deployment behavior.
  • I updated engineering specs/tests/runbooks when current system behavior or operations changed.

Generated public Assistant API reference, the Assistant domain spec/test matrix, roadmap, active design, challenge verdict, reference study, and verification evidence are updated.

Summary by CodeRabbit

  • New Features

    • Added conversation starter prompts to help begin chats quickly.
    • Added helpful and not-helpful feedback for assistant responses, including the ability to update or remove ratings.
    • Assistant responses now retain consistent message IDs across streaming and conversation history.
    • Added draft recovery per conversation, with automatic saving, clearing, and a 4,000-character limit.
    • Added retry actions that preserve the current draft.
  • Bug Fixes

    • Drafts are cleared when conversations are deleted or users log out.
    • Improved scrolling and focus recovery in assistant conversations.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kl3inIT, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0dd29140-7da5-4367-8d44-f3662144ec94

📥 Commits

Reviewing files that changed from the base of the PR and between f1d9fc0 and 55f14b1.

⛔ Files ignored due to path filters (9)
  • docs/increments/completed/2026-08-04-assistant-interaction-foundation/challenge-brief.md is excluded by !docs/**
  • docs/increments/completed/2026-08-04-assistant-interaction-foundation/challenge-verdict.md is excluded by !docs/**
  • docs/increments/completed/2026-08-04-assistant-interaction-foundation/design.md is excluded by !docs/**
  • docs/increments/completed/2026-08-04-assistant-interaction-foundation/plan.md is excluded by !docs/**
  • docs/increments/completed/2026-08-04-assistant-interaction-foundation/reference-study.md is excluded by !docs/**
  • docs/increments/completed/2026-08-04-assistant-interaction-foundation/verification.md is excluded by !docs/**
  • docs/roadmap.md is excluded by !docs/**
  • docs/specs/domains/assistant-and-mcp.md is excluded by !docs/**
  • docs/tests/domains/assistant-and-mcp.md is excluded by !docs/**
📒 Files selected for processing (5)
  • .tegami/2026-08-04-assistant-interaction-foundation.md
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantAnswerFeedbackConcurrencyIntegrationTests.java
  • apps/web/src/features/assistant/components/assistant-page.tsx
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessageRepository.java
📝 Walkthrough

Walkthrough

The PR adds assistant answer feedback, stable streamed message IDs, server-provided starter prompts, actor-scoped draft persistence, feedback actions, retry behavior, API documentation, database migration, and automated coverage.

Changes

Assistant feedback and message identity

Layer / File(s) Summary
Feedback contracts and database storage
core/src/main/java/com/orgmemory/core/assistant/*, core/src/main/resources/db/migration/V21__assistant_answer_feedback.sql, core/src/test/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackMigrationTests.java
Adds feedback sentiment and view contracts, a persisted feedback entity and repository, message identity constraints, and migration tests.
Conversation ownership and feedback service
core/src/main/java/com/orgmemory/core/assistant/AssistantConversation*.java, core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java
Persists caller-supplied assistant message IDs, includes feedback in history, and scopes feedback changes to owned assistant messages.
Assistant API and stable streaming IDs
apps/api/src/main/java/com/orgmemory/api/assistant/*, apps/api/src/test/java/com/orgmemory/api/assistant/*, apps/docs/content/docs/reference/api-reference/assistant.mdx
Adds starter and feedback endpoints. The chat path uses one server-generated message ID for persistence and stream encoding. API tests and documentation cover the new operations.
Web drafts, starters, and answer actions
apps/web/src/features/assistant/*, apps/web/src/features/session/logout.ts, apps/web/test/e2e/assistant-pipeline.spec.ts
Adds session-backed drafts, fetched starters, retry controls, feedback actions, draft cleanup, and end-to-end coverage for the assistant flow.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AssistantPage
  participant AssistantController
  participant AssistantConversationService
  participant AssistantAnswerFeedbackRepository
  AssistantPage->>AssistantController: submit chat request
  AssistantController->>AssistantConversationService: persist completed turn with messageId
  AssistantController-->>AssistantPage: stream start frame with messageId
  AssistantPage->>AssistantController: set or delete answer feedback
  AssistantController->>AssistantConversationService: validate actor and message ownership
  AssistantConversationService->>AssistantAnswerFeedbackRepository: save or delete feedback
  AssistantAnswerFeedbackRepository-->>AssistantController: feedback result
  AssistantController-->>AssistantPage: AssistantAnswerFeedbackView
Loading

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 identifies an assistant feature change and accurately summarizes the PR's improvements to chat interactions.
Description check ✅ Passed The description covers the required summary, verification evidence, and documentation impact, with specific tests and generated artifacts listed.
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 feat/assistant-interaction-foundation

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 4, 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-04-assistant-interaction-foundation.md Features

Run pnpm run tegami locally to create a changelog interactively.

Managed by Tegami.

@kl3inIT

kl3inIT commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java`:
- Around line 136-149: Serialize mutations in setAnswerFeedback and
deleteAnswerFeedback by locking the owned assistant-message row before reading
or modifying AssistantAnswerFeedback, using the repository’s existing
pessimistic-locking approach where available. Ensure concurrent set/set and
set/delete operations cannot race on the message_id feedback row or `@Version`
update, and add PostgreSQL integration tests covering both concurrency
scenarios.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1cbd1781-360c-48fe-9148-9269e5a0a3fc

📥 Commits

Reviewing files that changed from the base of the PR and between 97ef908 and f1d9fc0.

⛔ Files ignored due to path filters (11)
  • apps/docs/generated/openapi.public.json is excluded by !**/generated/**
  • contracts/openapi.json is excluded by !contracts/openapi.json
  • docs/increments/active/2026-08-04-assistant-interaction-foundation/challenge-brief.md is excluded by !docs/**
  • docs/increments/active/2026-08-04-assistant-interaction-foundation/challenge-verdict.md is excluded by !docs/**
  • docs/increments/active/2026-08-04-assistant-interaction-foundation/design.md is excluded by !docs/**
  • docs/increments/active/2026-08-04-assistant-interaction-foundation/plan.md is excluded by !docs/**
  • docs/increments/active/2026-08-04-assistant-interaction-foundation/reference-study.md is excluded by !docs/**
  • docs/increments/active/2026-08-04-assistant-interaction-foundation/verification.md is excluded by !docs/**
  • docs/roadmap.md is excluded by !docs/**
  • docs/specs/domains/assistant-and-mcp.md is excluded by !docs/**
  • docs/tests/domains/assistant-and-mcp.md is excluded by !docs/**
📒 Files selected for processing (23)
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/UiMessageStream.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/UiMessageStreamTests.java
  • apps/docs/content/docs/reference/api-reference/assistant.mdx
  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/web/src/features/assistant/assistant-draft-storage.ts
  • apps/web/src/features/assistant/components/assistant-conversation-list.tsx
  • apps/web/src/features/assistant/components/assistant-page.tsx
  • apps/web/src/features/assistant/hooks/use-assistant-draft.ts
  • apps/web/src/features/session/logout.ts
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedback.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackRepository.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackView.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerSentiment.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessage.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessageRepository.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessageView.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java
  • core/src/main/resources/db/migration/V21__assistant_answer_feedback.sql
  • core/src/test/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackMigrationTests.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: Web · Node 24
  • GitHub Check: PostgreSQL GraphRAG
  • GitHub Check: Backend · Java 25
  • GitHub Check: Public docs · Node 24
🧰 Additional context used
📓 Path-based instructions (10)
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Treat the repository and runtime evidence as the engineering system of record; do not treat chat or Northstar as authoritative.
Before changing a domain, read its specification, test-coverage document, and applicable decision filenames.
Material decisions about domain boundaries, authorization, persistence, publication, concurrency, cache isolation, parity scope, or deployment require an independent architecture challenge and documented alternatives before implementation.
Do not use completed increment documents as the source for current behavior; use them only for history or archaeology.
Before using unfamiliar Spring Boot, Spring Modulith, Spring AI, Gradle, React, Vite, Tailwind, TypeScript, Next.js, or Fumadocs APIs, consult current official documentation, Context7, and the relevant verification skill.
Read docs/guidelines/agent-safety.md before retrieval, AI, MCP, permission, upload, graph, or export work; never commit secrets or customer data.
Keep ddl-auto=validate and pair every persisted-model change with a Flyway migration.
Use the testing harness; a terminating clean test is the JVM context gate, and bootRun is not verification.

Files:

  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessageView.java
  • apps/web/src/features/session/logout.ts
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerSentiment.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackRepository.java
  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/api/src/main/java/com/orgmemory/api/assistant/UiMessageStream.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedback.java
  • apps/web/src/features/assistant/hooks/use-assistant-draft.ts
  • core/src/main/resources/db/migration/V21__assistant_answer_feedback.sql
  • apps/web/src/features/assistant/components/assistant-conversation-list.tsx
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessage.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackView.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessageRepository.java
  • apps/docs/content/docs/reference/api-reference/assistant.mdx
  • apps/web/src/features/assistant/assistant-draft-storage.ts
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/UiMessageStreamTests.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java
  • apps/web/src/features/assistant/components/assistant-page.tsx
  • core/src/test/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackMigrationTests.java
**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

Apply IDE inspection only to edited backend Java files.

Files:

  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessageView.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerSentiment.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackRepository.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/UiMessageStream.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedback.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessage.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackView.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessageRepository.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/UiMessageStreamTests.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackMigrationTests.java
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.{ts,tsx}: Extend the established OrgMemory product shell, design tokens, shadcn/Radix primitives, and existing layout patterns; do not introduce a separate visual system in the web application.
Generate ordinary REST clients from contracts/openapi.json using Hey API.
Use TanStack Query for server state, TanStack Router for navigation, and limit Zustand to durable or high-frequency UI state.
Preserve keyboard accessibility, light/dark theme support, loading and error states, and responsive behavior in the web application.

Files:

  • apps/web/src/features/session/logout.ts
  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/web/src/features/assistant/hooks/use-assistant-draft.ts
  • apps/web/src/features/assistant/components/assistant-conversation-list.tsx
  • apps/web/src/features/assistant/assistant-draft-storage.ts
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Frontend changes must pass lint, typecheck, tests, and a production build; perform browser verification when the flow warrants it.

Files:

  • apps/web/src/features/session/logout.ts
  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/web/src/features/assistant/hooks/use-assistant-draft.ts
  • apps/web/src/features/assistant/components/assistant-conversation-list.tsx
  • apps/web/src/features/assistant/assistant-draft-storage.ts
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
apps/web/src/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/web/src/**/*.{ts,tsx}: OAuth access and refresh tokens must never enter browser JavaScript or
browser storage. Use the HttpOnly BFF session, CSRF-protected mutations,
generated Hey API data clients, accessible states, and both light and
dark themes. Handwritten transport is reserved for documented protocol
flows such as navigation redirects and streaming.

Files:

  • apps/web/src/features/session/logout.ts
  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/web/src/features/assistant/hooks/use-assistant-draft.ts
  • apps/web/src/features/assistant/components/assistant-conversation-list.tsx
  • apps/web/src/features/assistant/assistant-draft-storage.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
apps/web/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

Preserve the existing browser test suite when changing the web application.

Files:

  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/web/test/e2e/assistant-pipeline.spec.ts
apps/api/src/main/java/**/*.java

⚙️ CodeRabbit configuration file

apps/api/src/main/java/**/*.java: Enforce the browser-BFF and resource-server boundaries. Authentication
must resolve an active internal actor through the explicit issuer and
subject binding. Reject identity, tenant, roles, or permissions supplied
by request payloads, JWT email, or untrusted JWT role claims.

Files:

  • apps/api/src/main/java/com/orgmemory/api/assistant/UiMessageStream.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
core/src/main/resources/db/migration/*.sql

⚙️ CodeRabbit configuration file

core/src/main/resources/db/migration/*.sql: The repository is pre-release: V1 is the intentionally resettable clean
baseline and development data carries no migration cost. Once a release
baseline is frozen, later Flyway migrations are immutable. Check tenant
isolation, foreign keys, uniqueness, indexes, append-only evidence
semantics, safe defaults, and PostgreSQL 18 plus pgvector compatibility.

Files:

  • core/src/main/resources/db/migration/V21__assistant_answer_feedback.sql
apps/docs/content/docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (apps/docs/CLAUDE.md)

apps/docs/content/docs/**/*.{md,mdx}: Public prose must live only in apps/docs/content/docs; internal engineering documents are source evidence, not publication input.
sourceRefs is build-time traceability metadata and must never be rendered in published content.
Draft pages must remain excluded unless DOCS_INCLUDE_DRAFTS=true is set for a local or controlled preview.

Files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
apps/docs/content/docs/**/*.mdx

📄 CodeRabbit inference engine (apps/docs/CLAUDE.md)

Use index.mdx for a section root and <slug>.mdx for a named English page; add Vietnamese pages individually as adjacent index.vi.mdx or <slug>.vi.mdx files, using the /vi/docs/... route.

Files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
🧠 Learnings (6)
📚 Learning: 2026-08-02T08:30:57.335Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 270
File: core/src/main/java/com/orgmemory/core/assetregistry/AssetDraftRepository.java:15-23
Timestamp: 2026-08-02T08:30:57.335Z
Learning: For OrgMemory JPA repository methods using `PESSIMISTIC_WRITE`, do not add a finite lock-timeout hint as part of a behavior-preserving refactor. The V1 PostgreSQL configuration uses `lock_timeout = 0`; any finite lock timeout must be established as a platform-wide database and transaction policy rather than configured on an individual method.

Applied to files:

  • core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackRepository.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessageRepository.java
📚 Learning: 2026-07-26T05:46:47.443Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 61
File: apps/mcp/src/main/java/com/orgmemory/mcp/McpSecurityConfiguration.java:50-52
Timestamp: 2026-07-26T05:46:47.443Z
Learning: In OrgMemory, treat the `apps/mcp` and `apps/api` as independent protocol adapter modules. When adjusting OAuth/wire-level scopes, do not introduce a shared Java constant or create a code dependency from `apps/mcp` to `apps/api` solely to deduplicate scope values. Instead, keep OAuth/scope constants adapter-local (e.g., in the relevant adapter/security configuration classes) and ensure cross-adapter consistency via automated realm/OAuth/authorization tests, rather than via shared wiring-level constants or cross-module references.

Applied to files:

  • apps/api/src/main/java/com/orgmemory/api/assistant/UiMessageStream.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
📚 Learning: 2026-07-23T23:30:44.585Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 30
File: core/src/main/resources/db/migration/V32__evidence_scoped_graph_semantics.sql:0-0
Timestamp: 2026-07-23T23:30:44.585Z
Learning: For OrgMemory PostgreSQL Flyway migrations under core/src/main/resources/db/migration, do not recommend using `CREATE INDEX CONCURRENTLY` or `DROP INDEX CONCURRENTLY` inside application-owned Flyway migration SQL. Flyway’s schema-history connection may hold a transaction that can cause concurrent index operations to wait indefinitely (e.g., on a `virtualxid`), and docs/conventions.md forbids this pattern. If you need large production-table index replacement, pre-stage online index operations via the deployment pipeline (outside Flyway) rather than inside the migration; “ordinary” index replacement is acceptable for unreleased projections before production traffic.

Applied to files:

  • core/src/main/resources/db/migration/V21__assistant_answer_feedback.sql
📚 Learning: 2026-07-28T20:06:14.930Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 112
File: apps/docs/content/docs/developers/api-reference/administration.mdx:11-11
Timestamp: 2026-07-28T20:06:14.930Z
Learning: In OrgMemory public documentation MDX files, ensure any `lastReviewed` dates are set using the repository project timezone `Asia/Bangkok`, not the reviewer’s local timezone or the runtime/build timezone. When generating or updating API-reference pages, intentionally use the exact same `lastReviewed` date convention as the authored public documentation pages to keep timestamps consistent across both sources.

Applied to files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
📚 Learning: 2026-07-28T20:06:15.064Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 112
File: apps/docs/content/docs/developers/api-reference/authentication.mdx:12-12
Timestamp: 2026-07-28T20:06:15.064Z
Learning: In OrgMemory docs/tests that describe date-based review checks, treat the project timezone as Asia/Bangkok for all “date” comparisons/validations. Do not assume UTC when interpreting or validating fields like `lastReviewed`. For example, `lastReviewed: '2026-07-29'` should be considered valid when the effective “current date” in Asia/Bangkok is July 29, 2026 (not merely when the UTC date matches).

Applied to files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
📚 Learning: 2026-07-30T06:46:08.031Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 144
File: apps/docs/public-content.manifest.json:13-67
Timestamp: 2026-07-30T06:46:08.031Z
Learning: For the Fumadocs docs portal under apps/docs, follow the expected MDX filename conventions that drive section-root vs named-page routing. Use `index.mdx` for English section-root pages and `<slug>.mdx` for named pages. For Vietnamese, use adjacent locale-suffixed files: `index.vi.mdx` for section roots and `<slug>.vi.mdx` for named pages. Do not require or enforce a `page.mdx` filename; doing so would change/break the intended section-root route structure.

Applied to files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
🪛 SQLFluff (4.2.2)
core/src/main/resources/db/migration/V21__assistant_answer_feedback.sql

[error] 23-26: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)

🪛 Squawk (2.61.0)
core/src/main/resources/db/migration/V21__assistant_answer_feedback.sql

[warning] 2-3: By default new constraints require a table scan and block writes to the table while that scan occurs. Use NOT VALID with a later VALIDATE CONSTRAINT call.

(constraint-missing-not-valid)


[warning] 2-3: Adding a UNIQUE constraint requires an ACCESS EXCLUSIVE lock which blocks reads and writes to the table while the index is built. Create an index CONCURRENTLY and create the constraint using the index.

(disallowed-unique-constraint)


[warning] 9-9: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)

🔇 Additional comments (24)
core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerSentiment.java (1)

3-6: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackView.java (1)

6-10: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedback.java (1)

14-67: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackRepository.java (1)

8-12: LGTM!

core/src/main/resources/db/migration/V21__assistant_answer_feedback.sql (1)

1-26: LGTM!

core/src/test/java/com/orgmemory/core/assistant/AssistantAnswerFeedbackMigrationTests.java (1)

18-132: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessage.java (1)

43-50: LGTM!

Also applies to: 61-66

core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessageView.java (1)

6-13: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantConversationMessageRepository.java (1)

5-5: LGTM!

Also applies to: 17-23

core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java (1)

4-5: LGTM!

Also applies to: 21-31, 52-52, 63-74, 113-129, 175-186

core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java (1)

13-13: LGTM!

Also applies to: 32-33, 47-47, 105-190, 210-218, 232-239, 258-259

apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java (1)

4-5: LGTM!

Also applies to: 16-16, 32-32, 46-58, 91-91, 106-109, 119-119, 129-166

apps/api/src/main/java/com/orgmemory/api/assistant/UiMessageStream.java (1)

20-25: LGTM!

Also applies to: 65-69

apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java (1)

5-26: LGTM!

Also applies to: 36-49, 51-89, 91-142

apps/api/src/test/java/com/orgmemory/api/assistant/UiMessageStreamTests.java (1)

7-7: LGTM!

Also applies to: 16-17, 34-34, 43-44, 59-63, 79-79, 99-99

apps/docs/content/docs/reference/api-reference/assistant.mdx (1)

18-23: LGTM!

Also applies to: 64-66, 77-80, 109-110, 127-127

apps/web/src/features/assistant/assistant-draft-storage.ts (1)

1-62: LGTM!

apps/web/src/features/assistant/assistant-draft-storage.test.ts (1)

1-40: LGTM!

apps/web/src/features/assistant/hooks/use-assistant-draft.ts (1)

1-36: LGTM!

apps/web/src/features/assistant/components/assistant-page.tsx (2)

2-13: LGTM!

Also applies to: 45-61, 221-227, 277-301, 326-337, 368-377, 389-400, 412-412, 480-483, 500-512, 561-594, 620-620


303-311: 🔒 Security & Privacy

Information Disclosure (CWE-200): Exposure of Sensitive Information to an Unauthorized Actor

Verify that an actor change clears local conversation state.

If actorKey changes without a full page reload, the early return preserves messages, feedbackByMessage, and sourcePanel when conversationId stays unchanged. Actor-scoped query keys do not clear this component-local state.

Track actorKey in the reset scope. Clear the previous actor's state before the new history request renders. Add a browser test that changes the actor while retaining the conversation URL.

Proposed reset change
+  const actorKeyRef = useRef(actorKey)
+
   useEffect(() => {
-    if (conversationIdRef.current === conversationId) return
+    const actorChanged = actorKeyRef.current !== actorKey
+    if (!actorChanged && conversationIdRef.current === conversationId) return
     stop()
+    actorKeyRef.current = actorKey
     conversationIdRef.current = conversationId
     locallyCreatedConversationRef.current = undefined
     setSourcePanel(null)
     setFeedbackByMessage({})
     setMessages([])
-  }, [conversationId, setMessages, stop])
+  }, [actorKey, conversationId, setMessages, stop])
#!/bin/bash
set -euo pipefail

# Verify whether actorKey can change while AssistantPage remains mounted.
rg -n -C 5 '\bactorKey\b|<AssistantPage\b' apps/web/src apps/web/test
apps/web/src/features/assistant/components/assistant-conversation-list.tsx (1)

33-33: LGTM!

Also applies to: 78-78

apps/web/src/features/session/logout.ts (1)

23-27: LGTM!

apps/web/test/e2e/assistant-pipeline.spec.ts (1)

6-16: LGTM!

Also applies to: 25-33, 88-151, 174-175, 317-414, 416-430, 464-464, 475-492

@kl3inIT

kl3inIT commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

Addressed the review hardening findings in cb05dfc: feedback set/set and set/delete mutations now serialize on the owned assistant-message row, and an in-place actor change synchronously hides then clears the prior transcript, feedback state, and source panel. Added PostgreSQL concurrency tests and a browser regression with the replacement actor history held pending. Focused backend tests, 65 web unit tests, production build, and the 11-scenario assistant Playwright pipeline all pass.

@kl3inIT
kl3inIT merged commit 657e770 into main Aug 4, 2026
18 checks passed
@kl3inIT
kl3inIT deleted the feat/assistant-interaction-foundation branch August 4, 2026 08:56
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