Skip to content

Conversation

@yujonglee
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Nov 5, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Restructures AI task configs into separate transform and workflow modules, adds an early-character streaming validator with retry/abort semantics, updates task-config types to use transformed args, adjusts task execution and UI header tooltip handling, and performs widespread dependency version bumps.

Changes

Cohort / File(s) Change Summary
Package Version Updates
apps/desktop/package.json, apps/pro/package.json, apps/web/package.json, package.json, packages/codemirror/package.json, packages/db/package.json, packages/obsidian/package.json, packages/tiptap/package.json, packages/ui/package.json, packages/utils/package.json
Patch/minor dependency version bumps across many packages (Radix, TanStack, TipTap, AI SDK, Node types, tooling).
Early Validation & Retry
apps/desktop/src/store/zustand/ai-task/shared/validate.ts, apps/desktop/src/store/zustand/ai-task/shared/validate.test.ts
Adds exported EarlyValidatorFn type and withEarlyValidationRetry async-generator implementing buffered streaming, early validation, abort-on-fail, retry loop and onRetry callback; adds comprehensive tests covering buffering, retry, abort, and edge cases.
Enhance: Transform & Workflow Split
apps/desktop/src/store/zustand/ai-task/task-configs/enhance-transform.ts, apps/desktop/src/store/zustand/ai-task/task-configs/enhance-workflow.ts
Splits previous enhance TaskConfig into enhanceTransform (produces transformArgs) and enhanceWorkflow (executeWorkflow + transforms); workflow adds template generation, prompt rendering, streaming summary via early validation.
Title: Transform & Workflow Split (and removal)
apps/desktop/src/store/zustand/ai-task/task-configs/title-transform.ts, apps/desktop/src/store/zustand/ai-task/task-configs/title-workflow.ts, apps/desktop/src/store/zustand/ai-task/task-configs/title.ts
Removes monolithic title.ts; introduces titleTransform (reads enhanced_md from store) and titleWorkflow (prompt rendering and streaming title generation).
Task Config API & Composition
apps/desktop/src/store/zustand/ai-task/task-configs/index.ts
Adds TaskArgsMapTransformed, replaces getPrompt/getSystem with transformArgs, changes executeWorkflow to accept transformed args, and composes TASK_CONFIGS by merging transform + workflow exports.
Task Execution Update
apps/desktop/src/store/zustand/ai-task/tasks.ts
Calls taskConfig.transformArgs(...) to produce enrichedArgs, then passes those to executeWorkflow (replaces prior separate system/prompt retrieval).
UI: Note Input Header Tooltip
apps/desktop/src/components/main/body/sessions/note-input/header.tsx
Wraps summary-tab icon button with Tooltip/TooltipTrigger/TooltipContent to surface validation error messages; extends useEnhanceLogic return to propagate error to header component.
UI: Empty State Icon
apps/desktop/src/components/main/body/empty/index.tsx
Adds ArrowUpRight fallback icon when no keyboard shortcut present; conditional rendering between KbdGroup and fallback icon.
Layout: Tabs API Usage
apps/desktop/src/routes/app/main/_layout.tsx
Removes usage of registerOnClose and invalidateResource, deletes associated effect cleanup logic; destructured useTabs() usage reduced to { registerOnEmpty, currentTab, openNew }.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant Validator as EarlyValidatorFn
    participant Wrapper as withEarlyValidationRetry
    participant Stream as executeStream
    participant OnRetry as onRetry

    Caller->>Wrapper: iterate generator (options: minChar, maxChar, maxRetries)
    loop attempts (<= maxRetries)
        Wrapper->>Stream: call executeStream(signal, attemptContext)
        loop stream chunks
            Stream-->>Wrapper: yield TextStreamPart (text-delta / other)
            Wrapper->>Wrapper: buffer text-delta, track trimmed length
            alt buffered length >= minChar
                Wrapper->>Validator: validate(accumulatedText)
                alt validator returns valid
                    Validator-->>Wrapper: { valid: true }
                    Wrapper-->>Caller: yield buffered chunks (when flush conditions met)
                else validator returns invalid
                    Validator-->>Wrapper: { valid: false, feedback }
                    Wrapper->>Stream: abort current stream (signal.abort)
                    alt retries remain
                        Wrapper->>OnRetry: call onRetry(feedback, attempt)
                        OnRetry-->>Wrapper: continue (store previousFeedback)
                    else no retries left
                        Wrapper-->>Caller: throw validation error
                    end
                end
            end
        end
        alt stream ends and no retry
            Wrapper-->>Caller: complete
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

  • Attention areas:
    • apps/desktop/src/store/zustand/ai-task/shared/validate.ts — verify buffering, abort, retry, and error propagation semantics and edge cases.
    • apps/desktop/src/store/zustand/ai-task/task-configs/index.ts — ensure type changes and TaskConfig consumers align with transformed-args surface.
    • apps/desktop/src/store/zustand/ai-task/task-configs/enhance-workflow.ts — prompt/template generation and validator logic correctness.
    • Tests in validate.test.ts — verify coverage matches intended control flow and error scenarios.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided by the author; however, this is a lenient check and the lack of description alone does not constitute being off-topic. Consider adding a description explaining the motivation, impact, and key changes introduced in this PR.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately reflects the main changes: introducing validation and retry logic for AI task workflows.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e62eca and 4f6feae.

📒 Files selected for processing (3)
  • apps/desktop/src/components/main/body/empty/index.tsx (2 hunks)
  • apps/desktop/src/routes/app/main/_layout.tsx (1 hunks)
  • apps/desktop/src/store/zustand/ai-task/task-configs/enhance-workflow.ts (1 hunks)

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

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

⚠️ Outside diff range comments (1)
apps/desktop/src/store/zustand/ai-task/task-configs/enhance-transform.ts (1)

173-188: Prevent NaNs when transcript start times are missing.

Math.min(...Array.from(transcriptMap.values())) produces NaN as soon as one transcript lacks a started_at value (the map stores undefined, and Math.min(undefined, …)NaN). Once that happens every start_ms / end_ms we emit becomes NaN, so the downstream enhance workflow receives unusable timing data. Please coerce the stored values to numbers (e.g. default to 0) before computing the minimum.

Apply this diff:

-  const sessionStartMs = transcriptIds.length > 0
-    ? Math.min(...Array.from(transcriptMap.values()))
-    : 0;
+  const transcriptStarts = Array.from(transcriptMap.values()).map((value) =>
+    typeof value === "number" ? value : 0,
+  );
+  const sessionStartMs = transcriptStarts.length > 0
+    ? Math.min(...transcriptStarts)
+    : 0;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ce5bf2 and 1e62eca.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (20)
  • apps/desktop/package.json (4 hunks)
  • apps/desktop/src/components/main/body/sessions/note-input/header.tsx (3 hunks)
  • apps/desktop/src/store/zustand/ai-task/shared/validate.test.ts (1 hunks)
  • apps/desktop/src/store/zustand/ai-task/shared/validate.ts (1 hunks)
  • apps/desktop/src/store/zustand/ai-task/task-configs/enhance-transform.ts (3 hunks)
  • apps/desktop/src/store/zustand/ai-task/task-configs/enhance-workflow.ts (1 hunks)
  • apps/desktop/src/store/zustand/ai-task/task-configs/index.ts (4 hunks)
  • apps/desktop/src/store/zustand/ai-task/task-configs/title-transform.ts (1 hunks)
  • apps/desktop/src/store/zustand/ai-task/task-configs/title-workflow.ts (1 hunks)
  • apps/desktop/src/store/zustand/ai-task/task-configs/title.ts (0 hunks)
  • apps/desktop/src/store/zustand/ai-task/tasks.ts (2 hunks)
  • apps/pro/package.json (1 hunks)
  • apps/web/package.json (2 hunks)
  • package.json (1 hunks)
  • packages/codemirror/package.json (1 hunks)
  • packages/db/package.json (1 hunks)
  • packages/obsidian/package.json (1 hunks)
  • packages/tiptap/package.json (2 hunks)
  • packages/ui/package.json (2 hunks)
  • packages/utils/package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/desktop/src/store/zustand/ai-task/task-configs/title.ts
🧰 Additional context used
🧬 Code graph analysis (7)
apps/desktop/src/store/zustand/ai-task/task-configs/title-transform.ts (1)
apps/desktop/src/store/zustand/ai-task/task-configs/index.ts (3)
  • TaskConfig (64-73)
  • TaskArgsMap (15-18)
  • TaskArgsMapTransformed (20-53)
apps/desktop/src/components/main/body/sessions/note-input/header.tsx (3)
packages/ui/src/components/ui/tooltip.tsx (3)
  • Tooltip (32-32)
  • TooltipTrigger (32-32)
  • TooltipContent (32-32)
packages/ui/src/components/ui/popover.tsx (1)
  • PopoverTrigger (29-29)
packages/utils/src/cn.ts (1)
  • cn (20-22)
apps/desktop/src/store/zustand/ai-task/task-configs/title-workflow.ts (1)
apps/desktop/src/store/zustand/ai-task/task-configs/index.ts (2)
  • TaskConfig (64-73)
  • TaskArgsMapTransformed (20-53)
apps/desktop/src/store/zustand/ai-task/task-configs/index.ts (5)
apps/desktop/src/store/tinybase/schema-external.ts (1)
  • Template (123-123)
apps/desktop/src/store/zustand/ai-task/task-configs/enhance-workflow.ts (1)
  • enhanceWorkflow (10-13)
apps/desktop/src/store/zustand/ai-task/task-configs/enhance-transform.ts (1)
  • enhanceTransform (6-8)
apps/desktop/src/store/zustand/ai-task/task-configs/title-workflow.ts (1)
  • titleWorkflow (6-9)
apps/desktop/src/store/zustand/ai-task/task-configs/title-transform.ts (1)
  • titleTransform (4-6)
apps/desktop/src/store/zustand/ai-task/task-configs/enhance-transform.ts (1)
apps/desktop/src/store/zustand/ai-task/task-configs/index.ts (3)
  • TaskConfig (64-73)
  • TaskArgsMap (15-18)
  • TaskArgsMapTransformed (20-53)
apps/desktop/src/store/zustand/ai-task/shared/validate.test.ts (1)
apps/desktop/src/store/zustand/ai-task/shared/validate.ts (2)
  • EarlyValidatorFn (3-3)
  • withEarlyValidationRetry (5-90)
apps/desktop/src/store/zustand/ai-task/task-configs/enhance-workflow.ts (4)
apps/desktop/src/store/zustand/ai-task/task-configs/index.ts (2)
  • TaskConfig (64-73)
  • TaskArgsMapTransformed (20-53)
apps/desktop/src/store/zustand/ai-task/shared/transform_impl.ts (1)
  • trimBeforeMarker (4-70)
apps/desktop/src/store/tinybase/schema-external.ts (1)
  • templateSectionSchema (75-78)
apps/desktop/src/store/zustand/ai-task/shared/validate.ts (2)
  • withEarlyValidationRetry (5-90)
  • EarlyValidatorFn (3-3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ci (macos, macos-14)
🔇 Additional comments (9)
packages/db/package.json (1)

23-23: LGTM. Simple patch-level update to @types/node with no conflicts.

package.json (1)

8-8: LGTM. Minor version bump for turbo build orchestration tool is safe.

apps/pro/package.json (1)

11-13: LGTM. Minor/patch-level updates to Hono MCP integration and Model Context Protocol SDK.

packages/obsidian/package.json (1)

20-20: LGTM. Patch update to @tanstack/react-query, consistent with other packages.

apps/desktop/package.json (2)

18-25: Significant major version upgrades require verification. React 19.2.0, xstate 5.24.0, and zod 4.1.12 each introduce breaking changes. Verify that:

  • React 19 migration is complete (ref callbacks, removed propTypes, JSX transform, etc. per React 19 docs)
  • xstate 5.24.0 state machine configurations are updated
  • zod 4.1.12 schema definitions use unified error customization where applicable

Also applies to: 53-56, 71-71, 76-76, 82-83, 90-91


96-98: @tanstack/router-plugin and router-devtools bumped to 1.134.12. Ensure this version is compatible with @tanstack/react-router@^1.134.12 in dependencies (line 55).

packages/utils/package.json (1)

7-7: LGTM. Patch-level updates to AI SDK packages, aligned with new validation/retry features in desktop app.

Also applies to: 15-15

packages/ui/package.json (1)

23-37: LGTM. Patch/minor updates to Radix UI components, form handling, and type definitions. All changes are safe and maintain React 19 compatibility.

Also applies to: 47-47, 54-55

packages/codemirror/package.json (1)

15-19: LGTM. Patch-level updates to CodeMirror editor dependencies and tooling. peerDependencies correctly aligned with React 19.

Also applies to: 22-22, 25-25

@yujonglee yujonglee merged commit d165d7d into main Nov 5, 2025
3 of 5 checks passed
@yujonglee yujonglee deleted the ai-task-validate-retry branch November 5, 2025 04:38
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