Skip to content

Add retry/abort measurement dialog for environment evaluation failures#263

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/add-retry-dialog-for-measurements
Draft

Add retry/abort measurement dialog for environment evaluation failures#263
Copilot wants to merge 4 commits into
mainfrom
copilot/add-retry-dialog-for-measurements

Conversation

Copilot AI commented May 14, 2026

Copy link
Copy Markdown

When a run hit transient failures while setting variables or reading observables, the subprocess surfaced a hard error and terminated the run. This change introduces an explicit operator decision point so failed measurements can be retried in-place instead of forcing immediate termination.

  • Subprocess: retry-aware measurement loop

    • Added evaluate_measurement_with_retry(...) in core_subprocess.py.
    • Wrapped both initial-point and optimization-step evaluations with the retry loop.
    • On evaluation failure, subprocess publishes a structured measurement error event to the GUI queue and blocks for a control action (retry / abort).
    • If aborted, raises BadgerRunTerminated with failure context from the original measurement exception.
  • GUI runner: operator action path

    • Extended BadgerRoutineSubprocess.check_queue() to detect structured measurement error messages.
    • Added action response messages back to the subprocess queue to continue (retry) or stop (abort) execution.
    • Preserved existing tuple-based error handling for non-measurement exceptions.
  • New dialog: focused recovery UX

    • Added BadgerMeasurementRetryDialog with:
      • primary failure summary,
      • scrollable traceback/details,
      • explicit actions: Retry Measurement and Stop Run.
    • Dialog return value is mapped directly to subprocess control actions.
  • Dialog tests

    • Added test_measurement_retry_dialog.py to cover retry/stop actions and verify rendered summary/details content.
    • Added a broader Badger application-flow test in test_gui_basic.py that verifies the retry dialog path is invoked from the routine runner queue handling and that the retry action is sent back to the subprocess channel.
# subprocess -> GUI
queue.put({
    "type": "measurement_error",
    "title": error_title,
    "traceback": error_traceback,
})

# GUI -> subprocess
self.data_and_error_queue.put({
    "type": "measurement_action",
    "action": "retry",  # or "abort"
})

Copilot AI and others added 3 commits May 14, 2026 20:51
Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/1472982c-183f-421a-af38-8f4c31ed6690

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/1472982c-183f-421a-af38-8f4c31ed6690

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/1472982c-183f-421a-af38-8f4c31ed6690

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>
@roussel-ryan

Copy link
Copy Markdown
Collaborator

@copilot add in a test to make sure the dialog works in the broader Badger application

Agent-Logs-Url: https://github.com/xopt-org/Badger/sessions/caca210a-2a67-4e39-b049-dcd441cb4ee2

Co-authored-by: roussel-ryan <24279776+roussel-ryan@users.noreply.github.com>

Copilot AI commented May 15, 2026

Copy link
Copy Markdown
Author

@copilot add in a test to make sure the dialog works in the broader Badger application

Added a broader Badger application-level test in test_gui_basic.py that exercises the measurement-error queue path through BadgerRoutineSubprocess.check_queue(), verifies the retry dialog is invoked, and confirms the retry action is sent back to the queue (37ef4dc).

Screenshot:
Measurement retry dialog

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