Skip to content

Split enclave executor handler into focused modules - #11790

Merged
lpcox merged 2 commits into
mainfrom
copilot/refactor-executor-handler
Nov 18, 2026
Merged

lpcox merged 2 commits into
mainfrom
copilot/refactor-executor-handler

Conversation

@lpcox

@lpcox lpcox commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

createExecutorHandler mixed invocation processing, telemetry, and settlement/cancellation bookkeeping in a 568-line security-critical module. This refactor separates those concerns while preserving the public API and execution ordering.

  • Invocation: Move validation, admission, budget debit, execution, and response handling into executor-invocation.js.
  • Telemetry: Isolate timing diagnostics, category filtering, and terminal-outcome mapping in executor-telemetry.js.
  • Settlement: Encapsulate exactly-once settlement, workspace teardown, and cancellation tracking in executor-settlement.js.
  • Factory: Reduce the handler to 201 lines of defaults, dependency wiring, and queue/API management. Preserve per-run ledger and shared-lane ownership.
  • Coverage: Add focused helper regressions and extend image-layout module loading coverage.

@lpcox lpcox changed the title [WIP] Refactor executor handler into focused modules Split enclave executor handler into focused modules Nov 18, 2026
@lpcox
lpcox marked this pull request as ready for review November 18, 2026 19:03
Copilot AI adaptive review requested due to automatic review settings November 18, 2026 19:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Cross-module shared state and callbacks couple cancellation, queue shutdown, identity revocation, and disclosure-budget enforcement, requiring human review of the interacting lifecycle guarantees.

No open issues 🎉

What changed in this PR

Refactors AWF’s enclave executor into focused modules while preserving the public handler API, execution ordering, and shared per-run ledger and admission lane.

Changes:

  • Extracts invocation processing, telemetry, and settlement/cancellation into separate helpers.
  • Reduces the handler to defaults, dependency wiring, queue management, and API handling.
  • Adds helper regression tests and extends image-layout module-loading coverage.
File Description
src/​enclave/​image-layout.test.ts Adds loading checks for the three extracted modules.
src/​enclave/​executor-modules.test.ts Tests telemetry, settlement, cancellation, and workspace cleanup.
containers/​enclave/​script-executor/​executor-telemetry.js Isolates timing diagnostics and outcome mapping.
containers/​enclave/​script-executor/​executor-settlement.js Encapsulates settlement, cancellation tracking, and teardown.
containers/​enclave/​script-executor/​executor-invocation.js Contains validation, admission, budget debit, execution, and response handling.
containers/​enclave/​script-executor/​executor-handler.js Wires helpers together and retains queue and public API management.

Review effort: Max (adaptive)

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@lpcox
lpcox merged commit cc474d5 into main Nov 18, 2026
47 of 50 checks passed
@lpcox
lpcox deleted the copilot/refactor-executor-handler branch November 18, 2026 23:42
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.

[Refactoring] Split containers/enclave/script-executor/executor-handler.js into focused modules

3 participants