Skip to content

feat(wiki-compose): add Japanese UI and localized LLM output#985

Merged
otomatty merged 3 commits into
developfrom
cursor/wiki-compose-japanese-d6ef
May 26, 2026
Merged

feat(wiki-compose): add Japanese UI and localized LLM output#985
otomatty merged 3 commits into
developfrom
cursor/wiki-compose-japanese-d6ef

Conversation

@otomatty

@otomatty otomatty commented May 26, 2026

Copy link
Copy Markdown
Owner

Summary

Wiki Compose now follows the app UI language (Japanese or English) end to end:

  • UI: All Compose split-screen labels, buttons, phase stepper, research review, and activity log strings use wikiCompose i18n keys (ja / en).
  • LLM output: The client sends contentLocale on the first graph run; the API also falls back to Accept-Language. Brief questions, research rationales, outline headings/intents, section drafts, and conflict-resolution copy are instructed to match that locale.

Changes

  • Added server/api/src/agents/core/composeLocale.ts and GraphContext.contentLocale
  • Updated compose session routes to resolve locale and strip contentLocale from LangGraph input
  • Appended locale instructions to orchestrator / research / draft system prompts
  • Expanded src/i18n/locales/{ja,en}/wikiCompose.json and wired components + useWikiComposeSession

Testing

  • bun test server/api/src/__tests__/agents/core/composeLocale.test.ts
  • bunx vitest run src/hooks/useWikiComposeSession.test.ts src/lib/wikiCompose/resolveComposeContentLocale.test.ts
Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features

    • Wiki Compose supports English and Japanese UIs and content with localized prompts, conflict rationale, and fallback outlines.
    • Locale is auto-detected from browser/request, threaded into compose runs, and persisted per session so subsequent runs use the resolved language.
  • Tests

    • Added tests for locale normalization, resolution precedence (input/header/session), persistence, and locale-aware compose outputs.

Review Change Stack

- Pass contentLocale from the client and resolve via Accept-Language on the API
- Append locale instructions to Brief, research, structure, and draft prompts
- Localize conflict-resolution copy and structure fallback outlines
- Wire wikiCompose i18n keys through the Compose split-screen UI

Co-authored-by: Akimasa Sugai <otomatty@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 46cd5bb8-5ca6-47d3-b7df-4354083e3413

📥 Commits

Reviewing files that changed from the base of the PR and between 3dfc533 and 7871c95.

📒 Files selected for processing (2)
  • server/api/src/routes/composeSessions.ts
  • src/lib/wikiCompose/resolveComposeContentLocale.ts

📝 Walkthrough

Walkthrough

Threads content locale (ja|en) end-to-end: adds backend locale utilities and GraphContext field, resolves/persists locale in compose session routes, appends locale instructions to LLM system prompts, localizes frontend components and activity labels, and adds English/Japanese resource files and tests.

Changes

Wiki Compose Localization (ja/en)

Layer / File(s) Summary
Backend locale type system and core utilities
server/api/src/agents/core/composeLocale.ts, server/api/src/agents/core/types/graphContext.ts, server/api/src/__tests__/agents/core/composeLocale.test.ts
Adds ComposeContentLocale type and helpers: normalize/resolve locales (including session metadata), strip contentLocale from graph input, produce locale-specific prompt instruction, conflict rationale, and fallback outline; GraphContext now includes contentLocale.
Graph context and normalization helper
server/api/src/agents/subgraphs/research/nodes/shared/getGraphContext.ts, server/api/src/agents/core/types/graphContext.ts
getGraphContext normalizes/derives contentLocale; GraphContext extended to carry contentLocale.
Route-level locale resolution and persistence
server/api/src/routes/composeSessions.ts, server/api/src/routes/ingest.ts
composeSessions resolves/persists session contentLocale, strips it from input, and injects it into runner context for GET/POST/PATCH flows; ingest routes derive contentLocale from Accept-Language for graph run/resume.
LLM node system prompt localization & fallbacks
server/api/src/agents/graphs/wikiCompose/nodes/briefDialogue.ts, draftSections.ts, structureDialogue.ts, conflictResolution.ts, server/api/src/agents/subgraphs/research/nodes/evaluateSufficiency.ts, planQueries.ts, refineQueries.ts
Multiple nodes append composeContentLocaleInstruction(ctx.contentLocale) to system prompts; conflictResolution uses composeConflictRationale() and structureDialogue uses structureDialogueFallbackOutline() on failure.
Frontend component internationalization
src/components/wikiCompose/*, src/pages/WikiComposePage.tsx
Replaces hardcoded strings with useTranslation() in ActivitySection, BriefQuestionCard, ConflictResolutionSection, DialogueSection, EditorPane, OutlineEditor, PhaseStepper, ResearchSection, and WikiComposePage; ARIA labels, buttons, placeholders, headings, and status text localized.
Client locale resolution & hook integration
src/lib/wikiCompose/resolveComposeContentLocale.ts, src/lib/wikiCompose/resolveComposeContentLocale.test.ts, src/hooks/useWikiComposeSession.ts, src/hooks/useWikiComposeSession.test.ts
Client resolveComposeContentLocale() maps i18n.language to "en" or "ja"; useWikiComposeSession injects contentLocale into run input via withContentLocale(); tests updated to expect contentLocale where applicable.
Translation resources
src/i18n/locales/en/wikiCompose.json, src/i18n/locales/ja/wikiCompose.json
Adds comprehensive English and Japanese i18n resources covering page controls, phase labels, brief/structure/draft/research/conflict copy, editor strings, and activity/run messaging.
Tests and test helpers updates
server/api/src/__tests__/*, src/lib/wikiCompose/*, src/hooks/*
Adds composeLocale unit tests, resolveComposeContentLocale tests, and updates multiple test fakeContext helpers to include contentLocale: "ja" and adjust expectations in useWikiComposeSession tests.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • otomatty/zedi#961: Touches briefDialogue prompt construction and chat-seed context; related to locale-aware prompt changes.
  • otomatty/zedi#970: Modifies conflictResolution interrupt logic; overlaps with this PR’s locale-aware rationale changes.

"🐰 I hopped through prompts and keys,
'ja' and 'en' in tidy heaps,
System prompts now speak each tongue,
Translations small, but changes sprung,
Wiki pages ready — hop, repeat!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 63.89% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly summarizes the main change: adding Japanese UI and localized LLM output to Wiki Compose, which is the primary focus across all modified files.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/wiki-compose-japanese-d6ef

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

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces internationalization (i18n) support for the Wiki Compose feature, enabling localized outputs in Japanese ("ja") and English ("en") based on the user's UI language or Accept-Language headers. It introduces utility functions to resolve, normalize, and strip the content locale, integrates locale-specific system prompt instructions and fallback outlines, and translates frontend components using react-i18next. The code review identified three issues: an oversimplified Accept-Language header parser that ignores secondary preferences, potential type coercion bugs in stripContentLocaleFromGraphInput when handling falsy values, and an inconsistent default fallback locale in getGraphContext (defaulting to "en" instead of "ja").

Comment on lines +31 to +35
if (acceptLanguage) {
const primary = acceptLanguage.split(",")[0]?.trim().toLowerCase() ?? "";
if (primary.startsWith("ja")) return "ja";
if (primary.startsWith("en")) return "en";
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The current Accept-Language resolution only checks the very first language tag in the header. If a user has an unsupported primary language but a supported secondary language (e.g., Accept-Language: zh-CN,en-US;q=0.9), the parser will fail to match zh-CN and fall back to the default (ja), ignoring their preference for en.\n\nWe can improve this by splitting the header and checking each language tag in order of preference until a supported language is found.

  if (acceptLanguage) {
    const locales = acceptLanguage
      .split(",")
      .map((part) => part.split(";")[0]?.trim().toLowerCase() ?? "");
    for (const locale of locales) {
      if (locale.startsWith("ja")) return "ja";
      if (locale.startsWith("en")) return "en";
    }
  }

Comment on lines +43 to +47
export function stripContentLocaleFromGraphInput(raw: unknown): unknown {
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw ?? {};
const { contentLocale: _removed, ...rest } = raw as Record<string, unknown>;
return rest;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The current implementation of stripContentLocaleFromGraphInput uses !raw and raw ?? {} which silently coerces falsy values like null or undefined into empty objects {}.\n\nTo make this utility function more robust and prevent unexpected type coercions, we should return the input as-is if it is not a non-null object or array.

Suggested change
export function stripContentLocaleFromGraphInput(raw: unknown): unknown {
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw ?? {};
const { contentLocale: _removed, ...rest } = raw as Record<string, unknown>;
return rest;
}
export function stripContentLocaleFromGraphInput(raw: unknown): unknown {
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
const { contentLocale: _removed, ...rest } = raw as Record<string, unknown>;
return rest;
}

Comment on lines +48 to +52
const contentLocale =
normalizeComposeContentLocale(ctx.contentLocale) ??
normalizeComposeContentLocale((ctx as { locale?: unknown }).locale) ??
"en";
return { ...(ctx as GraphContext), contentLocale };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

There is an inconsistency in the default fallback locale. In resolveComposeContentLocale and the route handlers, the fallback locale defaults to "ja". However, here in getGraphContext, it defaults to "en".\n\nTo ensure consistent behavior across the application when the locale cannot be resolved, we should use "ja" as the fallback here as well.

Suggested change
const contentLocale =
normalizeComposeContentLocale(ctx.contentLocale) ??
normalizeComposeContentLocale((ctx as { locale?: unknown }).locale) ??
"en";
return { ...(ctx as GraphContext), contentLocale };
const contentLocale =
normalizeComposeContentLocale(ctx.contentLocale) ??
normalizeComposeContentLocale((ctx as { locale?: unknown }).locale) ??
"ja";
return { ...(ctx as GraphContext), contentLocale };

@otomatty otomatty marked this pull request as ready for review May 26, 2026 02:57
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99f2d66691

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// Resume relies on the checkpointer to fetch the suspended thread; production
// routes load `PostgresSaver` here, tests/smoke runs get `false`.
const checkpointer = await resolveCheckpointerForRun();
const contentLocale = resolveComposeContentLocale(null, c.req.header("accept-language"), "ja");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Persist contentLocale across resume calls

PATCH /compose-sessions/:id/resume recomputes contentLocale only from Accept-Language, so the language chosen on the initial POST /run (which comes from the app UI locale) is not preserved across interrupts. In the common case where a user sets the app to English but the browser header is Japanese, the run starts in English and then switches to Japanese after the first resume, breaking the new “UI language end-to-end” behavior. Use a session-stable source (e.g., persisted session metadata/checkpoint value or explicit resume payload) instead of recalculating from headers here.

Useful? React with 👍 / 👎.

@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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/hooks/useWikiComposeSession.ts (1)

277-379: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Activity detail text is still partially hardcoded in English.

label is localized, but several detail values are still English literals (running, ok, chars, queries, sources, usage format), so Japanese UI can show mixed-language activity rows.

🌐 Suggested direction
- detail: event.input ? "running" : undefined,
+ detail: event.input ? i18n.t("wikiCompose.activity.detail.running") : undefined,

- detail: event.error ?? (event.outputLength ? `${event.outputLength} chars` : "ok"),
+ detail:
+   event.error ??
+   (event.outputLength
+     ? i18n.t("wikiCompose.activity.detail.outputChars", { count: event.outputLength })
+     : i18n.t("wikiCompose.activity.detail.ok")),

Also move other detail templates (queries, sources, usage line) to wikiCompose i18n keys in both ja and en locale files.

🤖 Prompt for 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.

In `@src/hooks/useWikiComposeSession.ts` around lines 277 - 379, The activity
"detail" fields in useWikiComposeSession.ts are hardcoded English strings (e.g.,
the "running"/"ok" text in case "tool_start"/"tool_end", "chars" in "tool_end",
the `${event.status} · ${event.queryCount} queries` in "research_iteration",
`${event.sourceCount} sources · ${event.exitReason}` in "research_batch", the
usage detail in "usage", and the compose_section count strings) — replace each
literal with calls to i18n.t using new wikiCompose keys (e.g.,
wikiCompose.activity.running, wikiCompose.activity.ok,
wikiCompose.activity.chars, wikiCompose.activity.queries,
wikiCompose.activity.sources, wikiCompose.activity.usageLine, etc.) so all
detail strings are localized; update the locale files (ja and en) with those
keys and formats (use placeholders for numbers/status where needed) and ensure
the code uses those placeholders (via i18n.t(..., { count: ..., status: ...,
sourceCount: ... })) when constructing detail values in the cases referenced
(cases "tool_start", "tool_end", "research_iteration", "research_batch",
"compose_section", "usage"); leave appendActivity and reduceInterrupt usage
unchanged.
🧹 Nitpick comments (10)
server/api/src/__tests__/agents/core/composeLocale.test.ts (1)

18-23: ⚡ Quick win

Add a regression case for mixed-language Accept-Language headers.

Please add a case like fr-CA, en-US;q=0.9 to ensure resolver picks the first supported locale in the list.

🤖 Prompt for 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.

In `@server/api/src/__tests__/agents/core/composeLocale.test.ts` around lines 18 -
23, Add a regression test to verify mixed-language Accept-Language headers pick
the first supported locale: in the test file add an expectation using
resolveComposeContentLocale (the same helper under test) with an empty input
object and the header string "fr-CA, en-US;q=0.9" and assert the result is "fr"
so the resolver chooses the first supported locale in the list.
src/components/wikiCompose/ActivitySection.tsx (1)

37-37: ⚡ Quick win

Add TSDoc comment for the exported component.

The ActivitySection component is exported but lacks a TSDoc comment immediately before its declaration. As per coding guidelines, all exported functions, types, and interfaces require TSDoc/JSDoc comments.

📝 Proposed addition
+/**
+ * Activity timeline component showing agent operations in chronological order.
+ * エージェントの操作を時系列で表示するアクティビティタイムライン。
+ */
 export const ActivitySection: React.FC<ActivitySectionProps> = ({ activity, isStreaming }) => {

As per coding guidelines: "Include TSDoc/JSDoc comments for all exported functions, types, and interfaces".

🤖 Prompt for 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.

In `@src/components/wikiCompose/ActivitySection.tsx` at line 37, Add a TSDoc
comment immediately above the exported ActivitySection declaration describing
the component, its props and their types; reference ActivitySection and
ActivitySectionProps and document the activity and isStreaming props (what they
represent and expected types/behavior), include a short example or usage note if
helpful, and ensure the comment is formatted as a /** ... */ TSDoc block placed
directly before the line "export const ActivitySection:
React.FC<ActivitySectionProps> = ({ activity, isStreaming }) => {".
src/components/wikiCompose/DialogueSection.tsx (1)

59-59: ⚡ Quick win

Add TSDoc comment for the exported component.

The DialogueSection component is exported but lacks a TSDoc comment immediately before its declaration. As per coding guidelines, all exported functions, types, and interfaces require TSDoc/JSDoc comments.

📝 Proposed addition
+/**
+ * Container for Brief/Structure/Draft dialogue UIs based on current phase.
+ * フェーズに応じてBrief/Structure/Draftの対話UIを出し分けるコンテナ。
+ */
 export const DialogueSection: React.FC<DialogueSectionProps> = ({

As per coding guidelines: "Include TSDoc/JSDoc comments for all exported functions, types, and interfaces".

🤖 Prompt for 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.

In `@src/components/wikiCompose/DialogueSection.tsx` at line 59, Add a TSDoc
comment immediately above the exported React component declaration for
DialogueSection that documents the component purpose and its props
(DialogueSectionProps); include a short description, `@param` for the props object
(or individual props if preferred), and an `@returns` tag describing the
JSX.Element. Place the comment directly above the line "export const
DialogueSection: React.FC<DialogueSectionProps> = ({", so it documents the
exported DialogueSection and its props type DialogueSectionProps.
src/components/wikiCompose/ResearchSection.tsx (1)

36-36: ⚡ Quick win

Add TSDoc comment for the exported component.

The ResearchSection component is exported but lacks a TSDoc comment immediately before its declaration. As per coding guidelines, all exported functions, types, and interfaces require TSDoc/JSDoc comments.

📝 Proposed addition
+/**
+ * Research source review panel for approving/rejecting sources.
+ * ソースの採用・却下を行う調査レビューパネル。
+ */
 export const ResearchSection: React.FC<ResearchSectionProps> = ({

As per coding guidelines: "Include TSDoc/JSDoc comments for all exported functions, types, and interfaces".

🤖 Prompt for 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.

In `@src/components/wikiCompose/ResearchSection.tsx` at line 36, Add a TSDoc
comment immediately above the exported ResearchSection declaration describing
the component, its props (ResearchSectionProps) and the return value; place the
comment directly before "export const ResearchSection:
React.FC<ResearchSectionProps> = ({". The TSDoc should include a short one-line
summary, an `@param` block for the props (or individual prop tags if preferred)
and an `@returns` tag indicating it returns a React element. Ensure the comment
follows TSDoc/JSDoc format (/** ... */).
src/components/wikiCompose/OutlineEditor.tsx (1)

32-32: ⚡ Quick win

Add TSDoc comment for the exported component.

The OutlineEditor component is exported but lacks a TSDoc comment immediately before its declaration. As per coding guidelines, all exported functions, types, and interfaces require TSDoc/JSDoc comments.

📝 Proposed addition
+/**
+ * Editable outline list for the Structure phase with reordering and depth controls.
+ * Structure フェーズ用の編集可能なアウトラインリスト(並び替え・深度制御付き)。
+ */
 export const OutlineEditor: React.FC<OutlineEditorProps> = ({

As per coding guidelines: "Include TSDoc/JSDoc comments for all exported functions, types, and interfaces".

🤖 Prompt for 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.

In `@src/components/wikiCompose/OutlineEditor.tsx` at line 32, Add a TSDoc comment
immediately above the exported component declaration for OutlineEditor
describing its purpose and props; document the component name (OutlineEditor)
and its props type (OutlineEditorProps), include a short summary line and `@param`
for the props (or `@remarks` if needed) and `@returns` description, and ensure the
comment is placed directly above "export const OutlineEditor:
React.FC<OutlineEditorProps> = ({".
src/components/wikiCompose/BriefQuestionCard.tsx (1)

31-31: ⚡ Quick win

Add TSDoc comment for the exported component.

The BriefQuestionCard component is exported but lacks a TSDoc comment immediately before its declaration. As per coding guidelines, all exported functions, types, and interfaces require TSDoc/JSDoc comments.

📝 Proposed addition
+/**
+ * Brief question card with optional answer chips and free-text input.
+ * チップ式選択肢とフリーテキスト入力を持つBrief質問カード。
+ */
 export const BriefQuestionCard: React.FC<BriefQuestionCardProps> = ({

As per coding guidelines: "Include TSDoc/JSDoc comments for all exported functions, types, and interfaces".

🤖 Prompt for 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.

In `@src/components/wikiCompose/BriefQuestionCard.tsx` at line 31, Add a TSDoc
comment immediately above the exported component declaration for
BriefQuestionCard describing what the component renders and its purpose,
document the BriefQuestionCardProps prop with `@param` along with any important
prop fields (e.g., callbacks or required values), and include an `@returns`
describing the JSX element; place the comment directly before the line "export
const BriefQuestionCard: React.FC<BriefQuestionCardProps> = ({".
src/components/wikiCompose/EditorPane.tsx (1)

29-29: ⚡ Quick win

Add TSDoc comment for the exported component.

The EditorPane component is exported but lacks a TSDoc comment immediately before its declaration. As per coding guidelines, all exported functions, types, and interfaces require TSDoc/JSDoc comments.

📝 Proposed addition
+/**
+ * Left pane editor showing streaming draft content and completed markdown.
+ * ストリーミング中のドラフト内容と完成版Markdownを表示する左ペインエディタ。
+ */
 export const EditorPane: React.FC<EditorPaneProps> = ({

As per coding guidelines: "Include TSDoc/JSDoc comments for all exported functions, types, and interfaces".

🤖 Prompt for 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.

In `@src/components/wikiCompose/EditorPane.tsx` at line 29, Add a TSDoc comment
immediately above the exported declaration "export const EditorPane:
React.FC<EditorPaneProps> = ({..." that summarizes the component's purpose,
documents the props via `@param` for "EditorPaneProps" (or list key props if they
are individual props), and includes an `@returns` tag describing the rendered JSX
(e.g., React element). Ensure the comment sits directly before the EditorPane
declaration and follows TSDoc format so tooling and lint rules recognize it.
src/components/wikiCompose/PhaseStepper.tsx (1)

26-26: ⚡ Quick win

Add TSDoc comment for the exported component.

The PhaseStepper component is exported but lacks a TSDoc comment immediately before its declaration. As per coding guidelines, all exported functions, types, and interfaces require TSDoc/JSDoc comments.

📝 Proposed addition
+/**
+ * Progress indicator showing the five Wiki Compose phases.
+ * Wiki Composeの5段階フェーズを表示する進捗インジケーター。
+ */
 export const PhaseStepper: React.FC<PhaseStepperProps> = ({ phase }) => {

As per coding guidelines: "Include TSDoc/JSDoc comments for all exported functions, types, and interfaces".

🤖 Prompt for 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.

In `@src/components/wikiCompose/PhaseStepper.tsx` at line 26, Add a TSDoc comment
immediately above the exported React component declaration for PhaseStepper
describing its purpose and parameters; include a one-line summary, a `@param` tag
for the phase prop referencing PhaseStepperProps (or describe the phase field)
and a `@returns` tag noting it renders the stepper UI. Place the comment directly
above "export const PhaseStepper: React.FC<PhaseStepperProps> = ({ phase }) =>
{" so it documents the exported symbol PhaseStepper and its props.
src/pages/WikiComposePage.tsx (1)

153-157: ⚡ Quick win

Remove misleading as const assertion.

The as const assertion on line 154 doesn't provide type narrowing since session.phase is a runtime value. TypeScript cannot create a template literal type from non-literal interpolations, so this assertion is ineffective and may create false confidence.

♻️ Simplified version without the assertion
 const phaseLabel = (() => {
-  const key = `wikiCompose.phaseDisplay.${session.phase}` as const;
+  const key = `wikiCompose.phaseDisplay.${session.phase}`;
   const translated = t(key);
   return translated === key ? session.phase : translated;
 })();
🤖 Prompt for 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.

In `@src/pages/WikiComposePage.tsx` around lines 153 - 157, The `as const`
assertion on the template key is misleading because `session.phase` is a runtime
value; remove the `as const` so the `key` is a plain string (e.g., change the
`key` declaration in the `phaseLabel` IIFE to a string without `as const`), keep
using `t(key)` and the fallback check `translated === key ? session.phase :
translated` to preserve behavior; locate the `phaseLabel` block and update the
`key` variable (and any related type annotations) accordingly.
src/hooks/useWikiComposeSession.test.ts (1)

30-32: ⚡ Quick win

Make the locale resolver mock configurable per test.

Hardcoding "ja" here means this integration suite never verifies the "en" payload path in runSession input.

🧪 Proposed test refactor
 const mocks = vi.hoisted(() => ({
   createSession: vi.fn(),
   getSession: vi.fn(),
   runSession: vi.fn(),
   resumeSession: vi.fn(),
   cancelSession: vi.fn(),
+  resolveComposeContentLocale: vi.fn(() => "ja" as const),
 }));
 
 vi.mock("`@/lib/wikiCompose/resolveComposeContentLocale`", () => ({
-  resolveComposeContentLocale: () => "ja" as const,
+  resolveComposeContentLocale: mocks.resolveComposeContentLocale,
 }));

Then add one test that sets mocks.resolveComposeContentLocale.mockReturnValue("en") and asserts body.contentLocale === "en".

As per coding guidelines **/*.{test,spec}.{ts,tsx,js,jsx}: Tests serve as a source of truth for specifications alongside implementation code TSDoc/JSDoc.

🤖 Prompt for 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.

In `@src/hooks/useWikiComposeSession.test.ts` around lines 30 - 32, Replace the
hardcoded module mock so tests can override the locale: change the mock of
"`@/lib/wikiCompose/resolveComposeContentLocale`" to export
resolveComposeContentLocale as a vi.fn(() => "ja") (i.e. vi.mock(..., () => ({
resolveComposeContentLocale: vi.fn(() => "ja") }))), then in individual tests
call mocks.resolveComposeContentLocale.mockReturnValue("en") (or "ja") before
invoking runSession and assert body.contentLocale === "en" in the new test;
reference the mocked symbol resolveComposeContentLocale and the runSession
assertion to locate where to adjust the tests.
🤖 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 `@server/api/src/agents/core/composeLocale.ts`:
- Line 86: The JSDoc comment "Default outline rows when structure LLM fails
(locale-specific headings)." is English-only; update the JSDoc in
composeLocale.ts by adding the Japanese equivalent alongside the English text
(e.g., add a Japanese sentence like 「構造LLMが失敗した場合のデフォルトのアウトライン行(ロケール別見出し)。」) so
the comment above the related constant/function (the JSDoc that describes
default outline rows) contains both Japanese and English versions to match
project guidelines.
- Around line 31-35: The current logic in composeLocale uses only the first
token (acceptLanguage -> primary) so headers like "fr-CA, en-US;q=0.9" get
ignored; update the code that handles acceptLanguage to parse the full
comma-separated list, parse each language-range's optional q value, sort or
select by descending q (default q=1 when missing), then iterate the ordered
ranges and return "ja" if any range startsWith("ja") or "en" if any
startsWith("en"); use the existing acceptLanguage variable and replace the
primary-check block with this full-list parsing logic and fallbacks.

In `@server/api/src/routes/composeSessions.ts`:
- Line 122: The JSDoc for the function that builds a GraphContext (the comment
starting "/** Build {`@link` GraphContext} for a compose session run / projection.
*/") is only in English; add a Japanese counterpart immediately below or above
the English sentence so both languages appear in the same JSDoc block (e.g.,
"Compose セッションの実行/プロジェクションのための {`@link` GraphContext} を構築します。"), keeping the
existing {`@link` GraphContext} reference and any param/return tags intact and
mirrored in Japanese as needed to follow repo bilingual doc convention.

In `@src/hooks/useWikiComposeSession.ts`:
- Around line 229-235: The new helper comments for withContentLocale and
phaseDisplayLabel are only in English; update the documentation comments to
include both Japanese and English per the repo guideline. Edit the JSDoc/comment
above withContentLocale and phaseDisplayLabel (and any mention of
resolveComposeContentLocale if referenced) to add concise Japanese translations
alongside the existing English text so each helper has bilingual comments.

In `@src/lib/wikiCompose/resolveComposeContentLocale.ts`:
- Around line 7-10: Add bilingual (Japanese and English) TSDoc comments for the
exported ComposeContentLocale type and the resolveComposeContentLocale function:
for ComposeContentLocale, document the purpose and allowed literal values ("ja"
| "en") in both languages; for resolveComposeContentLocale, add a bilingual
description, include `@returns` describing that it returns "ja" or "en" derived
from the active i18next language, and any remarks about fallback behavior if
applicable; attach these comments directly above the exported type and function
declarations so they satisfy the repository’s documentation guidelines.

In `@src/pages/WikiComposePage.tsx`:
- Line 43: Convert the existing inline bilingual comments for the exported React
component into JSDoc/TSDoc style by adding a /** ... */ comment block
immediately above the WikiComposePage declaration; document the component
purpose, any props (none in this case) and its return value, and include
`@component` and `@returns` tags (or equivalent) so the exported symbol
WikiComposePage has a proper JSDoc header that satisfies the coding guidelines
and linter rules.

---

Outside diff comments:
In `@src/hooks/useWikiComposeSession.ts`:
- Around line 277-379: The activity "detail" fields in useWikiComposeSession.ts
are hardcoded English strings (e.g., the "running"/"ok" text in case
"tool_start"/"tool_end", "chars" in "tool_end", the `${event.status} ·
${event.queryCount} queries` in "research_iteration", `${event.sourceCount}
sources · ${event.exitReason}` in "research_batch", the usage detail in "usage",
and the compose_section count strings) — replace each literal with calls to
i18n.t using new wikiCompose keys (e.g., wikiCompose.activity.running,
wikiCompose.activity.ok, wikiCompose.activity.chars,
wikiCompose.activity.queries, wikiCompose.activity.sources,
wikiCompose.activity.usageLine, etc.) so all detail strings are localized;
update the locale files (ja and en) with those keys and formats (use
placeholders for numbers/status where needed) and ensure the code uses those
placeholders (via i18n.t(..., { count: ..., status: ..., sourceCount: ... }))
when constructing detail values in the cases referenced (cases "tool_start",
"tool_end", "research_iteration", "research_batch", "compose_section", "usage");
leave appendActivity and reduceInterrupt usage unchanged.

---

Nitpick comments:
In `@server/api/src/__tests__/agents/core/composeLocale.test.ts`:
- Around line 18-23: Add a regression test to verify mixed-language
Accept-Language headers pick the first supported locale: in the test file add an
expectation using resolveComposeContentLocale (the same helper under test) with
an empty input object and the header string "fr-CA, en-US;q=0.9" and assert the
result is "fr" so the resolver chooses the first supported locale in the list.

In `@src/components/wikiCompose/ActivitySection.tsx`:
- Line 37: Add a TSDoc comment immediately above the exported ActivitySection
declaration describing the component, its props and their types; reference
ActivitySection and ActivitySectionProps and document the activity and
isStreaming props (what they represent and expected types/behavior), include a
short example or usage note if helpful, and ensure the comment is formatted as a
/** ... */ TSDoc block placed directly before the line "export const
ActivitySection: React.FC<ActivitySectionProps> = ({ activity, isStreaming }) =>
{".

In `@src/components/wikiCompose/BriefQuestionCard.tsx`:
- Line 31: Add a TSDoc comment immediately above the exported component
declaration for BriefQuestionCard describing what the component renders and its
purpose, document the BriefQuestionCardProps prop with `@param` along with any
important prop fields (e.g., callbacks or required values), and include an
`@returns` describing the JSX element; place the comment directly before the line
"export const BriefQuestionCard: React.FC<BriefQuestionCardProps> = ({".

In `@src/components/wikiCompose/DialogueSection.tsx`:
- Line 59: Add a TSDoc comment immediately above the exported React component
declaration for DialogueSection that documents the component purpose and its
props (DialogueSectionProps); include a short description, `@param` for the props
object (or individual props if preferred), and an `@returns` tag describing the
JSX.Element. Place the comment directly above the line "export const
DialogueSection: React.FC<DialogueSectionProps> = ({", so it documents the
exported DialogueSection and its props type DialogueSectionProps.

In `@src/components/wikiCompose/EditorPane.tsx`:
- Line 29: Add a TSDoc comment immediately above the exported declaration
"export const EditorPane: React.FC<EditorPaneProps> = ({..." that summarizes the
component's purpose, documents the props via `@param` for "EditorPaneProps" (or
list key props if they are individual props), and includes an `@returns` tag
describing the rendered JSX (e.g., React element). Ensure the comment sits
directly before the EditorPane declaration and follows TSDoc format so tooling
and lint rules recognize it.

In `@src/components/wikiCompose/OutlineEditor.tsx`:
- Line 32: Add a TSDoc comment immediately above the exported component
declaration for OutlineEditor describing its purpose and props; document the
component name (OutlineEditor) and its props type (OutlineEditorProps), include
a short summary line and `@param` for the props (or `@remarks` if needed) and
`@returns` description, and ensure the comment is placed directly above "export
const OutlineEditor: React.FC<OutlineEditorProps> = ({".

In `@src/components/wikiCompose/PhaseStepper.tsx`:
- Line 26: Add a TSDoc comment immediately above the exported React component
declaration for PhaseStepper describing its purpose and parameters; include a
one-line summary, a `@param` tag for the phase prop referencing PhaseStepperProps
(or describe the phase field) and a `@returns` tag noting it renders the stepper
UI. Place the comment directly above "export const PhaseStepper:
React.FC<PhaseStepperProps> = ({ phase }) => {" so it documents the exported
symbol PhaseStepper and its props.

In `@src/components/wikiCompose/ResearchSection.tsx`:
- Line 36: Add a TSDoc comment immediately above the exported ResearchSection
declaration describing the component, its props (ResearchSectionProps) and the
return value; place the comment directly before "export const ResearchSection:
React.FC<ResearchSectionProps> = ({". The TSDoc should include a short one-line
summary, an `@param` block for the props (or individual prop tags if preferred)
and an `@returns` tag indicating it returns a React element. Ensure the comment
follows TSDoc/JSDoc format (/** ... */).

In `@src/hooks/useWikiComposeSession.test.ts`:
- Around line 30-32: Replace the hardcoded module mock so tests can override the
locale: change the mock of "`@/lib/wikiCompose/resolveComposeContentLocale`" to
export resolveComposeContentLocale as a vi.fn(() => "ja") (i.e. vi.mock(..., ()
=> ({ resolveComposeContentLocale: vi.fn(() => "ja") }))), then in individual
tests call mocks.resolveComposeContentLocale.mockReturnValue("en") (or "ja")
before invoking runSession and assert body.contentLocale === "en" in the new
test; reference the mocked symbol resolveComposeContentLocale and the runSession
assertion to locate where to adjust the tests.

In `@src/pages/WikiComposePage.tsx`:
- Around line 153-157: The `as const` assertion on the template key is
misleading because `session.phase` is a runtime value; remove the `as const` so
the `key` is a plain string (e.g., change the `key` declaration in the
`phaseLabel` IIFE to a string without `as const`), keep using `t(key)` and the
fallback check `translated === key ? session.phase : translated` to preserve
behavior; locate the `phaseLabel` block and update the `key` variable (and any
related type annotations) accordingly.
🪄 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: CHILL

Plan: Pro

Run ID: 02652e6a-9acd-4528-aab7-512f0925aa52

📥 Commits

Reviewing files that changed from the base of the PR and between d6aefab and 99f2d66.

📒 Files selected for processing (27)
  • server/api/src/__tests__/agents/core/composeLocale.test.ts
  • server/api/src/agents/core/composeLocale.ts
  • server/api/src/agents/core/types/graphContext.ts
  • server/api/src/agents/graphs/wikiCompose/nodes/briefDialogue.ts
  • server/api/src/agents/graphs/wikiCompose/nodes/conflictResolution.ts
  • server/api/src/agents/graphs/wikiCompose/nodes/draftSections.ts
  • server/api/src/agents/graphs/wikiCompose/nodes/structureDialogue.ts
  • server/api/src/agents/subgraphs/research/nodes/evaluateSufficiency.ts
  • server/api/src/agents/subgraphs/research/nodes/planQueries.ts
  • server/api/src/agents/subgraphs/research/nodes/refineQueries.ts
  • server/api/src/agents/subgraphs/research/nodes/shared/getGraphContext.ts
  • server/api/src/routes/composeSessions.ts
  • src/components/wikiCompose/ActivitySection.tsx
  • src/components/wikiCompose/BriefQuestionCard.tsx
  • src/components/wikiCompose/ConflictResolutionSection.tsx
  • src/components/wikiCompose/DialogueSection.tsx
  • src/components/wikiCompose/EditorPane.tsx
  • src/components/wikiCompose/OutlineEditor.tsx
  • src/components/wikiCompose/PhaseStepper.tsx
  • src/components/wikiCompose/ResearchSection.tsx
  • src/hooks/useWikiComposeSession.test.ts
  • src/hooks/useWikiComposeSession.ts
  • src/i18n/locales/en/wikiCompose.json
  • src/i18n/locales/ja/wikiCompose.json
  • src/lib/wikiCompose/resolveComposeContentLocale.test.ts
  • src/lib/wikiCompose/resolveComposeContentLocale.ts
  • src/pages/WikiComposePage.tsx

Comment thread server/api/src/agents/core/composeLocale.ts Outdated
Comment thread server/api/src/agents/core/composeLocale.ts
return undefined;
}

/** Build {@link GraphContext} for a compose session run / projection. */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Make this new function doc bilingual (EN + JA).

This added JSDoc currently has only English; please add the Japanese counterpart to keep docs consistent with repo conventions.

As per coding guidelines: “Include both Japanese and English comments/documentation in code and documentation files to maintain project tone consistency”.

🤖 Prompt for 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.

In `@server/api/src/routes/composeSessions.ts` at line 122, The JSDoc for the
function that builds a GraphContext (the comment starting "/** Build {`@link`
GraphContext} for a compose session run / projection. */") is only in English;
add a Japanese counterpart immediately below or above the English sentence so
both languages appear in the same JSDoc block (e.g., "Compose
セッションの実行/プロジェクションのための {`@link` GraphContext} を構築します。"), keeping the existing
{`@link` GraphContext} reference and any param/return tags intact and mirrored in
Japanese as needed to follow repo bilingual doc convention.

Comment on lines +229 to +235
/** Merge graph run input with the active UI content locale. */
function withContentLocale(input?: Record<string, unknown>): Record<string, unknown> {
return { ...(input ?? {}), contentLocale: resolveComposeContentLocale() };
}

/** Human-readable phase label for activity log entries. */
function phaseDisplayLabel(phase: string): string {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep newly added helper comments bilingual.

The newly added helper docs are English-only; this diverges from the project’s bilingual documentation rule.

✍️ Proposed fix
-/** Merge graph run input with the active UI content locale. */
+/**
+ * Merge graph run input with the active UI content locale.
+ * graph 実行入力に現在の UI コンテンツロケールをマージする。
+ */
 function withContentLocale(input?: Record<string, unknown>): Record<string, unknown> {
   return { ...(input ?? {}), contentLocale: resolveComposeContentLocale() };
 }
 
-/** Human-readable phase label for activity log entries. */
+/**
+ * Human-readable phase label for activity log entries.
+ * アクティビティログ用の可読フェーズラベルを返す。
+ */
 function phaseDisplayLabel(phase: string): string {

As per coding guidelines **/*.{ts,tsx,js,jsx,md}: Include both Japanese and English comments/documentation in code and documentation files.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/** Merge graph run input with the active UI content locale. */
function withContentLocale(input?: Record<string, unknown>): Record<string, unknown> {
return { ...(input ?? {}), contentLocale: resolveComposeContentLocale() };
}
/** Human-readable phase label for activity log entries. */
function phaseDisplayLabel(phase: string): string {
/**
* Merge graph run input with the active UI content locale.
* graph 実行入力に現在の UI コンテンツロケールをマージする。
*/
function withContentLocale(input?: Record<string, unknown>): Record<string, unknown> {
return { ...(input ?? {}), contentLocale: resolveComposeContentLocale() };
}
/**
* Human-readable phase label for activity log entries.
* アクティビティログ用の可読フェーズラベルを返す。
*/
function phaseDisplayLabel(phase: string): string {
🤖 Prompt for 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.

In `@src/hooks/useWikiComposeSession.ts` around lines 229 - 235, The new helper
comments for withContentLocale and phaseDisplayLabel are only in English; update
the documentation comments to include both Japanese and English per the repo
guideline. Edit the JSDoc/comment above withContentLocale and phaseDisplayLabel
(and any mention of resolveComposeContentLocale if referenced) to add concise
Japanese translations alongside the existing English text so each helper has
bilingual comments.

Comment thread src/lib/wikiCompose/resolveComposeContentLocale.ts
@@ -40,6 +41,7 @@ function indexById(items: DraftedSection[]): Record<string, DraftedSection> {

/** Root page for `/notes/:noteId/:pageId/compose[/:sessionId]`. */
const WikiComposePage: React.FC = () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Convert component documentation to JSDoc format.

The component has excellent bilingual inline comments but they should be in JSDoc format to comply with the coding guidelines. As per coding guidelines, all exported functions, types, and interfaces must include TSDoc/JSDoc comments.

📝 Convert to JSDoc format
-/**
- * `WikiComposePage` — Wiki Compose split-screen UI (`#950`).
- *
- * `/notes/:noteId/:pageId/compose` (および `compose/:sessionId`) のルート要素。
- * 左ペイン = `EditorPane` (タイトル + 進捗中の本文プレビュー)、右ペイン =
- * `ComposePanel` (PhaseStepper + Dialogue + Research + Activity)。
- * モバイルでは縦分割、デスクトップでは横分割で表示する。Compose 完了 / 中断
- * 時はノートページに戻れる。
- *
- * Compose UI shell. The page reads the `useWikiComposeSession` hook for state
- * and routes user submissions back through the hook's mutator methods.
- */
+/**
+ * Wiki Compose split-screen UI.
+ * Wiki Compose の分割画面 UI。
+ *
+ * Root component for `/notes/:noteId/:pageId/compose` (and `compose/:sessionId`) routes.
+ * `/notes/:noteId/:pageId/compose` (および `compose/:sessionId`) のルート要素。
+ *
+ * Layout:
+ * - Left pane: `EditorPane` (title + live draft preview)
+ * - Right pane: `ComposePanel` (PhaseStepper + Dialogue + Research + Activity)
+ * - Mobile: vertical split; Desktop: horizontal split
+ *
+ * レイアウト:
+ * - 左ペイン: `EditorPane` (タイトル + 進捗中の本文プレビュー)
+ * - 右ペイン: `ComposePanel` (PhaseStepper + Dialogue + Research + Activity)
+ * - モバイル: 縦分割、デスクトップ: 横分割
+ *
+ * State management via `useWikiComposeSession` hook; user submissions route through hook mutators.
+ * Compose 完了 / 中断時はノートページに戻る。
+ *
+ * `@returns` The Wiki Compose page component
+ */
 const WikiComposePage: React.FC = () => {
🤖 Prompt for 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.

In `@src/pages/WikiComposePage.tsx` at line 43, Convert the existing inline
bilingual comments for the exported React component into JSDoc/TSDoc style by
adding a /** ... */ comment block immediately above the WikiComposePage
declaration; document the component purpose, any props (none in this case) and
its return value, and include `@component` and `@returns` tags (or equivalent) so
the exported symbol WikiComposePage has a proper JSDoc header that satisfies the
coding guidelines and linter rules.

- Store contentLocale in session metadata on first run; reuse on resume/GET
- Parse Accept-Language with q-values via invitationService helper
- Default getGraphContext fallback to ja; preserve null/undefined in strip helper
- Add contentLocale to GraphContext test fixtures and ingest graph routes

Co-authored-by: Akimasa Sugai <otomatty@users.noreply.github.com>

@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 `@server/api/src/routes/composeSessions.ts`:
- Around line 375-387: The DB metadata write after claiming status "running"
(the block that calls readContentLocaleFromSessionMetadata and then
db.update(wikiComposeSessions).set({...})) can throw and abort before SSE
execution/persistence cleanup runs, leaving the session stuck; wrap that update
in a try/catch around the call to db.update(wikiComposeSessions).set(...)
(referencing wikiComposeSessions, id, pageId, contentLocale and
readContentLocaleFromSessionMetadata) and on error log detailed context (id,
pageId, error) but do not rethrow — ensure execution continues so the SSE
cleanup and normal persistence/cleanup paths still run; optionally add a
lightweight retry or enqueue a background retry for the metadata update.
🪄 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: CHILL

Plan: Pro

Run ID: 780b1d82-d1ef-4629-8188-fbd8ee8abb6c

📥 Commits

Reviewing files that changed from the base of the PR and between 99f2d66 and 3dfc533.

📒 Files selected for processing (17)
  • server/api/src/__tests__/agents/core/composeLocale.test.ts
  • server/api/src/__tests__/agents/graphs/ingest/ingestPlannerGraph.test.ts
  • server/api/src/__tests__/agents/graphs/ingest/planIngestModel.test.ts
  • server/api/src/__tests__/agents/graphs/wikiCompose/wikiComposeGraph.test.ts
  • server/api/src/__tests__/agents/graphs/wikiMaintenance/wikiMaintenanceGraph.test.ts
  • server/api/src/__tests__/agents/runner/graphRunner.test.ts
  • server/api/src/__tests__/agents/subgraphs/research/nodes/planQueries.test.ts
  • server/api/src/__tests__/agents/subgraphs/research/researchGraph.interrupt.test.ts
  • server/api/src/__tests__/agents/subgraphs/research/researchGraph.loop.test.ts
  • server/api/src/__tests__/agents/subgraphs/research/researchGraph.modelGuard.test.ts
  • server/api/src/__tests__/agents/subgraphs/research/researchGraph.resume.test.ts
  • server/api/src/__tests__/agents/subgraphs/research/tools/webSearch.test.ts
  • server/api/src/__tests__/agents/subgraphs/research/tools/wikiSearch.test.ts
  • server/api/src/agents/core/composeLocale.ts
  • server/api/src/agents/subgraphs/research/nodes/shared/getGraphContext.ts
  • server/api/src/routes/composeSessions.ts
  • server/api/src/routes/ingest.ts
✅ Files skipped from review due to trivial changes (5)
  • server/api/src/tests/agents/subgraphs/research/researchGraph.interrupt.test.ts
  • server/api/src/tests/agents/subgraphs/research/researchGraph.loop.test.ts
  • server/api/src/tests/agents/subgraphs/research/nodes/planQueries.test.ts
  • server/api/src/tests/agents/subgraphs/research/researchGraph.modelGuard.test.ts
  • server/api/src/tests/agents/core/composeLocale.test.ts

Comment thread server/api/src/routes/composeSessions.ts Outdated
Combine running status and metadata locale into one update so a failed
metadata write cannot strand the session in running without locale data.

Co-authored-by: Akimasa Sugai <otomatty@users.noreply.github.com>
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