Skip to content

Guard code extraction sessions and reset UI before extraction#3

Open
rawritude wants to merge 1 commit intomainfrom
codex/add-in-flight-guard-to-extractcode
Open

Guard code extraction sessions and reset UI before extraction#3
rawritude wants to merge 1 commit intomainfrom
codex/add-in-flight-guard-to-extractcode

Conversation

@rawritude
Copy link
Copy Markdown
Owner

Motivation

  • Prevent concurrent extractCode() calls from colliding and producing stale UI updates.
  • Ensure the UI shows a clear "Loading..." state and cleared code before starting extraction.
  • Queue follow-up extractions triggered while one is in-flight to avoid lost updates.
  • Only apply extraction results for the most recent session.

Description

  • Added session tracking and an in-flight guard using isExtracting, extractSessionId, latestExtractSessionId, and pendingExtractSessionId to serialize extractions.
  • Split extraction into extractCode() and runExtractCode(sessionId) and ignore responses where sessionId !== latestExtractSessionId to prevent stale updates.
  • Added prepareCodeExtractionUI() to reset projectCode, codeDisplay, and set codeStatus to Loading... before kicking off extraction.
  • Wire workspaceSessionChanged messages to trigger extractCode() so the panel refreshes when the workspace changes.

Testing

  • No automated tests were run for this change.
  • Manual runtime checks were used during development (no test failures reported).
  • The repository's existing test suite was not executed as part of this change.
  • Changes were committed and verified to apply cleanly to sidepanel/sidepanel.js.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant