Skip to content

refactor: decouple execution events from Copilot SDK#389

Closed
spboyer wants to merge 1 commit into
mainfrom
spboyer-squad-10-decouple-execution-response-eve
Closed

refactor: decouple execution events from Copilot SDK#389
spboyer wants to merge 1 commit into
mainfrom
spboyer-squad-10-decouple-execution-response-eve

Conversation

@spboyer

@spboyer spboyer commented Jun 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Introduce provider-neutral models.SessionEvent and models.ToolExecutionResult types.
  • Change execution.ExecutionResponse.Events and transcript/tool-call consumers to use neutral events instead of copilot.SessionEvent.
  • Keep Copilot SDK event handling at the adapter boundary by converting SDK events inside internal/copilotevents / SessionEventsCollector.
  • Update tests to cover neutral transcript/event behavior while preserving current JSON output shape.

Closes #10

⚠️ This task was flagged as "needs review" — please have a squad member review before merging.

Scope

Phase 1 only: this does not add Phase 2 engine implementations.

Validation

  • go test ./... (fails on pre-existing baseline: internal/models TestLoadEvalSpec_MCPMocksRequireSchemaVersion11, reproduced before changes)
  • go test ./internal/models -run 'TestTranscriptEvent'
  • go test $(go list ./... | grep -v '/internal/models$')
  • make lint (after golangci-lint cache clean to clear stale worktree paths)
  • make build

Introduce provider-neutral session event and tool result types for ExecutionResponse and transcript consumers, with Copilot SDK conversion kept inside the Copilot event adapter.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 28, 2026 13:20

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.

Pull request overview

This PR refactors execution/transcript event handling to be provider-neutral by introducing models.SessionEvent / models.ToolExecutionResult, updating ExecutionResponse.Events and downstream consumers to use those types, and confining Copilot SDK event parsing/conversion to the Copilot adapter layer (internal/copilotevents + SessionEventsCollector).

Changes:

  • Added provider-neutral event/result models (internal/models/events.go) and updated transcript JSON marshalling/unmarshalling to preserve the existing output contract.
  • Updated execution responses, transcript builders, graders, CLI suggestion trace generation, and web API mapping to consume models.SessionEvent instead of copilot.SessionEvent.
  • Updated unit tests to construct and validate neutral event types.
Show a summary per file
File Description
internal/webapi/store.go Maps neutral transcript events into the web API response shape.
internal/webapi/additional_test.go Updates web API tests to use neutral tool-complete events/results.
internal/transcript/transcript.go Changes transcript builder to accept neutral session events.
internal/transcript/transcript_test.go Updates transcript tests to construct neutral events (adds string ptr helper).
internal/orchestration/runner_orchestration_test.go Updates orchestration tests to use neutral events and types.
internal/models/events.go Introduces SessionEventType, SessionEvent, ToolExecutionResult; updates transcript JSON (un)marshal + tool-call correlation.
internal/models/events_test.go Updates transcript event JSON round-trip tests for neutral event model.
internal/graders/inline_script_grader.go Adjusts grader stdin generation to pass neutral session events.
internal/graders/inline_script_grader_test.go Updates grader tests/helpers to use neutral session events.
internal/execution/session_events_collector.go Converts Copilot SDK events to neutral events at collection time.
internal/execution/session_events_collector_test.go Updates collector tests for neutral tool result type.
internal/execution/mock.go Updates mock engine response to use neutral events list.
internal/execution/engine.go Switches ExecutionResponse.Events to neutral events and updates message extraction.
internal/execution/engine_response_test.go Updates ExtractMessages tests for neutral events (adds string ptr helper).
internal/copilotevents/events.go Adds conversion from Copilot SDK SessionEvent / tool results into neutral models.
cmd/waza/cmd_run_suggest.go Updates suggestion trace extraction to read fields from neutral events.
cmd/waza/cmd_run_suggest_test.go Updates suggestion command tests to use neutral events/results.

Review details

  • Files reviewed: 17/17 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread internal/webapi/store.go
Comment on lines +352 to +354
r.Arguments = e.Arguments
r.Success = e.Success
r.ToolResult = e.ToolResult
@spboyer

spboyer commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

Closing in favor of #396 (smaller, green CI, latest iteration of this Phase-1 refactor).

@spboyer spboyer closed this Jun 30, 2026
@spboyer spboyer deleted the spboyer-squad-10-decouple-execution-response-eve branch June 30, 2026 14:13
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.

[E1] Decouple ExecutionResponse from Copilot SDK + Multi-Agent Engine Support

3 participants