You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Onboarding- Task "Set up categories and tags" isn't auto-checked after completed #87482
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2
The combined "Set up categories and tags" onboarding task has a cross-dependency for auto-completion that is asymmetric:
Category creation path (Category.ts:900): completes the combined task if policyHasTags is true — this checks for ANY tags via hasTags() at PolicyUtils.ts:672
Tag creation path (Tag.ts:231): completes the combined task if policyHasCustomCategories is true — this uses hasCustomCategories() at PolicyUtils.ts:680 which only counts categories whose names are not in the 19 default categories list (CONST.POLICY.DEFAULT_CATEGORIES)
In the normal user flow (categories first → tags second), auto-completion depends on the tag creation path. Since new workspaces come pre-populated with only default categories, if the user enables/toggles a default category or adds a category that happens to match a default name, hasCustomCategories returns false and the combined task never auto-completes.
The category-side check (policyHasTags) is permissive — any tag counts. The tag-side check (policyHasCustomCategories) is overly restrictive — only non-default-named categories count. This asymmetry is the bug.
What changes do you think we should make in order to solve the problem?
Replace the policyHasCustomCategories condition at Tag.ts:231 with a broader check that mirrors the permissiveness of the category-side check.
Specifically, change hasCustomCategories to hasEnabledCategories (or similar) that returns true when the user has any enabled categories — including default ones. Since the user was directed from the task to set up categories and has navigated there, having enabled categories confirms they've "set up categories."
Alternatively, since setWorkspaceCategoryEnabled at Category.ts:460 already completes the combined task when policyHasTags is true (without checking for custom names), the simplest consistent fix is to use the same permissive check on the tag side — just verify that categories exist on the policy, not that they are custom-named.
What alternative solutions did you explore? (Optional)
Remove the cross-check entirely: auto-complete the combined task on either a category or tag action, without requiring the other to exist. Rejected because the task is "Set up categories AND tags" — both should be configured.
Track user visits: mark the task as "categories set up" when the user visits the categories page, then auto-complete when tags are also created. Rejected as over-engineered — the existing mechanism just needs the condition relaxed.
hasCustomCategories: PolicyUtils.ts:680-688 — filters against CONST.POLICY.DEFAULT_CATEGORIES (19 names: Advertising, Benefits, Car, Equipment, Fees, Home Office, Insurance, Interest, Labor, Maintenance, Materials, Meals and Entertainment, Office Supplies, Other, Professional Services, Rent, Taxes, Travel, Utilities)
hasTags: PolicyUtils.ts:672-674 — checks for ANY tags in any tag list
Task completion mechanism: Task.ts:1429-1446 → completeTask at Task.ts:502-526
Data flow for user's repro steps:
User creates workspace → default categories pre-populated
User adds a category → createPolicyCategory fires → policyHasTags is false → combined task NOT completed
User enables Tags → feature toggle only, no tags created
User creates a tag → createPolicyTag fires → policyHasCustomCategories checked → returns false if category name matches a default → combined task NOT completed
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
changed the title [-]Onboarding- Task "Set up categories and tags" isn't auto-checked after completed[/-][+][$250] Onboarding- Task "Set up categories and tags" isn't auto-checked after completed[/+]on Apr 9, 2026
Please re-state the problem that we are trying to solve in this issue.
The onboarding task "Set up categories and tags" never auto-completes after the user adds categories and tags following the task instructions.
What is the root cause of that problem?
PR #81814 added an isTaskForCurrentWorkspace gate in Tag.ts that checks !taskReport?.policyID || taskReport.policyID === policyID. When shouldPostTasksInAdminsRoom is false (emails with +, or non-MANAGE_TEAM flows), onboarding tasks are created in the Concierge chat. buildOptimisticTaskReport at ReportUtils.ts:8631 receives targetChatPolicyID from the Concierge chat, which resolves to _FAKE_ or empty string. So the check taskReport.policyID === policyID fails because _FAKE_ !== actualWorkspacePolicyID, and the task never completes.
I traced DylanDylann's suggestion of fixing policyID at the source. nkdengineer's evidence shows that changing the task report's policyID would break the data model: child reports inherit parent policyID, and overriding it causes UI regressions ("Go to workspace" appearing in task detail).
What changes do you think we should make in order to solve the problem?
The Concierge fallback must be workspace-specific, not just "came from Concierge". A naive isConciergeChatReport(taskParentReport) check returns true for ANY tag creation in any workspace, which incorrectly completes the onboarding task for unrelated workspaces.
The reliable signal: the task description embeds the workspace URL (e.g. [create a tag](https://staging.new.expensify.com/g/settings/workspaces/{policyID}/tags/new)). Parse it to identify the specific onboarding workspace.
This fixes the bug nkdengineer identified: the Concierge-task case now compares the embedded workspace policyID to the current workspace, not just "is this in Concierge".
Long-term fix (separate PR): Add onboardingPolicyID field to the IntroSelected NVP. Set it during prepareOnboardingOnyxData when tasks are created. Read it during completion checks. This avoids parsing description text entirely and survives any future task description format changes.
Apply the same isTaskForCurrentWorkspace pattern to:
setupTagsTaskReport check at Tag.ts:197
setupCategoriesAndTagsTaskReport check at Tag.ts:201
appendSetupCategoriesOnboardingData in Category.ts (currently has no policyID gate, will need symmetric fix to avoid the same bug going forward)
What alternative solutions did you explore? (Optional)
Parent-report context only (my earlier proposal, also nabi-ebrahimi's): rejected by nkdengineer because isConciergeChatReport(parent) is workspace-agnostic and triggers for tags created in unrelated workspaces.
Fix policyID at source (DylanDylann's direction): breaks parent-child data model, causes UI regressions per nkdengineer's screenshots.
When the user has + in the email, the onboarding task is created in the concierge chat, report?.policyID is _FAKE_ which causes isTaskForCurrentWorkspace to fail. Then the task is not completed.
What changes do you think we should make in order to solve the problem?
Update the backend with CompleteGuidedSetup API to store the policyID from the parameter to an onyx key. We can store this as a field of nvp_onboarding or nvp_introSelected or store it in a new key.
Frontend change:
In prepareOnboardingOnyxData, store the onboardingPolicyID in optimistic data with the key we defined to store in the backend at point 1
Get the onboardingPolicyID from the key above, pass it from the component to isTaskForCurrentWorkspace and use this to compare with policyID instead of using taskReport?.policyID
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
⚠️@nkdengineer Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).
The failure to auto-complete the task is caused by Requirement Asymmetry and UI-Logic Coupling.
Asymmetric Logic: The "Set up categories and tags" task has two triggers. The category-creation trigger is permissive (any tag counts), but the tag-creation trigger is restrictive. Specifically, Tag.ts uses hasCustomCategories, which explicitly ignores the 19 default categories. If a user fulfills the onboarding requirement by enabling a default category and then adding a tag, the system fails to transition the task to "complete" because it is strictly looking for non-default category names.
State Desynchronization: The logic currently depends on boolean flags (like policyHasCustomCategories) being passed as props from the UI layer to the Action layer. If the user has an email with a + sign or is in a specific onboarding state where policyID is masked as FAKE, the UI-level checks can fail to resolve the correct workspace context, preventing the completion signal from being dispatched to the server even if the data is valid.
What changes do you think we should make in order to solve the problem?
I propose a Policy-State Evaluation approach that moves the completion authority away from UI props and into a centralized utility:
Centralize Setup Verification: In PolicyUtils.ts, I will create a unified helper isCategoriesAndTagsSetup(policyID). This function will determine setup completion by checking for the existence of any enabled category (including defaults) and any active tag. This ensures a "Single Source of Truth" for this specific onboarding milestone.
Action-Layer Autonomy: I will refactor createPolicyTag in Tag.ts and the category update functions in Category.ts to call this new helper directly using the policyID. This removes the need to pass policyHasCustomCategories or policyHasTags as arguments from the React components, reducing the risk of stale data or prop-drilling errors.
Relax Category Constraints: I will update the completion check in Tag.ts to replace hasCustomCategories with a check that validates if the user has any categories configured. Toggling a default category is a valid "setup" action and should satisfy the onboarding requirement.
Contextual Policy ID Resolution: I will update the isTaskForCurrentWorkspace check to handle the FAKE policyID scenario. If the direct policyID check fails, the logic will attempt to resolve the context via the parentReportID to ensure users on the guided onboarding path aren't locked out of task completion.
What alternative solutions did you explore? (Optional)
I considered simply removing the default category filter from hasCustomCategories. However, that function might be used elsewhere in the app where "Custom" actually means "Non-Default." By creating a dedicated isCategoriesAndTagsSetup helper, we fix the onboarding bug without creating side effects for other features that might need to distinguish between default and custom categories. I also considered auto-completing the task upon the first navigation to the categories page, but rejected it because it doesn't guarantee the user actually performed the required setup.
@roryabraham When we reset cache, the onboarding tasks are cleared. Looks like the backend doesn't create the tasks in the onboarding flow now for all purposes.
@nkdengineer Could you verify this for other onboarding purposes? If setting the category and tags no longer appear on the onboarding task, I agree that this issue should be closed.
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2
Activity
MelvinBot commentedon Apr 9, 2026
Proposal
What is the root cause of that problem?
The combined "Set up categories and tags" onboarding task has a cross-dependency for auto-completion that is asymmetric:
Category.ts:900): completes the combined task ifpolicyHasTagsis true — this checks for ANY tags viahasTags()atPolicyUtils.ts:672Tag.ts:231): completes the combined task ifpolicyHasCustomCategoriesis true — this useshasCustomCategories()atPolicyUtils.ts:680which only counts categories whose names are not in the 19 default categories list (CONST.POLICY.DEFAULT_CATEGORIES)In the normal user flow (categories first → tags second), auto-completion depends on the tag creation path. Since new workspaces come pre-populated with only default categories, if the user enables/toggles a default category or adds a category that happens to match a default name,
hasCustomCategoriesreturnsfalseand the combined task never auto-completes.The category-side check (
policyHasTags) is permissive — any tag counts. The tag-side check (policyHasCustomCategories) is overly restrictive — only non-default-named categories count. This asymmetry is the bug.What changes do you think we should make in order to solve the problem?
Replace the
policyHasCustomCategoriescondition atTag.ts:231with a broader check that mirrors the permissiveness of the category-side check.Specifically, change
hasCustomCategoriestohasEnabledCategories(or similar) that returnstruewhen the user has any enabled categories — including default ones. Since the user was directed from the task to set up categories and has navigated there, having enabled categories confirms they've "set up categories."Alternatively, since
setWorkspaceCategoryEnabledatCategory.ts:460already completes the combined task whenpolicyHasTagsis true (without checking for custom names), the simplest consistent fix is to use the same permissive check on the tag side — just verify that categories exist on the policy, not that they are custom-named.What alternative solutions did you explore? (Optional)
Investigation details
Key code paths:
OnboardingFlow.ts:266-272(autoCompleted: false)ReportUtils.ts:11835-11841— combined task only created whenuserReportedIntegrationis truthyCategory.ts:899-910— usespolicyHasTags(permissive)Tag.ts:230-240— usespolicyHasCustomCategories(restrictive)hasCustomCategories:PolicyUtils.ts:680-688— filters againstCONST.POLICY.DEFAULT_CATEGORIES(19 names: Advertising, Benefits, Car, Equipment, Fees, Home Office, Insurance, Interest, Labor, Maintenance, Materials, Meals and Entertainment, Office Supplies, Other, Professional Services, Rent, Taxes, Travel, Utilities)hasTags:PolicyUtils.ts:672-674— checks for ANY tags in any tag listTask.ts:1429-1446→completeTaskatTask.ts:502-526Data flow for user's repro steps:
createPolicyCategoryfires →policyHasTagsis false → combined task NOT completedcreatePolicyTagfires →policyHasCustomCategorieschecked → returnsfalseif category name matches a default → combined task NOT completedNext Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Apr 9, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (
External)[-]Onboarding- Task "Set up categories and tags" isn't auto-checked after completed[/-][+][$250] Onboarding- Task "Set up categories and tags" isn't auto-checked after completed[/+]melvin-bot commentedon Apr 9, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022042198222552145991
yuvrajangadsingh commentedon Apr 9, 2026
Proposal (updated to address @nkdengineer's flaw)
Please re-state the problem that we are trying to solve in this issue.
The onboarding task "Set up categories and tags" never auto-completes after the user adds categories and tags following the task instructions.
What is the root cause of that problem?
PR #81814 added an
isTaskForCurrentWorkspacegate inTag.tsthat checks!taskReport?.policyID || taskReport.policyID === policyID. WhenshouldPostTasksInAdminsRoomis false (emails with+, or non-MANAGE_TEAM flows), onboarding tasks are created in the Concierge chat.buildOptimisticTaskReportatReportUtils.ts:8631receivestargetChatPolicyIDfrom the Concierge chat, which resolves to_FAKE_or empty string. So the checktaskReport.policyID === policyIDfails because_FAKE_ !== actualWorkspacePolicyID, and the task never completes.I traced DylanDylann's suggestion of fixing policyID at the source. nkdengineer's evidence shows that changing the task report's policyID would break the data model: child reports inherit parent policyID, and overriding it causes UI regressions ("Go to workspace" appearing in task detail).
What changes do you think we should make in order to solve the problem?
The Concierge fallback must be workspace-specific, not just "came from Concierge". A naive
isConciergeChatReport(taskParentReport)check returns true for ANY tag creation in any workspace, which incorrectly completes the onboarding task for unrelated workspaces.The reliable signal: the task description embeds the workspace URL (e.g.
[create a tag](https://staging.new.expensify.com/g/settings/workspaces/{policyID}/tags/new)). Parse it to identify the specific onboarding workspace.This fixes the bug nkdengineer identified: the Concierge-task case now compares the embedded workspace policyID to the current workspace, not just "is this in Concierge".
Long-term fix (separate PR): Add
onboardingPolicyIDfield to theIntroSelectedNVP. Set it duringprepareOnboardingOnyxDatawhen tasks are created. Read it during completion checks. This avoids parsing description text entirely and survives any future task description format changes.Apply the same
isTaskForCurrentWorkspacepattern to:setupTagsTaskReportcheck atTag.ts:197setupCategoriesAndTagsTaskReportcheck atTag.ts:201appendSetupCategoriesOnboardingDatainCategory.ts(currently has no policyID gate, will need symmetric fix to avoid the same bug going forward)What alternative solutions did you explore? (Optional)
isConciergeChatReport(parent)is workspace-agnostic and triggers for tags created in unrelated workspaces.nkdengineer commentedon Apr 9, 2026
Proposal
What is the root cause of that problem?
The
Set up categories and tagstask is completed only if the task report is related to the current workspace.App/src/libs/actions/Policy/Tag.ts
Lines 231 to 236 in a42bb23
When the user has
+in the email, the onboarding task is created in the concierge chat,report?.policyIDis_FAKE_which causesisTaskForCurrentWorkspaceto fail. Then the task is not completed.App/src/libs/actions/Policy/Tag.ts
Line 216 in a42bb23
What changes do you think we should make in order to solve the problem?
Update the backend with
CompleteGuidedSetupAPI to store thepolicyIDfrom the parameter to an onyx key. We can store this as a field ofnvp_onboardingornvp_introSelectedor store it in a new key.Frontend change:
In
prepareOnboardingOnyxData, store theonboardingPolicyIDin optimistic data with the key we defined to store in the backend at point 1Get the
onboardingPolicyIDfrom the key above, pass it from the component toisTaskForCurrentWorkspaceand use this to compare withpolicyIDinstead of usingtaskReport?.policyIDApp/src/libs/actions/Policy/Tag.ts
Line 216 in a42bb23
What alternative solutions did you explore? (Optional)
We can remove
isTaskForCurrentWorkspaceas we don't use this when completing the task hereApp/src/libs/actions/Policy/Tag.ts
Line 216 in a42bb23
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
github-actions commentedon Apr 9, 2026
Yatin-Bhatti commentedon Apr 9, 2026
What is the root cause of that problem?
The failure to auto-complete the task is caused by Requirement Asymmetry and UI-Logic Coupling.
Asymmetric Logic: The "Set up categories and tags" task has two triggers. The category-creation trigger is permissive (any tag counts), but the tag-creation trigger is restrictive. Specifically, Tag.ts uses hasCustomCategories, which explicitly ignores the 19 default categories. If a user fulfills the onboarding requirement by enabling a default category and then adding a tag, the system fails to transition the task to "complete" because it is strictly looking for non-default category names.
State Desynchronization: The logic currently depends on boolean flags (like policyHasCustomCategories) being passed as props from the UI layer to the Action layer. If the user has an email with a + sign or is in a specific onboarding state where policyID is masked as FAKE, the UI-level checks can fail to resolve the correct workspace context, preventing the completion signal from being dispatched to the server even if the data is valid.
What changes do you think we should make in order to solve the problem?
I propose a Policy-State Evaluation approach that moves the completion authority away from UI props and into a centralized utility:
Centralize Setup Verification: In PolicyUtils.ts, I will create a unified helper isCategoriesAndTagsSetup(policyID). This function will determine setup completion by checking for the existence of any enabled category (including defaults) and any active tag. This ensures a "Single Source of Truth" for this specific onboarding milestone.
Action-Layer Autonomy: I will refactor createPolicyTag in Tag.ts and the category update functions in Category.ts to call this new helper directly using the policyID. This removes the need to pass policyHasCustomCategories or policyHasTags as arguments from the React components, reducing the risk of stale data or prop-drilling errors.
Relax Category Constraints: I will update the completion check in Tag.ts to replace hasCustomCategories with a check that validates if the user has any categories configured. Toggling a default category is a valid "setup" action and should satisfy the onboarding requirement.
Contextual Policy ID Resolution: I will update the isTaskForCurrentWorkspace check to handle the FAKE policyID scenario. If the direct policyID check fails, the logic will attempt to resolve the context via the parentReportID to ensure users on the guided onboarding path aren't locked out of task completion.
What alternative solutions did you explore? (Optional)
I considered simply removing the default category filter from hasCustomCategories. However, that function might be used elsewhere in the app where "Custom" actually means "Non-Default." By creating a dedicated isCategoriesAndTagsSetup helper, we fix the onboarding bug without creating side effects for other features that might need to distinguish between default and custom categories. I also considered auto-completing the task upon the first navigation to the categories page, but rejected it because it doesn't guarantee the user actually performed the required setup.
melvin-bot commentedon Apr 9, 2026
76 remaining items
nkdengineer commentedon Jun 1, 2026
@roryabraham When we reset cache, the onboarding tasks are cleared. Looks like the backend doesn't create the tasks in the onboarding flow now for all purposes.
Screen.Recording.2026-06-01.at.13.21.16.mov
nkdengineer commentedon Jun 9, 2026
@DylanDylann @roryabraham Any thoughts on my comment above?
DylanDylann commentedon Jun 9, 2026
Nice catch! Clearing the cache also removed the onboarding task on my end. Are you still able to reproduce this issue?
nkdengineer commentedon Jun 22, 2026
@DylanDylann I can't reproduce now. The manage team purpose doesn't create onboarding task anymore.
DylanDylann commentedon Jun 22, 2026
@nkdengineer Could you verify this for other onboarding purposes? If setting the category and tags no longer appear on the onboarding task, I agree that this issue should be closed.
nkdengineer commentedon Jun 29, 2026
@DylanDylann, we only have the category tag. No set up categories and tags anymore.
DylanDylann commentedon Jun 30, 2026
@nkdengineer I just checked again and agree with you that this bug no longer reproduces. Please close the PR
nkdengineer commentedon Jul 7, 2026
@roryabraham, the issue is no longer reproducible. Can you please assign someone to handle payment here? Thanks.
roryabraham commentedon Jul 8, 2026
@mallenexpensify Default payments of $250 to @nkdengineer and @DylanDylann payable immediately
mallenexpensify commentedon Jul 9, 2026
Payment Summary
Contributor: @nkdengineer due $250 via NewDot
Contributor+: @DylanDylann due $250 via NewDot
twisterdotcom commentedon Jul 15, 2026
$250 approved for @nkdengineer in Report ID: R00JRhw1xXfR.
Zapier Logs
Run ID: 00040eee-8ab5-a671-b0fb-f072391cad14SO: https://stackoverflowteams.com/c/expensify/questions/7582
quinthar commentedon Jul 31, 2026
Approved $250 to @DylanDylann