feat(api): wiki compose P5 dynamic routing and maintenance graph (#953) - #970
Conversation
- Add routeAfterBrief and routeAfterResearch conditional edges to wikiComposeGraph - Add skip_research and conflict_resolution nodes with Vitest coverage - Register wiki-maintenance graph (broken links + stub page scan) - Bump wiki-compose graph version to 1.1.0 Co-authored-by: Akimasa Sugai <otomatty@users.noreply.github.com>
📝 WalkthroughWalkthroughAdds conditional routing and conflict-resolution interrupts to Wiki Compose, implements skipResearch/conflictResolution nodes and resume validation, introduces a linear Wiki Maintenance graph (scan → plan), updates state/types/UI/hooks/projections, integrates exports and app registration, and adds unit/integration tests. ChangesWiki Compose P5 & Wiki Maintenance Orchestration
🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request enhances the wikiComposeGraph with conditional routing logic to skip research or handle source conflicts through human-in-the-loop intervention. Additionally, it introduces a new wikiMaintenanceGraph designed to identify broken links and stub pages. A review comment identifies a potential non-determinism issue in the stub page scanning query due to a missing orderBy clause when a limit is applied.
| const rows = await ctx.db | ||
| .select({ id: pages.id, title: pages.title }) | ||
| .from(pages) | ||
| .where( | ||
| and( | ||
| eq(pages.ownerId, ctx.userId), | ||
| eq(pages.isDeleted, false), | ||
| or( | ||
| isNull(pages.contentPreview), | ||
| sql`length(trim(${pages.contentPreview})) < ${STUB_PREVIEW_MAX_LEN}`, | ||
| ), | ||
| ), | ||
| ) | ||
| .limit(200); |
There was a problem hiding this comment.
The query results are non-deterministic because there is no orderBy clause. When a limit is applied without an explicit sort order, the database may return different sets of rows across executions. To ensure consistent results for the maintenance scan, especially when the 200-row limit is reached, consider adding an explicit sort order (e.g., by id or updatedAt).
| const rows = await ctx.db | |
| .select({ id: pages.id, title: pages.title }) | |
| .from(pages) | |
| .where( | |
| and( | |
| eq(pages.ownerId, ctx.userId), | |
| eq(pages.isDeleted, false), | |
| or( | |
| isNull(pages.contentPreview), | |
| sql`length(trim(${pages.contentPreview})) < ${STUB_PREVIEW_MAX_LEN}`, | |
| ), | |
| ), | |
| ) | |
| .limit(200); | |
| const rows = await ctx.db | |
| .select({ id: pages.id, title: pages.title }) | |
| .from(pages) | |
| .where( | |
| and( | |
| eq(pages.ownerId, ctx.userId), | |
| eq(pages.isDeleted, false), | |
| or( | |
| isNull(pages.contentPreview), | |
| sql`length(trim(${pages.contentPreview})) < ${STUB_PREVIEW_MAX_LEN}`, | |
| ), | |
| ), | |
| ) | |
| .orderBy(pages.id) | |
| .limit(200); |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c9039160a
ℹ️ 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".
| export function routeAfterResearch(state: WikiComposeStateType): ResearchRoute { | ||
| return shouldResolveResearchConflicts(state) ? "conflict_resolution" : "structure"; |
There was a problem hiding this comment.
Gate conflict branch until clients can resume it
This new branch can route human_review_research to conflict_resolution, but the current UI/reload handlers only understand human_review_brief, human_review_research, and human_review_outline (see src/hooks/useWikiComposeSession.ts and server/api/src/routes/composeSessionProjection.ts). When a user approves at least one source and rejects two or more, the graph now emits a conflict_resolution interrupt that requires { acknowledged: true }, yet the client has no path to render/submit that payload, so sessions can get stuck or fail on resume.
Useful? React with 👍 / 👎.
| * clear) or when the session was seeded from chat with a pre-approved outline. | ||
| */ | ||
| export function routeAfterBrief(state: WikiComposeStateType): BriefRoute { | ||
| if (state.briefQuestions.length === 0) return "skip_research"; |
There was a problem hiding this comment.
Preserve research path for Brief-generation failures
Treating briefQuestions.length === 0 as an unconditional skip_research conflates two different cases: an intentional no-question Brief and the existing error fallback in briefDialogue (which sets questions: [] when the LLM call throws). With this condition, transient model/backend failures now bypass research entirely and proceed to outline/draft without any sources, which is a behavioral regression from the prior fail-open-to-research flow.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (7)
server/api/src/agents/graphs/wikiMaintenance/nodes/scanBrokenLinks.ts (1)
1-3: ⚡ Quick winAdd Japanese text to the node docblock.
The exported node’s documentation is currently English-only; please make it bilingual (JP/EN) like other graph-module docs.
As per coding guidelines:
**/*.{ts,tsx,js,jsx,md}: 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/agents/graphs/wikiMaintenance/nodes/scanBrokenLinks.ts` around lines 1 - 3, Update the top docblock for the exported node scan_broken_links to include Japanese alongside the existing English description (i.e., a bilingual JP/EN docblock similar to other graph-module docs); locate the comment block above the exported node (the /** ... */ immediately preceding scan_broken_links export in scanBrokenLinks.ts) and add a concise Japanese translation line or paragraph that mirrors the English text while keeping both languages clearly labeled or separated.server/api/src/__tests__/agents/graphs/wikiMaintenance/wikiMaintenanceGraph.test.ts (1)
92-99: ⚡ Quick winAssert
plannedAtas part of the plan contract in this integration test.The test validates counts and findings length, but not the required timestamp field. Adding a lightweight assertion tightens the spec coverage.
Suggested update
const out = result.output as { - maintenancePlan?: { brokenLinkCount: number; stubPageCount: number; findings: unknown[] }; + maintenancePlan?: { + brokenLinkCount: number; + stubPageCount: number; + findings: unknown[]; + plannedAt: string; + }; phase?: string; }; @@ expect(out.maintenancePlan?.brokenLinkCount).toBe(1); expect(out.maintenancePlan?.stubPageCount).toBe(1); expect(out.maintenancePlan?.findings).toHaveLength(2); + expect(typeof out.maintenancePlan?.plannedAt).toBe("string"); + expect(Number.isNaN(Date.parse(out.maintenancePlan!.plannedAt))).toBe(false);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 `@server/api/src/__tests__/agents/graphs/wikiMaintenance/wikiMaintenanceGraph.test.ts` around lines 92 - 99, The test currently asserts phase, brokenLinkCount, stubPageCount, and findings length but misses the required timestamp field; update the assertion block that checks the result.output (the local variable out and its maintenancePlan property) to also assert that maintenancePlan.plannedAt exists and is a valid timestamp (e.g., non-null/defined and parsable as a Date or matches ISO format). Locate the assertions around the variable named out in wikiMaintenanceGraph.test.ts and add a concise expectation that maintenancePlan.plannedAt is present and valid to tighten the plan contract.server/api/src/agents/graphs/wikiMaintenance/types.ts (1)
8-24: ⚡ Quick winMake exported interface docblocks bilingual for consistency.
Line 8 and Line 17 docblocks are English-only; please add Japanese counterparts to match the repository’s JP/EN documentation tone.
Suggested update
-/** One lint-style finding projected into graph state. */ +/** + * One lint-style finding projected into graph state. + * LangGraph state に投影される lint 形式の検出結果。 + */ export interface MaintenanceFinding { @@ -/** - * Aggregated maintenance plan emitted at the end of the graph. - */ +/** + * Aggregated maintenance plan emitted at the end of the graph. + * グラフ終端で生成される集約メンテナンスプラン。 + */ export interface MaintenancePlan {As per coding guidelines:
**/*.{ts,tsx,js,jsx,md}: 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/agents/graphs/wikiMaintenance/types.ts` around lines 8 - 24, Update the docblocks for the exported interfaces MaintenanceFinding and MaintenancePlan to include Japanese translations alongside the existing English descriptions; locate the comment above the MaintenanceFinding declaration ("One lint-style finding projected into graph state.") and add a concise Japanese equivalent, and do the same for the MaintenancePlan docblock ("Aggregated maintenance plan emitted at the end of the graph.") plus the plannedAt comment—ensure both English and Japanese appear for each comment to match repository bilingual documentation style.server/api/src/agents/graphs/wikiCompose/nodes/conflictResolution.ts (1)
16-24: ⚡ Quick winAdd TSDoc for helper function.
The
buildConflictSummaryhelper function lacks TSDoc documentation. While it's not exported, documenting significant helper functions improves code maintainability.📝 Suggested TSDoc
+/** + * Build conflict summary payload from approved/rejected research. + * + * 採用・却下ソースから矛盾サマリペイロードを構築。 + */ function buildConflictSummary(state: WikiComposeStateType): ResearchConflictSummary { return { approved: state.approvedResearch.map((s) => ({ id: s.id, title: s.title })), rejected: state.rejectedResearch.map((s) => ({ id: s.id, title: s.title })), rationale: "Multiple sources were rejected while others were kept. Confirm you want to proceed " + "with the approved set before generating the outline.", }; }As per coding guidelines: Include both Japanese and English comments/documentation 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/agents/graphs/wikiCompose/nodes/conflictResolution.ts` around lines 16 - 24, The helper function buildConflictSummary (accepting WikiComposeStateType and returning ResearchConflictSummary) is missing TSDoc; add a brief TSDoc block immediately above the function that describes its purpose, parameters, and return value in both English and Japanese, mentioning that it constructs an approved/rejected summary and the rationale string; ensure the tag syntax (/** ... */) includes `@param` for state and `@returns` for the ResearchConflictSummary and mirrors project comment style.server/api/src/agents/graphs/wikiCompose/types.ts (1)
203-208: ⚡ Quick winAdd proper TSDoc block with bilingual documentation.
The exported
ResearchConflictSummaryinterface lacks a proper TSDoc block with bilingual comments. Per coding guidelines, all exported interfaces should have TSDoc comments with both Japanese and English.📝 Suggested TSDoc format
-/** Lightweight conflict summary for the P5 `conflict_resolution` interrupt. */ +/** + * Lightweight conflict summary for the P5 `conflict_resolution` interrupt. + * + * P5 矛盾解消 interrupt 用の軽量サマリ。採用・却下ソースのid/title と理由を含む。 + */ export interface ResearchConflictSummary { approved: Array<{ id: string; title: string }>; rejected: Array<{ id: string; title: string }>; rationale: string; }As per coding guidelines: Include TSDoc/JSDoc comments for all exported functions, types, and interfaces; Include both Japanese and English comments/documentation.
🤖 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/agents/graphs/wikiCompose/types.ts` around lines 203 - 208, Add a TSDoc block above the exported ResearchConflictSummary interface that documents the interface in both English and Japanese, and include short bilingual descriptions for each field (approved, rejected, rationale) and the shape of approved/rejected entries (id and title); update the comment to follow the project TSDoc/JSDoc style (/** ... */) so the interface and its members are fully documented for both languages.server/api/src/agents/graphs/wikiCompose/routing.ts (2)
25-26: ⚡ Quick winAdd TSDoc block for exported type.
The exported
ResearchRoutetype alias lacks a TSDoc block. Per coding guidelines, all exported types should have TSDoc comments.📝 Suggested TSDoc format
-/** Edge label after `human_review_research`. */ -export type ResearchRoute = "structure" | "conflict_resolution"; +/** + * Edge label after `human_review_research`. + * + * Research 完了後の分岐ラベル。 + */ +export type ResearchRoute = "structure" | "conflict_resolution";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 `@server/api/src/agents/graphs/wikiCompose/routing.ts` around lines 25 - 26, Add a TSDoc block immediately above the exported type alias ResearchRoute describing its purpose as the edge label after `human_review_research`, listing the allowed literal values ("structure" and "conflict_resolution") and intended usage in routing/graph logic; update the comment to follow TSDoc style (/** ... */) and mention that it is an exported type used for routing decisions to satisfy the project's documentation guidelines.
22-23: ⚡ Quick winAdd TSDoc block for exported type.
The exported
BriefRoutetype alias lacks a TSDoc block. Per coding guidelines, all exported types should have TSDoc comments.📝 Suggested TSDoc format
-/** Edge label after `human_review_brief`. */ -export type BriefRoute = "research" | "skip_research"; +/** + * Edge label after `human_review_brief`. + * + * Brief 完了後の分岐ラベル。 + */ +export type BriefRoute = "research" | "skip_research";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 `@server/api/src/agents/graphs/wikiCompose/routing.ts` around lines 22 - 23, Add a TSDoc comment for the exported type alias BriefRoute describing its purpose and the allowed literal values; update the declaration for BriefRoute to be preceded by a TSDoc block that briefly states it represents the edge label after `human_review_brief` and documents the two possible routes ("research" and "skip_research") and any usage notes or examples as needed.
🤖 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/__tests__/agents/graphs/wikiCompose/wikiComposeRouting.test.ts`:
- Around line 1-3: The file-level header comment in wikiComposeRouting.test.ts
is English-only; add a Japanese translation alongside the existing English line
so the top-of-file doc comment is bilingual (e.g., keep "Wiki Compose P5 routing
predicates (`#953`)." and append a Japanese equivalent on the next line), ensuring
both languages appear in the file-level comment block to comply with the
repository tone rules.
In `@server/api/src/agents/graphs/wikiMaintenance/index.ts`:
- Around line 1-3: Add a Japanese translation for the file-level header comment
in index.ts by appending or inserting a Japanese line alongside the English
header "Wiki maintenance graph — public barrel (`#953`)"; update the top-of-file
JSDoc block so it contains both the English and a concise Japanese counterpart
(e.g., 「ウィキ保守グラフ — パブリックバレル(#953)」) preserving the existing comment style and
punctuation.
In `@server/api/src/agents/graphs/wikiMaintenance/nodes/scanStubPages.ts`:
- Around line 42-43: The maintenance finding text emitted from scanStubPages.ts
currently uses English-only values for the title and suggestion fields; update
the emitted strings (referencing the title property and the suggestion field in
the stub creation logic) to include both Japanese and English variants (matching
the JP/EN phrasing used elsewhere), e.g. provide a Japanese translation followed
by the English text for the suggestion and any default title text so downstream
consumers receive bilingual output.
In `@server/api/src/agents/graphs/wikiMaintenance/state.ts`:
- Around line 24-25: Add TSDoc/JSDoc comments (both English and Japanese) for
the two exported type aliases WikiMaintenanceStateType and
WikiMaintenanceStateUpdate so the public contract is documented; update the
declarations near WikiMaintenanceStateType and WikiMaintenanceStateUpdate to
include a brief English sentence describing what each alias represents (e.g.,
"Current state shape for wiki maintenance") followed by a Japanese translation,
plus any param/usage notes if applicable, ensuring the comment blocks are
standard /** ... */ TSDoc style above each export.
---
Nitpick comments:
In
`@server/api/src/__tests__/agents/graphs/wikiMaintenance/wikiMaintenanceGraph.test.ts`:
- Around line 92-99: The test currently asserts phase, brokenLinkCount,
stubPageCount, and findings length but misses the required timestamp field;
update the assertion block that checks the result.output (the local variable out
and its maintenancePlan property) to also assert that maintenancePlan.plannedAt
exists and is a valid timestamp (e.g., non-null/defined and parsable as a Date
or matches ISO format). Locate the assertions around the variable named out in
wikiMaintenanceGraph.test.ts and add a concise expectation that
maintenancePlan.plannedAt is present and valid to tighten the plan contract.
In `@server/api/src/agents/graphs/wikiCompose/nodes/conflictResolution.ts`:
- Around line 16-24: The helper function buildConflictSummary (accepting
WikiComposeStateType and returning ResearchConflictSummary) is missing TSDoc;
add a brief TSDoc block immediately above the function that describes its
purpose, parameters, and return value in both English and Japanese, mentioning
that it constructs an approved/rejected summary and the rationale string; ensure
the tag syntax (/** ... */) includes `@param` for state and `@returns` for the
ResearchConflictSummary and mirrors project comment style.
In `@server/api/src/agents/graphs/wikiCompose/routing.ts`:
- Around line 25-26: Add a TSDoc block immediately above the exported type alias
ResearchRoute describing its purpose as the edge label after
`human_review_research`, listing the allowed literal values ("structure" and
"conflict_resolution") and intended usage in routing/graph logic; update the
comment to follow TSDoc style (/** ... */) and mention that it is an exported
type used for routing decisions to satisfy the project's documentation
guidelines.
- Around line 22-23: Add a TSDoc comment for the exported type alias BriefRoute
describing its purpose and the allowed literal values; update the declaration
for BriefRoute to be preceded by a TSDoc block that briefly states it represents
the edge label after `human_review_brief` and documents the two possible routes
("research" and "skip_research") and any usage notes or examples as needed.
In `@server/api/src/agents/graphs/wikiCompose/types.ts`:
- Around line 203-208: Add a TSDoc block above the exported
ResearchConflictSummary interface that documents the interface in both English
and Japanese, and include short bilingual descriptions for each field (approved,
rejected, rationale) and the shape of approved/rejected entries (id and title);
update the comment to follow the project TSDoc/JSDoc style (/** ... */) so the
interface and its members are fully documented for both languages.
In `@server/api/src/agents/graphs/wikiMaintenance/nodes/scanBrokenLinks.ts`:
- Around line 1-3: Update the top docblock for the exported node
scan_broken_links to include Japanese alongside the existing English description
(i.e., a bilingual JP/EN docblock similar to other graph-module docs); locate
the comment block above the exported node (the /** ... */ immediately preceding
scan_broken_links export in scanBrokenLinks.ts) and add a concise Japanese
translation line or paragraph that mirrors the English text while keeping both
languages clearly labeled or separated.
In `@server/api/src/agents/graphs/wikiMaintenance/types.ts`:
- Around line 8-24: Update the docblocks for the exported interfaces
MaintenanceFinding and MaintenancePlan to include Japanese translations
alongside the existing English descriptions; locate the comment above the
MaintenanceFinding declaration ("One lint-style finding projected into graph
state.") and add a concise Japanese equivalent, and do the same for the
MaintenancePlan docblock ("Aggregated maintenance plan emitted at the end of the
graph.") plus the plannedAt comment—ensure both English and Japanese appear for
each comment to match repository bilingual documentation style.
🪄 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: 8ad417b5-9319-4694-94c7-faa9bf362889
📒 Files selected for processing (24)
server/api/src/__tests__/agents/graphs/wikiCompose/wikiComposeGraph.test.tsserver/api/src/__tests__/agents/graphs/wikiCompose/wikiComposeRouting.test.tsserver/api/src/__tests__/agents/graphs/wikiMaintenance/wikiMaintenanceGraph.test.tsserver/api/src/agents/graphs/wikiCompose/index.tsserver/api/src/agents/graphs/wikiCompose/nodes/conflictResolution.tsserver/api/src/agents/graphs/wikiCompose/nodes/index.tsserver/api/src/agents/graphs/wikiCompose/nodes/skipResearch.tsserver/api/src/agents/graphs/wikiCompose/resumeSchemas.tsserver/api/src/agents/graphs/wikiCompose/routing.tsserver/api/src/agents/graphs/wikiCompose/state.tsserver/api/src/agents/graphs/wikiCompose/types.tsserver/api/src/agents/graphs/wikiCompose/wikiComposeGraph.tsserver/api/src/agents/graphs/wikiMaintenance/index.tsserver/api/src/agents/graphs/wikiMaintenance/nodes/index.tsserver/api/src/agents/graphs/wikiMaintenance/nodes/planMaintenance.tsserver/api/src/agents/graphs/wikiMaintenance/nodes/scanBrokenLinks.tsserver/api/src/agents/graphs/wikiMaintenance/nodes/scanStubPages.tsserver/api/src/agents/graphs/wikiMaintenance/state.tsserver/api/src/agents/graphs/wikiMaintenance/types.tsserver/api/src/agents/graphs/wikiMaintenance/wikiMaintenanceGraph.tsserver/api/src/agents/index.tsserver/api/src/agents/subgraphs/research/types.tsserver/api/src/app.tsserver/api/src/routes/composeSessions.ts
…ng (#953) - Add briefDegraded flag so LLM fallback still runs research - Wire conflict_resolution through projection, hook, and ComposePanel UI - Stabilize stub scan query with orderBy; bilingual maintenance strings Co-authored-by: Akimasa Sugai <otomatty@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 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/composeSessionProjection.ts`:
- Around line 27-28: The doc comment for the new field researchConflictSummary
is only in English; add a Japanese translation so comments are bilingual per
guidelines. Update the JSDoc block above researchConflictSummary to include both
Japanese and English descriptions (e.g., Japanese line followed by the existing
English line or vice versa), matching surrounding comment style and formatting
for other fields in the file.
In `@src/components/wikiCompose/ConflictResolutionSection.tsx`:
- Around line 14-21: Add TSDoc/JSDoc comments in both English and Japanese for
the exported interface ConflictResolutionSectionProps and the exported component
ConflictResolutionSection: document each property in
ConflictResolutionSectionProps (conflicts, isStreaming, onSubmit) with types and
purpose, and add a short bilingual description for the ConflictResolutionSection
component (including expected behavior and return type/React.FC usage). Ensure
comments follow TSDoc format (/** ... */), include Japanese translation
alongside English sentences, and place them immediately above the interface and
component declarations.
In `@src/components/wikiCompose/PhaseStepper.tsx`:
- Around line 34-35: The inline English-only comment in PhaseStepper.tsx ("// P5
conflict interrupt sits between Research and Structure on the graph, but the
stepper keeps five labels — highlight Research while resolving conflicts.") must
include a Japanese translation per repo guidelines; update the same comment
(near the PhaseStepper component) to add a concise Japanese sentence conveying
the same meaning immediately before or after the English sentence so both
languages are present.
In `@src/hooks/useWikiComposeSession.ts`:
- Line 40: Add TSDoc/JSDoc comments for the exported type ComposePhase and
update the docstring for submitConflictAck to include both English and Japanese;
specifically, above the export type ComposePhase = "brief" | "research" |
"conflict" | "structure" | "draft" | "completed"; add a short TSDoc describing
the purpose and allowed phases (in English then Japanese), and modify the
existing documentation/comment for the submitConflictAck function to include a
bilingual description, parameter notes, and return details (English first,
Japanese second) following the project's TSDoc/JSDoc style conventions.
- Around line 480-485: The conflict_resolution branch currently expects to
preserve prior approvals but resume hydration calls
reduceInterrupt(INITIAL_STATE, ...), which wipes approvedSources; update the
resume/hydration callsite to pass the actual current state (not INITIAL_STATE)
into reduceInterrupt so the case "conflict_resolution" can read
prev.approvedSources, or alternatively change the conflict_resolution return to
defensively use payload or a fallback (e.g., approvedSources:
prev?.approvedSources ?? payload.approvedSources) — adjust either the
reduceInterrupt invocation or the case "conflict_resolution" logic so
approvedSources are not reset during resume.
In `@src/lib/wikiCompose/types.ts`:
- Around line 121-126: Update the TSDoc for the ResearchConflictSummary
interface to include both English and Japanese descriptions: add a Japanese
sentence (or short paragraph) that mirrors the existing English docstring so the
comment is bilingual, and ensure the fields (approved, rejected, rationale) are
briefly described in both languages; target the comment above the
ResearchConflictSummary interface declaration to keep docs consistent with repo
guidelines.
- Around line 129-135: The ComposeSseEvent type's compose_phase.phase union is
missing the "conflict" member and must be updated to match the phase union added
in the wikiCompose types (the union that includes "brief" | "research" |
"conflict" | "structure" | "draft" | "completed"); update the ComposeSseEvent
definition (and any other SSE/wire event type that defines compose_phase.phase)
to include "conflict" so the runtime wire contract matches the
projected/interrupt flows.
🪄 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: 72b98da7-124d-4c26-9962-46d2f1b18edc
📒 Files selected for processing (15)
server/api/src/__tests__/agents/graphs/wikiCompose/wikiComposeRouting.test.tsserver/api/src/__tests__/routes/composeSessionProjection.test.tsserver/api/src/agents/graphs/wikiCompose/nodes/briefDialogue.tsserver/api/src/agents/graphs/wikiCompose/routing.tsserver/api/src/agents/graphs/wikiCompose/state.tsserver/api/src/agents/graphs/wikiMaintenance/index.tsserver/api/src/agents/graphs/wikiMaintenance/nodes/scanStubPages.tsserver/api/src/agents/graphs/wikiMaintenance/state.tsserver/api/src/routes/composeSessionProjection.tssrc/components/wikiCompose/ComposePanel.tsxsrc/components/wikiCompose/ConflictResolutionSection.tsxsrc/components/wikiCompose/PhaseStepper.tsxsrc/hooks/useWikiComposeSession.tssrc/lib/wikiCompose/types.tssrc/pages/WikiComposePage.tsx
✅ Files skipped from review due to trivial changes (1)
- server/api/src/agents/graphs/wikiMaintenance/index.ts
There was a problem hiding this comment.
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 `@src/hooks/useWikiComposeSession.ts`:
- Around line 505-507: The inline comment above the spread that preserves
approvals (the line with ...(prev.approvedSources.length > 0 ? {
approvedSources: prev.approvedSources } : {})) is English-only; add a Japanese
translation directly alongside it so the comment is bilingual. Keep the original
English sentence about keeping approvals from `prev` (SSE) or checkpoint context
(resume) and append a concise Japanese equivalent mentioning
`prev.approvedSources` and `reduceResumeOutput` to match repository guidelines.
🪄 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: bc10806f-697d-4f8a-be0a-d22642c341a9
📒 Files selected for processing (6)
server/api/src/agents/core/types/sseEvents.tsserver/api/src/routes/composeSessionProjection.tssrc/components/wikiCompose/ConflictResolutionSection.tsxsrc/components/wikiCompose/PhaseStepper.tsxsrc/hooks/useWikiComposeSession.tssrc/lib/wikiCompose/types.ts
✅ Files skipped from review due to trivial changes (1)
- src/components/wikiCompose/PhaseStepper.tsx
| // Keep approvals from `prev` (SSE) or checkpoint context (resume); do not | ||
| // overwrite with an empty array when `reduceResumeOutput` seeds context. | ||
| ...(prev.approvedSources.length > 0 ? { approvedSources: prev.approvedSources } : {}), |
There was a problem hiding this comment.
Keep the new inline comment bilingual.
Line 505-507 adds an English-only inline comment; please add a Japanese counterpart to match repo documentation tone.
Suggested patch
- // Keep approvals from `prev` (SSE) or checkpoint context (resume); do not
- // overwrite with an empty array when `reduceResumeOutput` seeds context.
+ // Keep approvals from `prev` (SSE) or checkpoint context (resume); do not
+ // overwrite with an empty array when `reduceResumeOutput` seeds context.
+ // `prev`(SSE)または checkpoint 文脈(resume)の承認を保持し、
+ // `reduceResumeOutput` の context seed で空配列に上書きしない。
...(prev.approvedSources.length > 0 ? { approvedSources: prev.approvedSources } : {}),As per coding guidelines: **/*.{ts,tsx,js,jsx,md}: 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 `@src/hooks/useWikiComposeSession.ts` around lines 505 - 507, The inline
comment above the spread that preserves approvals (the line with
...(prev.approvedSources.length > 0 ? { approvedSources: prev.approvedSources }
: {})) is English-only; add a Japanese translation directly alongside it so the
comment is bilingual. Keep the original English sentence about keeping approvals
from `prev` (SSE) or checkpoint context (resume) and append a concise Japanese
equivalent mentioning `prev.approvedSources` and `reduceResumeOutput` to match
repository guidelines.
概要
Wiki Compose P5(#953)として、
wikiComposeGraphに動的 conditional edge を追加し、新規wiki-maintenancegraph をGraphRegistryに登録しました。変更点
routeAfterBrief): Brief 0 件、またはchatSeed.outlineがある場合はskip_research→ Structure へ直行routeAfterResearch): 採用 1 件以上かつ却下 2 件以上でconflict_resolutioninterrupt → Structurewiki-maintenancegraph:scan_broken_links→scan_stub_pages→plan_maintenance(lint ルール +content_previewヒューリスティック)wiki-composegraph version を1.1.0に bump変更の種類
テスト方法
チェックリスト
関連 Issue
Closes #953
受け入れ条件(Issue #953)
wikiComposeGraphに追加wikiComposeRouting.test.ts+ graph 統合)GraphRegistryパターンに従って追加(wiki-maintenance)routing.ts,wikiComposeGraph.ts,wikiMaintenanceGraph.ts)意図的にスコープ外(P5 非目標)
media_curatorsubgraph、Draft 失敗時のescalate_to_orchestrator、セッション 30 日 TTL、checkpoint GCSummary by CodeRabbit
Tests
New Features