Skip to content

test(todo-sync): match required priority fallback#2832

Merged
code-yeongyu merged 2 commits intocode-yeongyu:devfrom
RaviTharuma:fix/todo-sync-priority-default
Mar 25, 2026
Merged

test(todo-sync): match required priority fallback#2832
code-yeongyu merged 2 commits intocode-yeongyu:devfrom
RaviTharuma:fix/todo-sync-priority-default

Conversation

@RaviTharuma
Copy link
Copy Markdown
Contributor

@RaviTharuma RaviTharuma commented Mar 25, 2026

Summary

  • keep the required "medium" fallback in syncTaskToTodo() when task metadata has no valid priority
  • update the three mismatched todo-sync expectations so tests match the real OpenCode/OmO contract
  • keep this CI-unblock separate from #2829

Verification

  • bun test src/tools/task/todo-sync.test.ts src/hooks/todo-continuation-enforcer --bail
  • bun test src/hooks/atlas --bail
  • bunx tsc --noEmit
  • bun run build

Context

This stays intentionally separate from #2829. The original failing todo-sync test was reproducible on clean upstream/dev, but the first attempt on this PR went in the wrong direction by removing the runtime priority fallback. The current PR head restores the required fallback and aligns the tests with the actual runtime contract instead.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@RaviTharuma
Copy link
Copy Markdown
Contributor Author

@code-yeongyu Small separate fix for the current red base-branch CI. Root cause was that syncTaskToTodo() always injected a medium priority even though TodoInfo.priority is optional and the existing tests expect missing/invalid task priorities to stay undefined. I reproduced the same failure on clean upstream/dev before opening this, so this is intentionally split from #2829.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Confidence score: 2/5

  • High-risk regression: in src/tools/task/todo-sync.ts, removing the priority fallback conflicts with Opencode’s non-null requirement and can trigger a NOT NULL constraint failed SQLite error during task sync.
  • This is concrete and high-confidence user impact (severity 9/10, confidence 10/10), so merge risk is elevated rather than a minor follow-up fix.
  • Pay close attention to src/tools/task/todo-sync.ts - ensure priority is always populated with a non-null string before persistence/synchronization.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/tools/task/todo-sync.ts">

<violation number="1" location="src/tools/task/todo-sync.ts:68">
P0: Custom agent: **Opencode Compatibility**

Opencode strictly requires a non-null string for `priority`. Removing this fallback will crash task synchronization with a `NOT NULL constraint failed` SQLite exception whenever a task lacks priority metadata.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@RaviTharuma
Copy link
Copy Markdown
Contributor Author

@code-yeongyu Quick correction on #2832: cubic found a valid issue in my first version. After re-checking against the OpenCode SDK types, Todo.priority is treated as required, so dropping the fallback was the wrong direction. I pushed 46c6e1d to restore the medium fallback and changed the three failing tests instead. Fresh verification: bun test src/tools/task/todo-sync.test.ts src/hooks/todo-continuation-enforcer --bail, bunx tsc --noEmit, bun run build.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Confidence score: 3/5

  • There is a concrete regression risk: src/tools/task/todo-sync.test.ts now enforces a default "medium" priority when missing, which conflicts with the PR goal to preserve missing priority values.
  • Given the issue’s medium severity (6/10) and high confidence (9/10), this is more than a minor mismatch and could change user-visible sync behavior if merged as-is.
  • Pay close attention to src/tools/task/todo-sync.test.ts - test expectations currently appear misaligned with the intended missing-priority behavior.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/tools/task/todo-sync.test.ts">

<violation number="1" location="src/tools/task/todo-sync.test.ts:30">
P2: Tests were changed to require a `"medium"` default for missing priority, contradicting the PR’s stated goal to preserve missing priority.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

content: "Fix bug",
status: "pending",
priority: undefined,
priority: "medium",
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Mar 25, 2026

Choose a reason for hiding this comment

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

P2: Tests were changed to require a "medium" default for missing priority, contradicting the PR’s stated goal to preserve missing priority.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/tools/task/todo-sync.test.ts, line 30:

<comment>Tests were changed to require a `"medium"` default for missing priority, contradicting the PR’s stated goal to preserve missing priority.</comment>

<file context>
@@ -27,7 +27,7 @@ describe("syncTaskToTodo", () => {
       content: "Fix bug",
       status: "pending",
-      priority: undefined,
+      priority: "medium",
     });
   });
</file context>
Fix with Cubic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

cubic found a real mismatch here, but it was in the PR narrative rather than in the current runtime behavior. After the previous correction, the product code intentionally keeps priority: extractPriority(task.metadata) ?? "medium" because @opencode-ai/sdk exposes Todo.priority as a required string and current OmO readers assume a non-null priority. The tests now match that current contract. I updated the PR title/body to reflect the actual scope (test(todo-sync): match required priority fallback) so it no longer claims that missing priorities should stay undefined. Fresh verification on 46c6e1dc: bun test src/tools/task/todo-sync.test.ts src/hooks/todo-continuation-enforcer --bail (100 pass), bun test src/hooks/atlas --bail (91 pass), bunx tsc --noEmit, bun run build. @cubic-dev-ai please re-review.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@RaviTharuma I have started the AI code review. It will take a few minutes to complete.

@RaviTharuma
Copy link
Copy Markdown
Contributor Author

@code-yeongyu cubic's review point is fixed on the current PR head 46c6e1dc and I re-verified it fresh locally:

  • bun test src/tools/task/todo-sync.test.ts src/hooks/todo-continuation-enforcer --bail -> 100 pass, 0 fail
  • bun test src/hooks/atlas --bail -> 91 pass, 0 fail
  • bunx tsc --noEmit
  • bun run build

So the todo-sync change itself is clean on the current head. The remaining red GitHub test check is the mock-heavy Atlas import error (createInternalAgentTextPart export not found), but that is not reproducing locally on this same commit. I also tried re-running the failed GitHub job directly, but Actions returned 403 Must have admin rights to Repository for rerun-failed-jobs.

Could you re-run the failed CI job once from the maintainer side? If it reproduces after a clean re-run, I'll split that Atlas runner-specific failure into a separate follow-up immediately.

@RaviTharuma RaviTharuma changed the title fix(todo-sync): preserve missing task priority test(todo-sync): match required priority fallback Mar 25, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: This PR only updates test expectations to match existing runtime behavior, ensuring CI passes without modifying application logic.

@code-yeongyu code-yeongyu merged commit 087e33d into code-yeongyu:dev Mar 25, 2026
7 of 8 checks passed
@RaviTharuma RaviTharuma deleted the fix/todo-sync-priority-default branch March 28, 2026 08:19
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