Skip to content

feat(missions): per-mission taskPrefix override for triaged task ids#2347

Open
gsxdsm wants to merge 17 commits into
mainfrom
feat/per-mission-task-prefix-2334
Open

feat(missions): per-mission taskPrefix override for triaged task ids#2347
gsxdsm wants to merge 17 commits into
mainfrom
feat/per-mission-task-prefix-2334

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Maintainer re-land of #2334 (fork flexi767:feat/per-mission-task-prefix) after resolving merge conflicts with current main.

Fork push was unavailable despite maintainerCanModify, so this branch carries the conflict resolution.

Feature

  • Optional per-mission taskPrefix for triaged task ids (inherits project prefix when unset)
  • Dashboard MissionManager + routes + store/triage plumbing
  • Postgres migration for project.missions.task_prefix

Conflict resolution

  • Main claimed migration 0026 (bigint counters) and 0027 (workflow IR pin)
  • Mission task-prefix migration renumbered 0026 → 0028
  • Baseline 0000_initial.sql includes task_prefix on missions
  • legacy.ts keeps code-org re-exports; missions.ts carries taskPrefix on create/update types

Test plan

  • CI green (lint/typecheck/build/gate)
  • Create mission with custom prefix; triage feature → task ids use that prefix
  • Clear mission prefix via PATCH null; new tasks inherit project prefix

Closes / supersedes #2334 once this lands (or re-point the fork PR).

Summary by CodeRabbit

  • New Features
    • Missions can now set an optional per-mission task ID prefix (overriding the project default).
    • Added task prefix support to mission create/edit UI and dashboard APIs, including normalized uppercase values and validation.
  • Bug Fixes
    • Improved commit hook generation for custom prefixes and special characters, with safer shell handling to prevent unsafe interpretation.
  • Chores
    • Added PostgreSQL migration and schema-applier support to persist and propagate mission task prefixes, including upgrade/backfill coverage.
  • Tests
    • Added backend and UI/API test coverage for task-prefix creation, clearing, and ID minting behavior.

fusion-merge-train and others added 13 commits July 6, 2026 11:42
Add an optional `taskPrefix` field on Mission so a single mission's tickets
can use a distinct id prefix (e.g. ERR-) while the rest of the board keeps the
project-wide prefix (default FN-). Previously taskPrefix was project-scoped
only; flipping it changed every new ticket board-wide including autopilot.

The distributed id allocator was already multi-prefix, so this only threads a
per-mission prefix through triage:
- Mission.taskPrefix (nullable) persisted via a new additive migration (v140).
- MissionStore.triageFeature passes it into TaskCreateInput.taskPrefix (a
  transient minting hint, not persisted on the task).
- createTaskWithDistributedReservation prefers input.taskPrefix over settings.
- buildCommitMsgTrailerHook derives the strip PREFIX from the task id itself
  rather than the project-wide option, so ERR-5 strips correctly while the
  project prefix is still FN (fixes all engine call sites at once).
- Mission create + edit UI (MissionManager) exposes a Task prefix input;
  mission-routes POST/PATCH validate it (letter-led alphanumeric, uppercased).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-prefix

# Conflicts:
#	packages/core/src/db.ts
…ck prefix

Address greptile feedback on PR #1930:
- Mission edit save sends taskPrefix:null when the field is cleared so JSON
  retains the key and PATCH clears the stored mission override.
- Commit-msg hook quotes "$PREFIX" in case and escapes sed ERE metacharacters
  on the options.taskPrefix fallback path.
…efix

Rebase the feat/per-mission-task-prefix work onto main after the SQLite→PostgreSQL
cutover. Take main's stubbed db.ts and modular store.ts, then re-port the feature:

- missions.task_prefix column (schema + migration 0008 + schema-applier)
- AsyncMissionStore CRUD/upsert/triage threads Mission.taskPrefix
- createTaskBackend + createTaskWithDistributedReservation honor input.taskPrefix
- Keep greptile fixes: null PATCH clear, commit-msg prefix escape/quote
- Port mission taskPrefix tests to PG harness; mock dashboard route tests

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
escapeSedEre left `/` raw, so a fallback prefix like TEAM/API produced invalid
sed `s/^TEAM/API-//i` and could abort the commit-msg hook. Escape `/` with the
other ERE metacharacters; cover with a unit test.

Greptile: databaseId 3583850800 on PR #1930.
MissionManager state used mission-types.MissionWithSummary while fetchMissions
returned api/legacy.MissionWithSummary. taskPrefix was string vs string|null,
so the Array.isArray ternary widened to a dual-array union and failed setState
(TS2345). Align component Mission.taskPrefix with the API and annotate the
normalized list as MissionWithSummary[].
JSON.stringify produced PREFIX="$(id)" which /bin/sh expands via command
substitution when the commit-msg hook runs. Emit POSIX single-quoted
literals via shellSingleQuote (embedded ' → '\''). Apply the same quoting
to TRAILER_NAME and CO_AUTHOR_TRAILER. Cover $(id), ; rm -rf, and O'Brien.

Greptile P1 security: databaseIds 3583890011, 3583943640 on PR #1930.
…to 0028

Main claimed migration 0026 (bigint counters) and 0027 (workflow IR pin).
Keep the mission task_prefix feature as 0028, wire it after those migrations,
update the 0000 baseline, and restore missions.ts taskPrefix on the code-org
API surface after legacy.ts re-exports.
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Too many files!

This PR contains 457 files, which is 307 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

Usage-priced reviews support at most 300 files.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d1581bb1-8c41-47cf-8995-ef0777cf65ec

📥 Commits

Reviewing files that changed from the base of the PR and between 9cde98e and 644f497.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (460)
  • .changeset/FN-8399-migration-status-dashboard.md
  • .changeset/FN-8436-planning-no-reconnecting-hint.md
  • .changeset/beta-stable-release-channels.md
  • .changeset/fix-github-discussions-force-mode.md
  • .changeset/fix-pooled-worktree-ownership.md
  • .changeset/fix-task-done-summary-prose.md
  • .changeset/fix-zh-cn-roadmap-duplicate.md
  • .changeset/fn-8306-mission-symbol-scheduler-admission.md
  • .changeset/fn-8307-heartbeat-mission-guard.md
  • .changeset/fn-8308-report-discussions.md
  • .changeset/fn-8310-public-roadmap-dedupe.md
  • .changeset/fn-8327-discussion-fallback.md
  • .changeset/fn-8358-roadmap-item-native-structure-preview.md
  • .changeset/fn-8364-session-token-deltas.md
  • .changeset/fn-8369-github-import-dedup.md
  • .changeset/fn-8372-html2canvas.md
  • .changeset/fn-8395-settings-autosave.md
  • .changeset/fn-8396-task-detail-tablet-icon-size.md
  • .changeset/fn-8397-chat-pin-separation-and-edit-save.md
  • .changeset/fn-8398-compound-engineering-nav.md
  • .changeset/fn-8400-planning-mode-ui.md
  • .changeset/fn-8400-worktree-recovery.md
  • .changeset/fn-8401-same-agent-intake.md
  • .changeset/fn-8406-report-home-zindex.md
  • .changeset/fn-8409-chat-coding-tools.md
  • .changeset/fn-8411-configversions-i18n.md
  • .changeset/fn-8413-pi-claude-cli-acp-sdk-dep.md
  • .changeset/fn-8414-mission-interview-thinking-level-bind.md
  • .changeset/fn-8415-report-file-activity-trace-scrub.md
  • .changeset/fn-8418-whatsapp-settings-pairing.md
  • .changeset/fn-8419-rekey-partition-merge.md
  • .changeset/fn-8420-planning-mode-user-validation.md
  • .changeset/fn-8421-task-detail-tablet-control-heights.md
  • .changeset/fn-8422-mcp-bridge.md
  • .changeset/fn-8423-duplicate-agent-badge.md
  • .changeset/fn-8424-cli-chat-reply-routing.md
  • .changeset/fn-8425-cli-chat-conversation.md
  • .changeset/fn-8426-planning-mobile-tablet-layout.md
  • .changeset/fn-8427-planning-mobile-session-list-nav.md
  • .changeset/fn-8430-tui-log-timestamps.md
  • .changeset/fn-8431-report-menu-background.md
  • .changeset/fn-8432-planning-tablet-mobile-plan-layout.md
  • .changeset/fn-8434-running-plan-content.md
  • .changeset/fn-8437-planning-leave-return-restore.md
  • .changeset/fn-8438-running-plan-generate-refine.md
  • .changeset/fn-8440-persist-duplicate-decision.md
  • .changeset/fn-8441-separate-plan-from-prompt.md
  • .changeset/fn-8443-chat-plugin-skill-paths.md
  • .changeset/github-report-screenshot-embed.md
  • .changeset/mission-task-prefix.md
  • .changeset/plan-review-root-lease-cleanup.md
  • .changeset/planning-turn-sync.md
  • .changeset/postgres-health-false-corruption.md
  • .changeset/quiet-triage-recovery.md
  • .changeset/report-screenshot-artifacts.md
  • .changeset/task-verification-status-placement.md
  • .github/workflows/pr-checks.yml
  • .github/workflows/release.yml
  • .github/workflows/version.yml
  • AGENTS.md
  • MOBILE.md
  • RELEASING.md
  • docs/agents.md
  • docs/architecture.md
  • docs/cli-reference.md
  • docs/dashboard-guide.md
  • docs/grok-cli-contract.md
  • docs/missions.md
  • docs/plans/2026-07-19-001-beta-stable-release-tracks-plan.md
  • docs/plugin-management.md
  • docs/settings-reference.md
  • docs/storage.md
  • docs/task-management.md
  • package.json
  • packages/cli/package.json
  • packages/cli/skill/fusion/references/extension-tools.md
  • packages/cli/skill/fusion/references/fusion-capabilities.md
  • packages/cli/src/__tests__/bin-chat-args.test.ts
  • packages/cli/src/__tests__/bundle-output.test.ts
  • packages/cli/src/__tests__/extension-dist-barrel.test.ts
  • packages/cli/src/__tests__/extension.test.ts
  • packages/cli/src/__tests__/package-config.test.ts
  • packages/cli/src/__tests__/pi-claude-cli-publish-resolve.smoke.test.ts
  • packages/cli/src/bin.ts
  • packages/cli/src/commands/__tests__/agent.test.ts
  • packages/cli/src/commands/__tests__/chat.test.ts
  • packages/cli/src/commands/__tests__/dashboard-supervise.test.ts
  • packages/cli/src/commands/__tests__/message.test.ts
  • packages/cli/src/commands/__tests__/task-lock-retry.test.ts
  • packages/cli/src/commands/__tests__/task.test.ts
  • packages/cli/src/commands/__tests__/update.test.ts
  • packages/cli/src/commands/agent.ts
  • packages/cli/src/commands/chat.ts
  • packages/cli/src/commands/daemon.ts
  • packages/cli/src/commands/dashboard-tui/__tests__/app.test.tsx
  • packages/cli/src/commands/dashboard-tui/app.tsx
  • packages/cli/src/commands/dashboard.ts
  • packages/cli/src/commands/desktop.ts
  • packages/cli/src/commands/message.ts
  • packages/cli/src/commands/serve.ts
  • packages/cli/src/commands/update.ts
  • packages/cli/src/extension.ts
  • packages/cli/src/update-cache.ts
  • packages/cli/vitest.config.ts
  • packages/core/src/__tests__/agent-role-policy.test.ts
  • packages/core/src/__tests__/app-version.test.ts
  • packages/core/src/__tests__/delete-task-if-planning.test.ts
  • packages/core/src/__tests__/duplicate-intake.test.ts
  • packages/core/src/__tests__/gh-cli-input.test.ts
  • packages/core/src/__tests__/move-task-if-planning.test.ts
  • packages/core/src/__tests__/planning-plan-md.test.ts
  • packages/core/src/__tests__/postgres/command-center-remaining-analytics.pg.test.ts
  • packages/core/src/__tests__/postgres/mission-store.pg.test.ts
  • packages/core/src/__tests__/postgres/schema-applier.test.ts
  • packages/core/src/__tests__/postgres/sqlite-migration-state.test.ts
  • packages/core/src/__tests__/same-agent-duplicate-intake.test.ts
  • packages/core/src/__tests__/settings-parity.test.ts
  • packages/core/src/__tests__/symbol-lock-lineage-approval.test.ts
  • packages/core/src/__tests__/symbol-locks.test.ts
  • packages/core/src/__tests__/task-symbol-resolution.test.ts
  • packages/core/src/agent-role-policy.ts
  • packages/core/src/app-version.ts
  • packages/core/src/async-mission-store-queries.ts
  • packages/core/src/async-mission-store.ts
  • packages/core/src/async-secrets-store.ts
  • packages/core/src/command-center-live.ts
  • packages/core/src/duplicate-intake.ts
  • packages/core/src/gh-cli.ts
  • packages/core/src/index.gate.ts
  • packages/core/src/index.ts
  • packages/core/src/mission-store.ts
  • packages/core/src/mission-types.ts
  • packages/core/src/planning-plan-md.ts
  • packages/core/src/postgres-errors.ts
  • packages/core/src/postgres/index.ts
  • packages/core/src/postgres/migration-stamping.ts
  • packages/core/src/postgres/migrations/0000_initial.sql
  • packages/core/src/postgres/migrations/0028_task_declared_symbols.sql
  • packages/core/src/postgres/migrations/0029_mission_task_prefix.sql
  • packages/core/src/postgres/schema-applier.ts
  • packages/core/src/postgres/schema/project.ts
  • packages/core/src/postgres/sqlite-migrator.ts
  • packages/core/src/postgres/startup-factory.ts
  • packages/core/src/process-supervisor.ts
  • packages/core/src/settings-schema.ts
  • packages/core/src/store.ts
  • packages/core/src/symbol-lock-lineage-approval.ts
  • packages/core/src/task-store/__tests__/task-prefix.test.ts
  • packages/core/src/task-store/archive-lifecycle-2.ts
  • packages/core/src/task-store/archive-lifecycle.ts
  • packages/core/src/task-store/async-persistence.ts
  • packages/core/src/task-store/moves.ts
  • packages/core/src/task-store/persistence.ts
  • packages/core/src/task-store/remaining-ops-2.ts
  • packages/core/src/task-store/remaining-ops-4.ts
  • packages/core/src/task-store/serialization.ts
  • packages/core/src/task-store/task-creation.ts
  • packages/core/src/task-store/task-prefix.ts
  • packages/core/src/task-store/task-row-mappers.ts
  • packages/core/src/task-store/task-update.ts
  • packages/core/src/task-symbol-resolution.ts
  • packages/core/src/types.ts
  • packages/core/src/types/messages.ts
  • packages/dashboard/app/App.tsx
  • packages/dashboard/app/__tests__/browser-layout-smoke-fixture.test.ts
  • packages/dashboard/app/api/health.ts
  • packages/dashboard/app/api/legacy.ts
  • packages/dashboard/app/api/missions.ts
  • packages/dashboard/app/api/report.ts
  • packages/dashboard/app/components/ChatView.css
  • packages/dashboard/app/components/ChatView.tsx
  • packages/dashboard/app/components/DbCorruptionBanner.tsx
  • packages/dashboard/app/components/Header.tsx
  • packages/dashboard/app/components/LeftSidebarNav.tsx
  • packages/dashboard/app/components/MailboxArtifactAttachment.tsx
  • packages/dashboard/app/components/MailboxModal.css
  • packages/dashboard/app/components/MailboxModal.tsx
  • packages/dashboard/app/components/MailboxRelatedWorkLink.tsx
  • packages/dashboard/app/components/MailboxView.tsx
  • packages/dashboard/app/components/MissionInterviewModal.tsx
  • packages/dashboard/app/components/MissionManager.tsx
  • packages/dashboard/app/components/NativeStructurePreview.tsx
  • packages/dashboard/app/components/PlanningModeModal.css
  • packages/dashboard/app/components/PlanningModeModal.tsx
  • packages/dashboard/app/components/PluginManager.tsx
  • packages/dashboard/app/components/ReportActionMenu.css
  • packages/dashboard/app/components/ReportActionMenu.tsx
  • packages/dashboard/app/components/ReportModal.css
  • packages/dashboard/app/components/ReportModal.tsx
  • packages/dashboard/app/components/SettingsModal.tsx
  • packages/dashboard/app/components/StandardChatSurface.tsx
  • packages/dashboard/app/components/TaskCard.tsx
  • packages/dashboard/app/components/TaskDetailModal.css
  • packages/dashboard/app/components/TaskDetailModal.tsx
  • packages/dashboard/app/components/TaskPlannerChatTab.css
  • packages/dashboard/app/components/TaskPlannerChatTab.tsx
  • packages/dashboard/app/components/TaskVerificationStatus.tsx
  • packages/dashboard/app/components/WhatsAppChatPairingPanel.css
  • packages/dashboard/app/components/WhatsAppChatPairingPanel.tsx
  • packages/dashboard/app/components/__tests__/App.test.tsx
  • packages/dashboard/app/components/__tests__/ChatView.core-contracts.test.tsx
  • packages/dashboard/app/components/__tests__/ChatView.message-edit.test.tsx
  • packages/dashboard/app/components/__tests__/DbCorruptionBanner.test.tsx
  • packages/dashboard/app/components/__tests__/Header.test.tsx
  • packages/dashboard/app/components/__tests__/LeftSidebarNav.test.tsx
  • packages/dashboard/app/components/__tests__/MailboxModal.test.tsx
  • packages/dashboard/app/components/__tests__/MailboxRelatedWorkLink.test.tsx
  • packages/dashboard/app/components/__tests__/MailboxView.test.tsx
  • packages/dashboard/app/components/__tests__/MissionInterviewModal.test.tsx
  • packages/dashboard/app/components/__tests__/MissionManager.task-prefix.test.tsx
  • packages/dashboard/app/components/__tests__/MobileNavBar.test.tsx
  • packages/dashboard/app/components/__tests__/NativeStructurePreview.test.tsx
  • packages/dashboard/app/components/__tests__/PlanningModeModal.css.test.ts
  • packages/dashboard/app/components/__tests__/PlanningModeModal.initial.test.tsx
  • packages/dashboard/app/components/__tests__/PlanningModeModal.planning-flow.test.tsx
  • packages/dashboard/app/components/__tests__/PlanningModeModal.test-helpers.ts
  • packages/dashboard/app/components/__tests__/PlanningModeModal.ui-interactions.test.tsx
  • packages/dashboard/app/components/__tests__/PluginManager.test.tsx
  • packages/dashboard/app/components/__tests__/ReportActionMenu.test.tsx
  • packages/dashboard/app/components/__tests__/ReportModal.test.tsx
  • packages/dashboard/app/components/__tests__/SettingsModal.general.test.tsx
  • packages/dashboard/app/components/__tests__/SettingsModal.keyboardShortcuts.test.tsx
  • packages/dashboard/app/components/__tests__/SettingsModal.models-auth.test.tsx
  • packages/dashboard/app/components/__tests__/SettingsModal.remote-notifications.test.tsx
  • packages/dashboard/app/components/__tests__/SettingsModal.scheduling-merge.test.tsx
  • packages/dashboard/app/components/__tests__/SettingsModal.test-harness.tsx
  • packages/dashboard/app/components/__tests__/SettingsModalNodeRouting.test.tsx
  • packages/dashboard/app/components/__tests__/TaskCard.test.tsx
  • packages/dashboard/app/components/__tests__/TaskDetailModal.rendering.test.tsx
  • packages/dashboard/app/components/__tests__/TaskDetailModal.responsive-and-dependencies.test.tsx
  • packages/dashboard/app/components/__tests__/TaskDetailModal.tab-persistence.test.tsx
  • packages/dashboard/app/components/__tests__/TaskDetailModal.test-helpers.ts
  • packages/dashboard/app/components/__tests__/TaskPlannerChatTab.test.tsx
  • packages/dashboard/app/components/__tests__/TaskVerificationStatus.test.tsx
  • packages/dashboard/app/components/__tests__/WhatsAppChatPairingPanel.test.tsx
  • packages/dashboard/app/components/command-center/CommandCenter.tsx
  • packages/dashboard/app/components/command-center/MissionControlPanel.tsx
  • packages/dashboard/app/components/command-center/__tests__/CommandCenter.test.tsx
  • packages/dashboard/app/components/command-center/__tests__/SystemControlsArea.test.tsx
  • packages/dashboard/app/components/command-center/areas/SystemControlsArea.tsx
  • packages/dashboard/app/components/command-center/liveSnapshotMetrics.ts
  • packages/dashboard/app/components/dashboard/DashboardBanners.tsx
  • packages/dashboard/app/components/dashboard/MainContent.tsx
  • packages/dashboard/app/components/dashboard/__tests__/DashboardBanners.test.tsx
  • packages/dashboard/app/components/dashboard/__tests__/MainContent.mailbox-view-task.test.tsx
  • packages/dashboard/app/components/mission-types.ts
  • packages/dashboard/app/components/settings/__tests__/section-keys.test.ts
  • packages/dashboard/app/components/settings/save-split.ts
  • packages/dashboard/app/components/settings/section-keys.ts
  • packages/dashboard/app/components/settings/sections/GeneralSection.search.ts
  • packages/dashboard/app/components/settings/sections/GeneralSection.tsx
  • packages/dashboard/app/components/settings/sections/GlobalGeneralSection.search.ts
  • packages/dashboard/app/components/settings/sections/GlobalGeneralSection.tsx
  • packages/dashboard/app/components/settings/sections/ProjectModelsSection.tsx
  • packages/dashboard/app/components/settings/sections/SourceControlGlobalSection.search.ts
  • packages/dashboard/app/components/settings/sections/SourceControlGlobalSection.tsx
  • packages/dashboard/app/components/settings/sections/__tests__/GeneralSection.aiUndoWorkflow.test.tsx
  • packages/dashboard/app/components/settings/sections/__tests__/settings-default-descriptions.test.tsx
  • packages/dashboard/app/hooks/__tests__/modalPersistence.test.ts
  • packages/dashboard/app/hooks/__tests__/useAgents.test.ts
  • packages/dashboard/app/hooks/__tests__/useArtifacts.test.ts
  • packages/dashboard/app/hooks/__tests__/useChat.test.ts
  • packages/dashboard/app/hooks/__tests__/useDocuments.test.ts
  • packages/dashboard/app/hooks/__tests__/usePluginDashboardViews.test.ts
  • packages/dashboard/app/hooks/modalPersistence.ts
  • packages/dashboard/app/hooks/useAgents.ts
  • packages/dashboard/app/hooks/useArtifacts.ts
  • packages/dashboard/app/hooks/useChat.ts
  • packages/dashboard/app/hooks/useDocuments.ts
  • packages/dashboard/app/hooks/usePluginDashboardViews.ts
  • packages/dashboard/app/hooks/useProjectContextGuard.ts
  • packages/dashboard/app/planning-browser-e2e-fixture.html
  • packages/dashboard/app/planning-browser-e2e-fixture.tsx
  • packages/dashboard/app/plugins/__tests__/registerBundledPluginViews.test.tsx
  • packages/dashboard/app/plugins/registerBundledPluginViews.ts
  • packages/dashboard/app/styles.css
  • packages/dashboard/app/utils/__tests__/activity-trace.test.ts
  • packages/dashboard/app/utils/__tests__/projectStorage.test.ts
  • packages/dashboard/app/utils/projectStorage.ts
  • packages/dashboard/app/utils/report-capture.ts
  • packages/dashboard/app/utils/reportContextRefs.ts
  • packages/dashboard/package.json
  • packages/dashboard/scripts/browser-layout-smoke.mjs
  • packages/dashboard/src/__tests__/artifact-media.test.ts
  • packages/dashboard/src/__tests__/chat-manager.test.ts
  • packages/dashboard/src/__tests__/chat-system-prompt.test.ts
  • packages/dashboard/src/__tests__/dashboard-postgres-health.test.ts
  • packages/dashboard/src/__tests__/dev-server-process.test.ts
  • packages/dashboard/src/__tests__/github-discussions.test.ts
  • packages/dashboard/src/__tests__/github-upload-image-asset.test.ts
  • packages/dashboard/src/__tests__/github.test.ts
  • packages/dashboard/src/__tests__/mcp-documentation.test.ts
  • packages/dashboard/src/__tests__/mission-interview-thinking-level-bind.test.ts
  • packages/dashboard/src/__tests__/mission-task-prefix-routes.test.ts
  • packages/dashboard/src/__tests__/planning-browser-e2e.test.ts
  • packages/dashboard/src/__tests__/planning-e2e-plan-creation.test.ts
  • packages/dashboard/src/__tests__/planning-infinite-interview.test.ts
  • packages/dashboard/src/__tests__/planning-interview-formatters.test.ts
  • packages/dashboard/src/__tests__/report-pipeline-screenshots.test.ts
  • packages/dashboard/src/__tests__/report-pipeline.test.ts
  • packages/dashboard/src/__tests__/report-routes.test.ts
  • packages/dashboard/src/__tests__/report-scrub.test.ts
  • packages/dashboard/src/__tests__/routes-context-project-identity.test.ts
  • packages/dashboard/src/__tests__/routes-github.test.ts
  • packages/dashboard/src/__tests__/routes-planning.test.ts
  • packages/dashboard/src/__tests__/routes-system.test.ts
  • packages/dashboard/src/__tests__/update-check.test.ts
  • packages/dashboard/src/artifact-media.ts
  • packages/dashboard/src/chat.ts
  • packages/dashboard/src/dashboard-postgres-health.ts
  • packages/dashboard/src/dev-server-process.ts
  • packages/dashboard/src/github.ts
  • packages/dashboard/src/index.ts
  • packages/dashboard/src/issue-image-attachments.ts
  • packages/dashboard/src/mission-interview.ts
  • packages/dashboard/src/mission-routes.ts
  • packages/dashboard/src/native-structure-preview.ts
  • packages/dashboard/src/planning.ts
  • packages/dashboard/src/report-pipeline.ts
  • packages/dashboard/src/routes.ts
  • packages/dashboard/src/routes/README.md
  • packages/dashboard/src/routes/__tests__/create-api-routes-mount-order.test.ts
  • packages/dashboard/src/routes/__tests__/native-structure-preview-routes.test.ts
  • packages/dashboard/src/routes/__tests__/register-ai-text-assistant-routes.test.ts
  • packages/dashboard/src/routes/__tests__/register-config-mcp-pi-settings-routes.test.ts
  • packages/dashboard/src/routes/__tests__/register-setup-activity-routes.test.ts
  • packages/dashboard/src/routes/__tests__/register-system-maintenance-routes.test.ts
  • packages/dashboard/src/routes/automation-live-run.ts
  • packages/dashboard/src/routes/automation-step-execution.ts
  • packages/dashboard/src/routes/create-api-routes-mount-sequence.ts
  • packages/dashboard/src/routes/plugin-bundled-runtimes.ts
  • packages/dashboard/src/routes/register-ai-text-assistant-routes.ts
  • packages/dashboard/src/routes/register-config-mcp-pi-settings-routes.ts
  • packages/dashboard/src/routes/register-planning-subtask-routes.ts
  • packages/dashboard/src/routes/register-plugins-automation.ts
  • packages/dashboard/src/routes/register-report-routes.ts
  • packages/dashboard/src/routes/register-setup-activity-routes.ts
  • packages/dashboard/src/routes/register-system-maintenance-routes.ts
  • packages/dashboard/src/routes/register-task-workflow-routes.ts
  • packages/dashboard/src/routes/register-update-check-routes.ts
  • packages/dashboard/src/server.ts
  • packages/dashboard/src/update-check.ts
  • packages/dashboard/vite.config.ts
  • packages/dashboard/vitest.config.ts
  • packages/desktop/src/native.ts
  • packages/engine/src/__tests__/agent-action-gate.test.ts
  • packages/engine/src/__tests__/agent-session-helpers.test.ts
  • packages/engine/src/__tests__/agent-tools-delegation.test.ts
  • packages/engine/src/__tests__/agent-tools-read-messages.test.ts
  • packages/engine/src/__tests__/agent-tools-send-message-recipient-validation.test.ts
  • packages/engine/src/__tests__/engine-no-blocking-shellout.test.ts
  • packages/engine/src/__tests__/executor-archive-releases-active-session.test.ts
  • packages/engine/src/__tests__/executor-task-done-dissent-guard.test.ts
  • packages/engine/src/__tests__/executor-task-done-premise-stale.test.ts
  • packages/engine/src/__tests__/executor-task-done-shared-helper.test.ts
  • packages/engine/src/__tests__/executor-token-usage.test.ts
  • packages/engine/src/__tests__/executor-worktree-conflict.test.ts
  • packages/engine/src/__tests__/executor-worktree.test.ts
  • packages/engine/src/__tests__/gating-classifications.test.ts
  • packages/engine/src/__tests__/heartbeat-executor.test.ts
  • packages/engine/src/__tests__/mission-feature-sync.test.ts
  • packages/engine/src/__tests__/mission-symbol-admission.test.ts
  • packages/engine/src/__tests__/permanent-agent-gating.test.ts
  • packages/engine/src/__tests__/pi.test.ts
  • packages/engine/src/__tests__/reliability-interactions/explicit-duplicate-marker-sweep.test.ts
  • packages/engine/src/__tests__/reliability-interactions/graph-node-missing-worktree-recovery.test.ts
  • packages/engine/src/__tests__/reliability-interactions/merge-reuse-task-worktree.slow.test.ts
  • packages/engine/src/__tests__/reliability-interactions/precommit-identity-guard.real-git.test.ts
  • packages/engine/src/__tests__/reliability-interactions/task-done-refusal-x-invariant.test.ts
  • packages/engine/src/__tests__/restart.integration.test.ts
  • packages/engine/src/__tests__/scheduler-workflow-cutover.test.ts
  • packages/engine/src/__tests__/self-healing-advanced-triage.test.ts
  • packages/engine/src/__tests__/self-healing-db-corruption.test.ts
  • packages/engine/src/__tests__/self-healing.test.ts
  • packages/engine/src/__tests__/session-token-usage.test.ts
  • packages/engine/src/__tests__/triage-explicit-duplicate-marker.test.ts
  • packages/engine/src/__tests__/triage.test.ts
  • packages/engine/src/__tests__/user-configured-command-no-execsync.test.ts
  • packages/engine/src/__tests__/workflow-graph-optional-step-fix.test.ts
  • packages/engine/src/__tests__/workflow-work-processor.test.ts
  • packages/engine/src/__tests__/workflow-work-scheduler.test.ts
  • packages/engine/src/__tests__/worktree-hooks.test.ts
  • packages/engine/src/__tests__/worktree-pinning.test.ts
  • packages/engine/src/__tests__/worktree-primary-checkout-invariant.test.ts
  • packages/engine/src/__tests__/worktree-reclaim-placement.real-git.test.ts
  • packages/engine/src/agent-action-gate.ts
  • packages/engine/src/agent-heartbeat-prompts.ts
  • packages/engine/src/agent-heartbeat.ts
  • packages/engine/src/agent-session-helpers.ts
  • packages/engine/src/agent-tools.ts
  • packages/engine/src/executor.ts
  • packages/engine/src/gating-classifications.ts
  • packages/engine/src/merger-git-parse.ts
  • packages/engine/src/merger-workspace-test-commands.ts
  • packages/engine/src/mission-feature-sync.ts
  • packages/engine/src/mission-symbol-admission.ts
  • packages/engine/src/permanent-agent-gating.ts
  • packages/engine/src/pi.ts
  • packages/engine/src/planner-overseer.ts
  • packages/engine/src/project-engine-manager.ts
  • packages/engine/src/project-runtime.ts
  • packages/engine/src/review-artifacts/feature-video.test.ts
  • packages/engine/src/runtimes/in-process-runtime.ts
  • packages/engine/src/scheduler.ts
  • packages/engine/src/self-healing.ts
  • packages/engine/src/session-token-usage.ts
  • packages/engine/src/step-session-executor.ts
  • packages/engine/src/triage.ts
  • packages/engine/src/workflow-work-processor.ts
  • packages/engine/src/workflow-work-scheduler.ts
  • packages/engine/src/worktree-acquisition.ts
  • packages/engine/src/worktree-hooks.ts
  • packages/engine/src/worktree-pinning.ts
  • packages/engine/src/worktree-pool.ts
  • packages/engine/vitest.config.ts
  • packages/i18n/locales/en/app.json
  • packages/i18n/locales/es/app.json
  • packages/i18n/locales/fr/app.json
  • packages/i18n/locales/ko/app.json
  • packages/i18n/locales/zh-CN/app.json
  • packages/i18n/locales/zh-TW/app.json
  • packages/i18n/src/__tests__/db-banner-catalog.test.ts
  • packages/i18n/src/resources.d.ts
  • plugins/fusion-plugin-claude-runtime/README.md
  • plugins/fusion-plugin-claude-runtime/package.json
  • plugins/fusion-plugin-claude-runtime/src/__tests__/runtime-adapter.test.ts
  • plugins/fusion-plugin-claude-runtime/src/__tests__/tool-bridge.test.ts
  • plugins/fusion-plugin-claude-runtime/src/runtime-adapter.ts
  • plugins/fusion-plugin-claude-runtime/src/tool-bridge.ts
  • plugins/fusion-plugin-claude-runtime/src/types.ts
  • plugins/fusion-plugin-grok-runtime/package.json
  • plugins/fusion-plugin-grok-runtime/src/__tests__/process-lifecycle.test.ts
  • plugins/fusion-plugin-grok-runtime/src/__tests__/runtime-adapter.test.ts
  • plugins/fusion-plugin-grok-runtime/src/__tests__/tool-bridge.test.ts
  • plugins/fusion-plugin-grok-runtime/src/runtime-adapter.ts
  • plugins/fusion-plugin-grok-runtime/src/tool-bridge.ts
  • plugins/fusion-plugin-grok-runtime/src/types.ts
  • plugins/fusion-plugin-grok-runtime/vitest.config.ts
  • plugins/fusion-plugin-quality/src/__tests__/async-quality-store.pg.test.ts
  • plugins/fusion-plugin-quality/vitest.config.ts
  • plugins/fusion-plugin-roadmap/package.json
  • plugins/fusion-plugin-roadmap/src/dashboard-view.tsx
  • plugins/fusion-plugin-roadmap/src/index.ts
  • plugins/fusion-plugin-whatsapp-chat/README.md
  • plugins/fusion-plugin-whatsapp-chat/src/__tests__/connection.test.ts
  • plugins/fusion-plugin-whatsapp-chat/src/__tests__/index.test.ts
  • plugins/fusion-plugin-whatsapp-chat/src/connection.ts
  • plugins/fusion-plugin-whatsapp-chat/src/index.ts
  • scripts/__tests__/changeset-schema.test.mjs
  • scripts/__tests__/check-no-node-only-core-imports-in-dashboard.test.mjs
  • scripts/__tests__/check-routes-modular.test.mjs
  • scripts/check-no-node-only-core-imports-in-dashboard.mjs
  • scripts/check-routes-modular.mjs
  • scripts/ci-distill-release-notes.mjs
  • scripts/lib/changeset-schema.mjs
  • scripts/lib/dashboard-browser-safe-core-modules.json
  • scripts/lib/routes-modular-baseline.json
  • scripts/lib/test-quarantine.json
  • scripts/line-count-baseline.json
  • scripts/release.mjs

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

Changes

Mission task prefixes can now be configured per mission, persisted in PostgreSQL, validated and edited in the dashboard, propagated during triage, used for task ID allocation, and safely incorporated into generated commit hooks.

Mission task prefix support

Layer / File(s) Summary
Mission persistence and migration
packages/core/src/mission-types.ts, packages/core/src/mission-store.ts, packages/core/src/async-mission-store*, packages/core/src/postgres/*, packages/core/src/__tests__/postgres/*
Adds nullable mission prefix storage, migration 0028, schema-applier bookkeeping, query/store handling, and PostgreSQL coverage.
Triage task prefix propagation
packages/core/src/types.ts, packages/core/src/async-mission-store.ts, packages/core/src/mission-store.ts, packages/core/src/task-store/*, packages/core/src/__tests__/postgres/mission-store.pg.test.ts
Passes mission prefixes into task creation and prefers them during standard and distributed task ID reservation.
Dashboard prefix validation and editing
packages/dashboard/app/api/missions.ts, packages/dashboard/app/components/*, packages/dashboard/src/mission-routes.ts, packages/dashboard/src/__tests__/*
Adds dashboard form fields, normalization, validation, create/update payload semantics, and route/UI tests for clearing and invalid values.
Commit hook prefix handling
packages/engine/src/worktree-hooks.ts, packages/engine/src/__tests__/worktree-hooks.test.ts
Derives prefixes from task IDs and safely quotes and escapes generated shell and sed expressions.
Release note
.changeset/mission-task-prefix.md
Adds a minor release note describing mission-level task prefix overrides and propagation.

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

Sequence Diagram(s)

sequenceDiagram
  participant MissionManager
  participant MissionRoutes
  participant MissionStore
  participant TaskStore
  participant CommitHook
  MissionManager->>MissionRoutes: submit taskPrefix
  MissionRoutes->>MissionStore: create or update mission
  MissionStore-->>MissionManager: mission with taskPrefix
  MissionStore->>TaskStore: triage feature with taskPrefix
  TaskStore-->>MissionStore: prefixed task ID
  CommitHook->>CommitHook: derive and escape task prefix
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.63% 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 title clearly matches the main change: adding a per-mission taskPrefix override for triaged task IDs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/per-mission-task-prefix-2334

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.

@gsxdsm

gsxdsm commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Conflict-resolved re-land of #2334. Primary checkout remains on main; work was done in Orca worktree pr-2334-mission-task-prefix.

@greptile-apps

greptile-apps Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds an optional per-mission taskPrefix field that overrides the project-wide task prefix when triaging features into tasks. The field is nullable on update (PATCH null restores project-level inheritance) and is plumbed end-to-end through the Postgres migration (0028), Drizzle schema, SQLite and async store queries, the dashboard API and route validator, MissionManager form, and the distributed task-ID allocator.

  • Schema & migration: task_prefix text added to project.missions in 0000_initial.sql and via standalone 0028_mission_task_prefix.sql; SCHEMA_BASELINE_VERSION advances to 0028; applySchemaBaseline independently applies and bookmarks the migration so existing databases that already recorded 0027 still receive the column.
  • Prefix resolution: a new resolveTaskPrefix(hint, settings, fallback) helper centralises the priority order (mission hint → project settings → path-specific fallback) for both createTaskWithDistributedReservation (FN default) and createTaskBackend (KB default), preventing the two paths from drifting.
  • Commit-hook security: buildCommitMsgTrailerHook now derives the strip prefix from the task-ID itself (so an ERR-5 task in an FN-prefixed project strips ERR- correctly), single-quotes all shell variable assignments to prevent $() / backtick expansion, and applies escapeSedEre to protect /-delimited sed -E substitutions from ERE metacharacters in the fallback prefix path.

Confidence Score: 5/5

The change is safe to merge: it is strictly additive (nullable column, no backfill), the migration is independently bookmarked so upgrade and fresh-install paths diverge correctly, and all three data paths (create, update-set, update-clear) are covered by integration and route-level tests.

Both issues flagged in previous review rounds are addressed. The null-clear distinction (PATCH null to DB NULL) is correctly implemented and verified by route and component tests. The commit-hook shell-injection vectors are closed via single-quoting and ERE escaping. No new correctness or security issues found.

No files require special attention. All changed files have clear, consistent handling of the nullable prefix field.

Important Files Changed

Filename Overview
packages/engine/src/worktree-hooks.ts Replaces double-quoted shell variable assignments with POSIX single-quoted literals and adds ERE-escaped sed substitution; derives strip prefix from the task-ID itself so per-mission prefixes work correctly in the commit-msg hook.
packages/core/src/task-store/task-prefix.ts New shared helper resolveTaskPrefix(hint, settings, fallback) extracts the priority-ordered prefix resolution previously duplicated between the FN and KB task-creation paths.
packages/dashboard/src/mission-routes.ts Adds validateTaskPrefix to POST and PATCH handlers; null/empty normalises to undefined so the store writes NULL, while an omitted PATCH key is correctly distinguished from an explicit null-clear.
packages/core/src/postgres/schema-applier.ts Exports MISSION_TASK_PREFIX_VERSION = 0028, advances SCHEMA_BASELINE_VERSION, and applies the migration independently so existing databases that recorded 0027 still receive missions.task_prefix.
packages/core/src/async-mission-store-queries.ts Adds taskPrefix to MissionRow, missionColumns, rowToMission (using ?? undefined correctly), createMission, updateMission, and upsertMission.

Reviews (3): Last reviewed commit: "refactor(missions): share resolveTaskPre..." | Re-trigger Greptile

Comment thread packages/core/src/__tests__/postgres/schema-applier.test.ts
Comment thread packages/core/src/async-mission-store-queries.ts Outdated
Delete fusion_schema_migrations version 0028 (not 0026) when simulating a
pre-mission-prefix cluster so applySchemaBaseline re-applies the migration.
Map row.taskPrefix with ?? like other nullable text fields.
@gsxdsm

gsxdsm commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Review feedback addressed in 6e5fd9b7b

  1. P1 — pre-0028 upgrade test deletes version 0028 (not 0026) so task-prefix migration re-applies
  2. P2taskPrefix: row.taskPrefix ?? undefined in rowToMission

Match async-mission-store-queries rowToMission so empty-string rows stay
distinguishable if validation ever relaxes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/core/src/task-store/remaining-ops-4.ts (1)

178-179: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the shared per-mission task-prefix resolution logic. Both call sites independently reimplement input.taskPrefix?.trim() || settings.taskPrefix || FALLBACK).trim().toUpperCase(); a single helper (parameterized by fallback) would remove the duplication and prevent the two sites from drifting when this rule changes again.

  • packages/core/src/task-store/remaining-ops-4.ts#L178-L179: replace the inline expression with a call to a shared resolveTaskPrefix(input.taskPrefix, settings.taskPrefix, "FN") helper.
  • packages/core/src/task-store/task-creation.ts#L196-L197: replace the inline expression with a call to the same shared helper, passing "KB" as the fallback.
♻️ Proposed shared helper
+// e.g. in a shared task-id-allocation module
+export function resolveTaskPrefix(
+  taskPrefixHint: string | undefined,
+  settingsTaskPrefix: string | undefined,
+  fallback: string,
+): string {
+  return (taskPrefixHint?.trim() || settingsTaskPrefix || fallback).trim().toUpperCase();
+}
-    const prefix = (input.taskPrefix?.trim() || settings.taskPrefix || "FN").trim().toUpperCase();
+    const prefix = resolveTaskPrefix(input.taskPrefix, settings.taskPrefix, "FN");
-    const prefix = (input.taskPrefix?.trim() || settings.taskPrefix || "KB").trim().toUpperCase();
+    const prefix = resolveTaskPrefix(input.taskPrefix, settings.taskPrefix, "KB");
🤖 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 `@packages/core/src/task-store/remaining-ops-4.ts` around lines 178 - 179,
Extract the duplicated task-prefix normalization into a shared resolveTaskPrefix
helper, parameterized by the input prefix, settings prefix, and fallback. In
packages/core/src/task-store/remaining-ops-4.ts:178-179, replace the inline
expression with resolveTaskPrefix(input.taskPrefix, settings.taskPrefix, "FN");
in packages/core/src/task-store/task-creation.ts:196-197, make the same
replacement using "KB". Preserve trimming, fallback selection, and uppercase
normalization.
🤖 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.

Nitpick comments:
In `@packages/core/src/task-store/remaining-ops-4.ts`:
- Around line 178-179: Extract the duplicated task-prefix normalization into a
shared resolveTaskPrefix helper, parameterized by the input prefix, settings
prefix, and fallback. In
packages/core/src/task-store/remaining-ops-4.ts:178-179, replace the inline
expression with resolveTaskPrefix(input.taskPrefix, settings.taskPrefix, "FN");
in packages/core/src/task-store/task-creation.ts:196-197, make the same
replacement using "KB". Preserve trimming, fallback selection, and uppercase
normalization.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 20d6742c-16a1-4ba9-87ab-d6f89e1dd4e1

📥 Commits

Reviewing files that changed from the base of the PR and between 048ae90 and 71b624c.

📒 Files selected for processing (23)
  • .changeset/mission-task-prefix.md
  • packages/core/src/__tests__/postgres/mission-store.pg.test.ts
  • packages/core/src/__tests__/postgres/schema-applier.test.ts
  • packages/core/src/async-mission-store-queries.ts
  • packages/core/src/async-mission-store.ts
  • packages/core/src/mission-store.ts
  • packages/core/src/mission-types.ts
  • packages/core/src/postgres/index.ts
  • packages/core/src/postgres/migrations/0000_initial.sql
  • packages/core/src/postgres/migrations/0028_mission_task_prefix.sql
  • packages/core/src/postgres/schema-applier.ts
  • packages/core/src/postgres/schema/project.ts
  • packages/core/src/task-store/remaining-ops-4.ts
  • packages/core/src/task-store/task-creation.ts
  • packages/core/src/types.ts
  • packages/dashboard/app/api/missions.ts
  • packages/dashboard/app/components/MissionManager.tsx
  • packages/dashboard/app/components/__tests__/MissionManager.task-prefix.test.tsx
  • packages/dashboard/app/components/mission-types.ts
  • packages/dashboard/src/__tests__/mission-task-prefix-routes.test.ts
  • packages/dashboard/src/mission-routes.ts
  • packages/engine/src/__tests__/worktree-hooks.test.ts
  • packages/engine/src/worktree-hooks.ts

Extract the input → settings → fallback prefix normalization used by
createTaskWithDistributedReservation (FN) and createTaskBackend (KB) so the
two sites cannot drift (CodeRabbit #2347).
@gsxdsm

gsxdsm commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

CodeRabbit review body addressed in 9cde98e9d

Extract the shared per-mission task-prefix resolution logic.

Added resolveTaskPrefix(hint, settingsPrefix, fallback) in packages/core/src/task-store/task-prefix.ts and wired both call sites:

  • remaining-ops-4.ts → fallback "FN"
  • task-creation.ts → fallback "KB"

Plus a small unit test for preference order / blank-hint / fallback.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@packages/core/src/task-store/__tests__/task-prefix.test.ts`:
- Around line 14-17: Add coverage in the resolveTaskPrefix tests for
whitespace-only settings values, asserting they fall back to the configured
default prefix rather than returning an empty result. Keep the existing
blank-hint cases and verify the general fallback behavior with a settings
argument containing only whitespace.

In `@packages/core/src/task-store/task-prefix.ts`:
- Line 13: Update the task-prefix resolution expression to trim
settingsTaskPrefix before applying precedence, so whitespace-only settings are
treated as unset and fallback is selected; preserve the existing uppercase
normalization and ensure both allocation callers receive a non-empty resolved
prefix. Add a regression test covering whitespace-only settingsTaskPrefix.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ccd6f486-dd65-44db-b589-65644e4e2978

📥 Commits

Reviewing files that changed from the base of the PR and between 71b624c and 9cde98e.

📒 Files selected for processing (4)
  • packages/core/src/task-store/__tests__/task-prefix.test.ts
  • packages/core/src/task-store/remaining-ops-4.ts
  • packages/core/src/task-store/task-creation.ts
  • packages/core/src/task-store/task-prefix.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/core/src/task-store/remaining-ops-4.ts
  • packages/core/src/task-store/task-creation.ts

Comment on lines +14 to +17
it("falls back to settings when the input hint is blank", () => {
expect(resolveTaskPrefix(" ", "fn-board", "KB")).toBe("FN-BOARD");
expect(resolveTaskPrefix(undefined, "fn-board", "KB")).toBe("FN-BOARD");
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add coverage for blank settings values.

The suite tests blank hints but not whitespace-only settings, so it would not catch the helper returning an empty prefix instead of the fallback.

Proposed test
   it("falls back to settings when the input hint is blank", () => {
     expect(resolveTaskPrefix("  ", "fn-board", "KB")).toBe("FN-BOARD");
     expect(resolveTaskPrefix(undefined, "fn-board", "KB")).toBe("FN-BOARD");
+    expect(resolveTaskPrefix(undefined, "  ", "KB")).toBe("KB");
   });

As per coding guidelines, regression tests should assert the general invariant and verify the original symptom is gone.

📝 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
it("falls back to settings when the input hint is blank", () => {
expect(resolveTaskPrefix(" ", "fn-board", "KB")).toBe("FN-BOARD");
expect(resolveTaskPrefix(undefined, "fn-board", "KB")).toBe("FN-BOARD");
});
it("falls back to settings when the input hint is blank", () => {
expect(resolveTaskPrefix(" ", "fn-board", "KB")).toBe("FN-BOARD");
expect(resolveTaskPrefix(undefined, "fn-board", "KB")).toBe("FN-BOARD");
expect(resolveTaskPrefix(undefined, " ", "KB")).toBe("KB");
});
🤖 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 `@packages/core/src/task-store/__tests__/task-prefix.test.ts` around lines 14 -
17, Add coverage in the resolveTaskPrefix tests for whitespace-only settings
values, asserting they fall back to the configured default prefix rather than
returning an empty result. Keep the existing blank-hint cases and verify the
general fallback behavior with a settings argument containing only whitespace.

Source: Coding guidelines

settingsTaskPrefix: string | undefined,
fallback: string,
): string {
return (taskPrefixHint?.trim() || settingsTaskPrefix || fallback).trim().toUpperCase();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Treat whitespace-only settings as unset.

settingsTaskPrefix is checked before trimming. For " ", this returns "" instead of the fallback, and both downstream allocation paths can receive an empty prefix. Trim each candidate before applying precedence and add a regression test.

The supplied callers pass this value directly to distributed task-ID allocation.

🤖 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 `@packages/core/src/task-store/task-prefix.ts` at line 13, Update the
task-prefix resolution expression to trim settingsTaskPrefix before applying
precedence, so whitespace-only settings are treated as unset and fallback is
selected; preserve the existing uppercase normalization and ensure both
allocation callers receive a non-empty resolved prefix. Add a regression test
covering whitespace-only settingsTaskPrefix.

@flexi767

Copy link
Copy Markdown
Contributor

I resolved the current main conflicts in #2365. The important semantic resolution is migration numbering: main now owns 0028_task_declared_symbols.sql, so the mission task-prefix migration is moved to 0029 instead of sharing the 0028 bookkeeping identity.

Direct push to this PR branch was rejected with a 403, so #2365 targets feat/per-mission-task-prefix-2334 and can be merged into this PR branch.

Resolves the current `main` conflicts in #2347.

Key resolution:
- preserves `main`'s task declared-symbol migration as `0028`
- renumbers the mission task-prefix migration to `0029` to avoid
duplicate migration bookkeeping identities
- preserves both task-creation imports and both migration-version
expectations

Validation:
- core, dashboard, and engine typechecks passed
- mission prefix core/dashboard/engine focused tests passed
- live PostgreSQL run: 99/100 tests passed; the sole failure is the
pre-existing `0026_bigint_counters.sql` fixture failure in the `0000`
automation-upgrade test

---------

Co-authored-by: gsxdsm <gsxdsm@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
Co-authored-by: Phil Larson <hello@phillarson.xyz>
Co-authored-by: v <v@v.speedport.ip>
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Too many files changed for review. (461 files found, 100 file limit)

Bypass the limit by tagging @greptile-apps to review.

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