[$175] Workflows - Admins log shows a blank date for "Last <weekday>" monthly offsets
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: v9.5.5-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/77576388/folder/54011928/131685748/1836124868?sort=-identifier (original report) Issue reported by: Applause Internal Team App Component: Workspace Settings
Action Performed:
- As a workspace admin, go to Workspace settings > Workflows > Submissions > Frequency.
- Select Monthly > Day of the month > Last Friday > Save.
- Press Save on the Frequency page.
- Open the workspace #admins room.
Expected Result:
The admin log shows: updated the monthly report submission date to "Last Friday" (previously "1st").
Actual Result:
The admin log shows a blank new date: updated the monthly report submission date to "" (previously "1st").
Workaround:
Unknown.
Platforms:
Platform coverage for the updated report has not been independently verified.
Screenshots/Videos
https://github.com/user-attachments/assets/6b41e1b2-b7ea-482e-a307-579b8c4a9742
Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7280896
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022108201074609884540
- Upwork Job ID: 2108201074609884540
- Last Price Increase: 2026-10-08
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/53ffd65a47e9129545fda963293552220d11ee20bf6ff423e367979cbea0fe6f
Proposal
What is the root cause of that problem?
The Date of month is now saved before the Frequency, and saving Frequency as Monthly resets the date to the 1st.
[A11y] Add Save button to auto-reporting frequency & monthly offset pages changed the order of the two saves:
- Before that PR: selecting Monthly saved the frequency right away. You then picked a date, so the date was always saved last.
- After that PR: selecting Monthly only updates local state (
WorkspaceAutoReportingFrequencyPage.tsx:78-80). You can still open "Date of month" and save a date (WorkspaceAutoReportingMonthlyOffsetPage.tsx:94-100).SetWorkspaceAutoReportingOffsetis sent first. When you press Save,SetWorkspaceAutoReportingFrequencyis sent second (WorkspaceAutoReportingFrequencyPage.tsx:82-88).
The client data for the frequency call never touches autoReportingOffset (Policy.ts:857-906). So the reset to the 1st comes from the server response when the frequency changes to Monthly. This also explains the second symptom: switching to another frequency and back to Monthly resets the date again.
What changes do you think we should make in order to solve the problem?
In saveAutoReportingFrequency in WorkspaceAutoReportingFrequencyPage.tsx:
- Keep calling
setWorkspaceAutoReportingFrequencyas today. - If the new frequency is Monthly, the saved frequency was something else, and
policy.autoReportingOffsetis set, callsetWorkspaceAutoReportingMonthlyOffsetright after it with that offset.
API.write requests run in order, so the date is written after the frequency. This keeps the date the user chose in both cases from the issue. It also keeps the explicit Save behavior from the a11y PR.
What alternative solutions did you explore? (Optional)
- Save the frequency right away when you tap "Date of month" while Monthly is selected but not saved. This restores the old order, but it saves without pressing Save, which goes against the a11y PR.
- Stop the server from resetting the date when the frequency changes. That change is outside the App repo and needs an internal engineer.
Reproduction on web (dev)
On a new workspace, I selected Monthly, set Date of month to 15th, then pressed Save on the Frequency page.
- The network order was
SetWorkspaceAutoReportingOffset(14:17:35Z), thenSetWorkspaceAutoReportingFrequency(14:18:11Z). - The date showed 15th before Save and 1st after Save.
- Control test: with Monthly already saved, I changed the date to 20th. Only the offset call ran, and 20th stayed.

Not verified: The test tool could not read response bodies. The server reset is inferred from the request order, the control test, and client code that never writes autoReportingOffset during a frequency change.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/103478) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External)
Job added to Upwork: https://www.upwork.com/jobs/~022108201074609884540
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~010e53044b5828fe60
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Workspace Settings > Workflows > Submissions: When changing the submission frequency to "Monthly" and selecting a "Date of month" other than the 1st (e.g., 15th), clicking Save on the Date of month page and then clicking Save on the Frequency page causes the Date of month to unexpectedly reset back to the 1st.
What is the root cause of that problem?
In PR #94558 ([A11y] Add Save button to auto-reporting frequency & monthly offset pages), selection changes on WorkspaceAutoReportingFrequencyPage were converted to local draft state (userSelectedFrequency) so the change is only committed when pressing the "Save" button via confirmButtonOptions.
However, the "Date of month" sub-page (WorkspaceAutoReportingMonthlyOffsetPage.tsx) still persists selections immediately upon pressing Save via setWorkspaceAutoReportingMonthlyOffset(policyID, selectedOffset, ...):
- When the user selects "Monthly" (not yet saved to backend), taps "Date of month", and saves e.g. the 15th,
SetWorkspaceAutoReportingOffsetis sent to the backend first. - Next, when the user presses "Save" on
WorkspaceAutoReportingFrequencyPage,saveAutoReportingFrequencyexecutessetWorkspaceAutoReportingFrequency(...)(WorkspaceAutoReportingFrequencyPage.tsx:82), sendingSetWorkspaceAutoReportingFrequencysecond. SetWorkspaceAutoReportingFrequencyParamsonly sendspolicyIDandfrequency. On the server side, changing the frequency to Monthly initializes/defaultsautoReportingOffsetto 1.- Because
SetWorkspaceAutoReportingFrequencywas sent afterSetWorkspaceAutoReportingOffset, the server's frequency change response overwrites Onyxpolicy.autoReportingOffsetback to 1.
The exact same regression occurs if the policy is switched to another frequency and then back to Monthly: the server reset wipes out the previously configured autoReportingOffset.
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx:
- Import
setWorkspaceAutoReportingMonthlyOffsetfrom@userActions/Policy/Policy:
import {clearPolicyErrorField, setWorkspaceAutoReportingFrequency, setWorkspaceAutoReportingMonthlyOffset} from '@userActions/Policy/Policy';
- In
saveAutoReportingFrequency, ifselectedFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLYandpolicy?.autoReportingOffsetexists, callsetWorkspaceAutoReportingMonthlyOffsetright aftersetWorkspaceAutoReportingFrequency:
const saveAutoReportingFrequency = useCallback(() => {
if (!policyID || !selectedFrequency) {
return;
}
setWorkspaceAutoReportingFrequency(policyID, selectedFrequency, policy?.autoReportingFrequency, policy?.harvesting, getReviewWorkspaceSettingsTaskCompletion());
if (selectedFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLY && policy?.autoReportingOffset) {
setWorkspaceAutoReportingMonthlyOffset(policyID, policy.autoReportingOffset, policy.autoReportingOffset, getReviewWorkspaceSettingsTaskCompletion());
}
Navigation.goBack();
}, [policyID, policy?.autoReportingFrequency, policy?.autoReportingOffset, policy?.harvesting, selectedFrequency, getReviewWorkspaceSettingsTaskCompletion]);
Why this works:
API.write calls are queued and executed strictly sequentially via SequentialQueue. By calling setWorkspaceAutoReportingMonthlyOffset immediately following setWorkspaceAutoReportingFrequency, SetWorkspaceAutoReportingOffset is guaranteed to be processed after SetWorkspaceAutoReportingFrequency. This firmly preserves the user's selected date (or previously saved date) in both Onyx and backend storage, while fully maintaining the explicit WCAG-compliant Save button UX introduced in #94558 without requiring any backend schema changes.
What alternative solutions did you explore? (Optional)
- Draft Onyx key or route params for offset: Storing the offset in a temporary draft key until Frequency is saved would add unnecessary complexity and multi-page routing overhead across two navigation screens.
- Backend-only fix: Modifying
SetWorkspaceAutoReportingFrequencyon the backend to avoid resettingautoReportingOffset. That requires internal backend changes and cannot fix existing client versions. Calling the existing client action sequentially cleanly guarantees correct ordering in App.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a workspace submission frequency is changed to Monthly and the user selects a day other than the 1st, saving the frequency resets the selected monthly day back to the 1st. The same reset can happen when switching away from Monthly and then back.
What is the root cause of that problem?
The monthly offset and the frequency are persisted by separate API calls.
After the Save-button change, selecting Monthly is kept as local state until the user presses Save. The user can therefore save the monthly offset first, and only afterwards save the frequency.
That creates this order:
SetWorkspaceAutoReportingOffsetsaves the chosen day.SetWorkspaceAutoReportingFrequencythen changes the frequency to Monthly.- The frequency update resets the server-side monthly offset to the default value (1), overwriting the day that was just saved.
This explains both the first-time Monthly case and the switch-away/switch-back case.
What changes do you think we should make in order to solve the problem?
Keep the current explicit Save UX, but make the final save order deterministic:
- Call
setWorkspaceAutoReportingFrequency(...)first. - When the selected frequency is Monthly and a valid existing
autoReportingOffsetis available, callsetWorkspaceAutoReportingMonthlyOffset(...)immediately afterwards so the intended day is persisted last. - Scope the extra offset write only to the Monthly transition where the frequency save can reset it.
- Add regression coverage for:
- first switch to Monthly + choose a non-1st day;
- switch from Monthly to another frequency and back;
- changing only the monthly day while Monthly is already saved.
This keeps the accessibility Save-button behavior introduced earlier and avoids requiring a backend schema change.
What alternative solutions did you explore? (Optional)
Saving the frequency immediately when opening the monthly-offset page would restore the old request order, but it would bypass the current explicit Save behavior. A backend change that stops the frequency endpoint from resetting the offset would also work, but it is outside the App repo and would not protect existing client behavior.
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Workspace Settings > Workflows > Submissions: When a user changes the submission frequency to "Monthly" and selects a "Date of month" other than the 1st (e.g. 15th), clicking "Save" on the Date of month page and then clicking "Save" on the Frequency page causes the Date of month to unexpectedly reset back to the 1st.
What is the root cause of that problem?
In PR #94558 ([A11y] Add Save button to auto-reporting frequency & monthly offset pages), selection changes on WorkspaceAutoReportingFrequencyPage were moved to local draft state (userSelectedFrequency), committing only when the user clicks the explicit "Save" button.
However, the "Date of month" sub-page (WorkspaceAutoReportingMonthlyOffsetPage.tsx) persists immediately upon pressing its own "Save" button via setWorkspaceAutoReportingMonthlyOffset(policyID, selectedOffset, ...).
This creates an inverted execution order:
- While "Monthly" frequency is still in uncommitted local draft state on the parent page, the user opens "Date of month" and saves e.g. the 15th.
SetWorkspaceAutoReportingOffsetis dispatched to the backend first. - When the user returns and presses "Save" on
WorkspaceAutoReportingFrequencyPage.tsx:82-88,saveAutoReportingFrequencyexecutessetWorkspaceAutoReportingFrequency(...), dispatchingSetWorkspaceAutoReportingFrequencyto the backend second. - On the backend, changing frequency to Monthly without an explicit offset parameter automatically re-initializes/defaults
autoReportingOffsetto 1. - Because
SetWorkspaceAutoReportingFrequencywas processed afterSetWorkspaceAutoReportingOffset, the backend response overwrites Onyxpolicy.autoReportingOffsetback to 1.
The same reset occurs when switching a workspace from Monthly to another frequency and back to Monthly.
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx:
- Import
setWorkspaceAutoReportingMonthlyOffsetfrom@userActions/Policy/Policy:
import {clearPolicyErrorField, setWorkspaceAutoReportingFrequency, setWorkspaceAutoReportingMonthlyOffset} from '@userActions/Policy/Policy';
- In
saveAutoReportingFrequency, whenselectedFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLYandpolicy?.autoReportingOffset !== undefined, dispatchsetWorkspaceAutoReportingMonthlyOffsetsequentially aftersetWorkspaceAutoReportingFrequency:
const saveAutoReportingFrequency = useCallback(() => {
if (!policyID || !selectedFrequency) {
return;
}
setWorkspaceAutoReportingFrequency(policyID, selectedFrequency, policy?.autoReportingFrequency, policy?.harvesting, getReviewWorkspaceSettingsTaskCompletion());
if (selectedFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLY && policy?.autoReportingOffset !== undefined) {
setWorkspaceAutoReportingMonthlyOffset(policyID, policy.autoReportingOffset, policy.autoReportingOffset);
}
Navigation.goBack();
}, [policyID, policy?.autoReportingFrequency, policy?.autoReportingOffset, policy?.harvesting, selectedFrequency, getReviewWorkspaceSettingsTaskCompletion]);
Key Architectural Details:
- Deterministic Queue Ordering: Because Expensify processes client writes through
SequentialQueue, callingsetWorkspaceAutoReportingMonthlyOffsetimmediately followingsetWorkspaceAutoReportingFrequencyguarantees thatSetWorkspaceAutoReportingOffsetis processed afterSetWorkspaceAutoReportingFrequencyon both the client and server. - No Duplicate Task Completion: Notice we do not pass
getReviewWorkspaceSettingsTaskCompletion()to the second call (setWorkspaceAutoReportingMonthlyOffset), preventing duplicatecompletedTaskReportActionIDsubmissions while ensuring the task is cleanly finalized by the primary frequency action. - Proper Rollback State: Passing
policy.autoReportingOffsetascurrentAutoReportingOffsetensures that Onyx failure rollback retains the selected day without creating desync. - Full Type Support: This safely handles both numeric day offsets (1–28) and string offset keys (
lastDayOfMonth,lastBusinessDayOfMonth).
What alternative solutions did you explore? (Optional)
- Drafting
autoReportingOffsetinto Onyx draft key until Frequency is saved: This would add multi-page routing state overhead across navigation stacks and require clearing draft keys on unmount/cancellation. - Backend-only schema change in
SetWorkspaceAutoReportingFrequency: Modifying the backend Web-Secure handler is outside this repository's scope and would not solve the issue on existing client builds.
What specific scenarios should we cover in automated tests?
In tests/ui/WorkspaceAutoReportingFrequencyPageTest.tsx:
- Switch to Monthly with custom date: When switching a policy from Daily/Weekly to Monthly and selecting the 15th, saving the frequency should maintain
policy.autoReportingOffset = 15and dispatchSetWorkspaceAutoReportingOffsetafterSetWorkspaceAutoReportingFrequency. - Switch away and back to Monthly: When switching a policy from Monthly (with offset 15) to Manual/Weekly and then switching back to Monthly, saving should preserve the offset.
- Save other frequencies: Switching to Daily/Weekly should only dispatch
setWorkspaceAutoReportingFrequencywithout redundant offset calls.
@situchan I tested Melvin's proposal locally and found two critical issues:
Stale Closure Regression: Melvin omits policy?.autoReportingOffset from the useCallback dependency array. When selecting a new date (e.g. changing from 15th to 7th), the callback retains the stale closure and overwrites the user's new date back to 15th upon saving.
Duplicate Task Completion IDs: Calling getReviewWorkspaceSettingsTaskCompletion() twice mints two conflicting optimistic reportActionIDs for the same task completion across back-to-back requests.
Demo:Melvin's Regression
selecting 7th gets overwritten by stale 15th)
https://github.com/user-attachments/assets/6fc26b95-8555-4d55-ad94-b81679b5876f
I have a tested fix that resolves the root cause while avoiding both regressions. If you'd like, I can submit the full proposal for your review!
DemoFix(my fix):
https://github.com/user-attachments/assets/f625169b-128e-4e6f-b1ba-19598d70acac
@situchan Just wanted to highlight that my proposal above (https://github.com/Expensify/App/issues/103478#issuecomment-6095547966) already addresses both of these edge cases:
- No Stale Closure:
policy?.autoReportingOffsetis explicitly included in theuseCallbackdependency array. - No Duplicate Task IDs: We specifically omit
getReviewWorkspaceSettingsTaskCompletion()from the secondarysetWorkspaceAutoReportingMonthlyOffsetcall so only a single task completion reportAction is minted.
Looking forward to your review!
@MelvinBot implement your proposal (ignore other proposals)
🤖 Draft PR created: Keep the chosen date of month when saving the Monthly submission frequency Please mark it as "Ready for review" or ask me to do that for you when it is ready for review.
When the frequency changes to Monthly from another frequency, the Frequency page now saves the current date of month again right after the frequency. This stops the server from resetting the date to the 1st.
The PR also fixes the two problems raised in review:
autoReportingOffsetis in theuseCallbackdependencies, so the callback always uses the latest date.- Only the frequency call gets the task completion data, so the extra date call doesn't create a second completion action.
Checks run
- New
tests/ui/WorkspaceAutoReportingFrequencyPageTest.tsx(4 cases), plus the existingWorkspaceAutoReportingMonthlyOffsetPageTestandPolicyTest: 232/232 passed. npm run lint-changed,npm run typecheck,npm run spell-changed, and the React Compiler check on the changed page: all passed.- Not done: a manual check on web. The test browser showed a blank page in both attempts, so I couldn't run the flow. Please verify it manually.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When setting workspace submission frequency to Monthly for the first time, or switching back to Monthly from another frequency and configuring a day other than the 1st (e.g. 15th), saving on the main Frequency page causes the Date of month to unexpectedly reset back to the 1st.
What is the root cause of that problem?
In PR #94558 ([A11y] Add Save button to auto-reporting frequency & monthly offset pages), selection changes on WorkspaceAutoReportingFrequencyPage were converted to local draft state (userSelectedFrequency) so the change is only committed when pressing the "Save" button via confirmButtonOptions.
However, the "Date of month" sub-page (WorkspaceAutoReportingMonthlyOffsetPage.tsx) still persists selections immediately upon pressing Save via setWorkspaceAutoReportingMonthlyOffset(policyID, selectedOffset, ...):
- When the user selects "Monthly" (not yet saved to backend), taps "Date of month", and saves e.g. the 15th,
SetWorkspaceAutoReportingOffsetis sent to the backend first. - Next, when the user presses "Save" on
WorkspaceAutoReportingFrequencyPage,saveAutoReportingFrequencyexecutessetWorkspaceAutoReportingFrequency(...)(WorkspaceAutoReportingFrequencyPage.tsx:86), sendingSetWorkspaceAutoReportingFrequencysecond. SetWorkspaceAutoReportingFrequencyParamsonly sendspolicyIDandfrequency. On the server side, changing the frequency to Monthly initializes/defaultsautoReportingOffsetto 1.- Because
SetWorkspaceAutoReportingFrequencywas sent afterSetWorkspaceAutoReportingOffset, the server's frequency change response overwrites Onyxpolicy.autoReportingOffsetback to 1.
The exact same regression occurs if the policy is switched to another frequency and then back to Monthly: the server reset wipes out the previously configured autoReportingOffset.
What changes do you think we should make in order to solve the problem?
In src/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage.tsx:
- Import
setWorkspaceAutoReportingMonthlyOffsetfrom@userActions/Policy/Policy:
import {clearPolicyErrorField, setWorkspaceAutoReportingFrequency, setWorkspaceAutoReportingMonthlyOffset} from '@userActions/Policy/Policy';
- In
saveAutoReportingFrequency, ifselectedFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLYandpolicy?.autoReportingOffsetexists, callsetWorkspaceAutoReportingMonthlyOffsetright aftersetWorkspaceAutoReportingFrequency:
const saveAutoReportingFrequency = useCallback(() => {
if (!policyID || !selectedFrequency) {
return;
}
setWorkspaceAutoReportingFrequency(policyID, selectedFrequency, policy?.autoReportingFrequency, policy?.harvesting, getReviewWorkspaceSettingsTaskCompletion());
if (selectedFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MONTHLY && policy?.autoReportingOffset) {
setWorkspaceAutoReportingMonthlyOffset(policyID, policy.autoReportingOffset, policy.autoReportingOffset, getReviewWorkspaceSettingsTaskCompletion());
}
Navigation.goBack();
}, [policyID, policy?.autoReportingFrequency, policy?.autoReportingOffset, policy?.harvesting, selectedFrequency, getReviewWorkspaceSettingsTaskCompletion]);
Why this works:
API.write calls are queued and executed strictly sequentially via SequentialQueue. By calling setWorkspaceAutoReportingMonthlyOffset immediately following setWorkspaceAutoReportingFrequency, SetWorkspaceAutoReportingOffset is guaranteed to be processed after SetWorkspaceAutoReportingFrequency. This firmly preserves the user's selected date (or previously saved date) in both Onyx and backend storage, while fully maintaining the explicit WCAG-compliant Save button UX introduced in #94558 without requiring any backend schema changes.
What alternative solutions did you explore? (Optional)
- Draft Onyx key or route params for offset: Storing the offset in a temporary draft key until Frequency is saved would add unnecessary complexity and multi-page routing overhead across two navigation screens.
- Backend-only fix: Modifying
SetWorkspaceAutoReportingFrequencyon the backend to avoid resettingautoReportingOffset. That requires internal backend changes and cannot fix existing client versions. Calling the existing client action sequentially cleanly guarantees correct ordering in App.
What specific scenarios should we cover in automated tests?
In tests/unit/pages/workspace/workflows/WorkspaceAutoReportingFrequencyPageTest.tsx:
- When switching submission frequency to Monthly and selecting an offset other than 1, saving calls both
setWorkspaceAutoReportingFrequencyandsetWorkspaceAutoReportingMonthlyOffsetsequentially. - When switching away from Monthly to Weekly,
setWorkspaceAutoReportingMonthlyOffsetis not invoked. - When switching back to Monthly with an existing
autoReportingOffset, the existing offset is persisted sequentially after frequency.
Contributor details Your Expensify account email: [email protected] Upwork Profile link: https://www.upwork.com/freelancers/~0170d6b02e9440e604
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
@situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@situchan Still overdue 6 days?! Let's take care of this!
@situchan Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
@situchan this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@situchan 10 days overdue. I'm getting more depressed than Marvin.
@situchan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!