Skip to content

[enhancement] Track session context changes during task execution #16

@github-actions

Description

@github-actions

Background

The Copilot SDK recently added session context tracking capabilities in PR #427 (included in v0.1.24, Feb 16, 2026). This enhancement, authored by Jeremy Moseley, introduces:

  1. SessionContext exposed in SessionMetadata - provides working directory, git root, repository, and branch information
  2. session.context_changed event - fires when working directory context changes between turns
  3. listSessions() filtering - ability to filter sessions by context fields (cwd, gitRoot, repository, branch)

Related SDK commits:

Proposal

Enhance Planeteer's execution screen to track and display when Copilot agent sessions change working directories during task execution. This would:

  1. Listen for session.context_changed events from each Copilot agent session during parallel task execution
  2. Display context changes in the event log alongside other session events (tool calls, outputs, etc.)
  3. Show current working directory for each running task in the execution UI
  4. Help users understand what directories agents are operating in, especially for tasks that span multiple repositories or workspaces

Benefit

This enhancement improves transparency and debugging during execution by:

  • Visibility: Users can see when an agent changes directories or switches git repositories during task execution
  • Debugging: When tasks fail, knowing the working directory context helps diagnose issues (e.g., running commands in wrong directory)
  • Multi-workspace support: For projects spanning multiple repos, users can verify agents are working in the correct context
  • Audit trail: The execution log becomes a complete record of not just what was done, but where it was done

Acceptance Criteria

  • Subscribe to session.context_changed events in src/services/executor.ts for each agent session
  • Display context change events in the execution screen event log with timestamp, task ID, and new context (cwd, repository, branch)
  • Show current working directory for each running task in the execution UI (e.g., next to task status)
  • Update the SessionEventWithTask type to include context change events
  • Add unit tests verifying context change events are captured and associated with the correct task
  • Update SDK dependency to ^0.1.24 or later in package.json if needed

AI generated by Weekly Enhancement Suggestions

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions