Refactor src/github/runAction.ts to separate orchestration into clear phase-specific functions (for example: initializeAction, executeAction, finalizeAction). Today the function mixes concerns such as adding reactions, title updates, progress comments, prompt preparation, Codex execution, result routing, and error handling. Extracting these phases should reduce cognitive load, make error paths more predictable, and improve testability. Include a small shared context object passed between phases so data flow is explicit. Preserve current behavior while simplifying control flow and reducing nested branching.
Refactor
src/github/runAction.tsto separate orchestration into clear phase-specific functions (for example:initializeAction,executeAction,finalizeAction). Today the function mixes concerns such as adding reactions, title updates, progress comments, prompt preparation, Codex execution, result routing, and error handling. Extracting these phases should reduce cognitive load, make error paths more predictable, and improve testability. Include a small shared context object passed between phases so data flow is explicit. Preserve current behavior while simplifying control flow and reducing nested branching.