Skip to content

fix: Add Pop up when Plan Approval session is end and also handle old plan…#1002

Open
NirajC-Microsoft wants to merge 4 commits into
dev-v4from
bug-psl-43627
Open

fix: Add Pop up when Plan Approval session is end and also handle old plan…#1002
NirajC-Microsoft wants to merge 4 commits into
dev-v4from
bug-psl-43627

Conversation

@NirajC-Microsoft
Copy link
Copy Markdown
Contributor

Purpose

This pull request introduces robust handling for plan approval timeouts and superseded plans, improving both backend reliability and frontend user experience. The backend now distinguishes between plans that are superseded (when a user starts a new task before approving the previous one) and plans that time out due to inaction, handling each case appropriately. On the frontend, users are presented with a clear dialog when a plan approval times out, guiding them to start a new task.

Backend: Plan approval timeout and supersession handling

  • Added mechanisms to track which user each pending plan belongs to and to mark plans as superseded when a new task is started by the same user, ensuring that only the latest plan is active for a user (src/backend/v4/config/settings.py, cancel_pending_approvals_for_user, is_plan_superseded, set_approval_pending) [1] [2].
  • Introduced custom exceptions PlanSupersededError and PlanTimeoutError to clearly distinguish between a plan being superseded and a plan timing out, and refactored orchestration logic to use these exceptions for clean error propagation (src/backend/v4/orchestration/exceptions.py, src/backend/v4/orchestration/human_approval_manager.py, src/backend/v4/orchestration/orchestration_manager.py) [1] [2] [3] [4].
  • When a plan is superseded, the backend now terminates the orchestration silently without sending an error to the user; for timeouts, a user-friendly error message is sent via WebSocket and the plan status is updated to FAILED in the database (src/backend/v4/orchestration/orchestration_manager.py).
  • Ensured that any stale pending approvals are cancelled when a new plan is started, preventing old background tasks from sending erroneous timeout errors to the user's current session (src/backend/v4/api/router.py).

Frontend: User experience for plan approval timeouts

  • Added a PlanTimeoutDialog React component that is displayed when the backend signals a plan approval timeout, providing clear instructions to the user (src/App/src/components/common/PlanTimeoutDialog.tsx).
  • Updated Redux state and selectors to track and control the visibility of the timeout dialog, and integrated dialog display logic into the PlanPage component (src/App/src/store/slices/planSlice.ts, src/App/src/pages/PlanPage.tsx, src/App/src/hooks/usePlanWebSocket.tsx) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11].

Other improvements

  • Increased the default HTTP client timeout from 30s to 180s to better accommodate longer-running backend operations (src/App/src/api/httpClient.ts).

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
v4/config
   settings.py2362589%117, 119, 168–170, 181, 201, 212–214, 233, 237–242, 246, 279–280, 331–333, 358–359
v4/orchestration
   exceptions.py9277%8–9
   human_approval_manager.py1634671%111, 113–114, 116–129, 133–135, 137, 270–273, 280–281, 284–287, 291–292, 295, 306, 308, 314–318, 320, 341, 345–346, 371
   orchestration_manager.py2966777%268–269, 330–332, 336, 342, 354–356, 360, 366, 406–407, 425, 485–486, 493, 495–499, 501–504, 506, 549, 554–564, 569, 575–584, 586–587, 602–604, 617, 622, 626, 636–643
TOTAL311343286% 

Tests Skipped Failures Errors Time
883 5 💤 0 ❌ 0 🔥 7.808s ⏱️

@NirajC-Microsoft NirajC-Microsoft changed the title Add Pop up when Plan Approval session is end and also handle old plan… fix: Add Pop up when Plan Approval session is end and also handle old plan… May 22, 2026

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings May 22, 2026 08:01

This comment was marked as resolved.

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