Skip to content

feat: update GitHub.Copilot.SDK from v0.2.1 to v0.2.2#641

Merged
PureWeen merged 2 commits intomainfrom
update/copilot-sdk-latest
Apr 20, 2026
Merged

feat: update GitHub.Copilot.SDK from v0.2.1 to v0.2.2#641
PureWeen merged 2 commits intomainfrom
update/copilot-sdk-latest

Conversation

@PureWeen
Copy link
Copy Markdown
Owner

Changes

Updates all projects to GitHub.Copilot.SDK v0.2.2 and fixes all breaking changes.

Breaking Changes Addressed

Change Fix
SessionIdleData.BackgroundTasks removed Idle handler now uses tracked state from SessionBackgroundTasksChangedEvent (already implemented). HasActiveBackgroundTasks refactored to take BackgroundTaskSnapshot instead of SessionIdleEvent.
ModelApi.SwitchToAsync added ModelCapabilitiesOverride? param Pass null for default capabilities
CompactionApi removed (SessionRpc.Compaction) Already not adopted (events-only monitoring)
SessionIdleDataBackgroundTasks/AgentsItem/ShellsItem types removed Tests updated to use BackgroundTaskSnapshot and fake DTOs

New SDK Features (available, not yet adopted)

  • ISessionFsHandler — 10 filesystem methods for session-scoped file I/O
  • HistoryApi.TruncateAsync — truncate session history
  • ServerSessionsApi.ForkAsync — fork a session
  • ModelCapabilitiesOverride — vision support, token limits per model
  • ResumeSessionConfig.EnableConfigDiscovery/ModelCapabilities

Documentation

  • Updated copilot-sdk-reference skill to v0.2.2 with version history entry
  • Updated copilot-instructions.md SDK reference

Testing

All 3500 tests pass, 0 failures.

Breaking changes addressed:
- SessionIdleData.BackgroundTasks removed — idle handler now reads
  tracked state directly from DeferredBackgroundTaskFingerprint/Ticks
  (set by SessionBackgroundTasksChangedEvent). Does NOT call
  RefreshDeferredBackgroundTaskTracking(null) which would destroy
  tracked state. Preserves zombie timeout and carry-over shell logic.
- ModelApi.SwitchToAsync added ModelCapabilitiesOverride? parameter —
  pass null for default capabilities.
- CompactionApi removed — already not adopted (events-only monitoring).
- SessionIdleDataBackgroundTasks/AgentsItem/ShellsItem types removed —
  tests updated to use BackgroundTaskSnapshot and fake DTOs for
  reflection-based helpers.

New SDK features available (not yet adopted):
- ISessionFsHandler (10 filesystem methods)
- HistoryApi.TruncateAsync
- ServerSessionsApi.ForkAsync
- ModelCapabilitiesOverride (vision support, token limits)

Updated: copilot-sdk-reference skill, copilot-instructions.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PureWeen PureWeen force-pushed the update/copilot-sdk-latest branch from c102507 to 4025e87 Compare April 20, 2026 03:19
@PureWeen
Copy link
Copy Markdown
Owner Author

🔍 Multi-Model Code Review — PR #641

Reviewed by: 3 independent reviewers with adversarial consensus
Diff reviewed: +206/−288, 9 files (1 commit)
CI Status: ⚠️ Expert Code Review pending


Findings

🔴 CRITICAL — #1: RefreshDeferredBackgroundTaskTracking(state, null) destroyed tracked state (3/3)

Status:FIXED in force-push 4025e87

The initial commit passed null to RefreshDeferredBackgroundTaskTracking, which produced an empty snapshot AND cleared DeferredBackgroundTaskFingerprint and ticks — destroying the state that SessionBackgroundTasksChangedEvent had set up. This disabled IDLE-DEFER entirely.

Fix: Idle handler now reads state.DeferredBackgroundTaskFingerprint and DeferredBackgroundTasksFirstSeenAtTicks directly without calling RefreshDeferredBackgroundTaskTracking.

🟡 MODERATE — #2: Zombie timeout preserved inline (3/3)

Status:FIXED in force-push

The original change replaced HasActiveBackgroundTasks(idle, deferTicks) with tracking.Snapshot.HasAny, losing the zombie timeout logic. The fix adds inline zombie timeout checking using SubagentZombieTimeoutMinutes.

🟡 MODERATE — #3: Carry-over shell detection preserved (2/3)

Status:FIXED in force-push

onlyCarryOverShellsRemain was broken (always false from null snapshot). Now checks deferTicks < processingStartedAt directly.

🟢 MINOR — #4: Test fake DTOs duplicated across files (2/3)

Both BackgroundTasksIdleTests.cs and ZombieSubagentExpiryTests.cs define identical FakeBackgroundTasks/FakeAgent/FakeShell classes. Could share via a common helper. Non-blocking.

🟢 MINOR — #5: Gtk jumped from 0.2.0 to 0.2.2 (1/3)

Gtk project was on v0.2.0 while main was on v0.2.1. Skipping v0.2.1 is fine since Gtk shares source files via <Compile Include> and builds clean.


Summary

# Severity Finding Status
1 🔴 IDLE-DEFER disabled by null snapshot ✅ FIXED
2 🟡 Zombie timeout bypassed ✅ FIXED
3 🟡 Carry-over shell detection broken ✅ FIXED
4 🟢 Duplicate test helpers Non-blocking
5 🟢 Gtk version skip Non-blocking

Recommended Action

✅ Approve

All critical and moderate findings are fixed in the force-pushed commit. The idle handler correctly reads tracked state without mutating it, preserves zombie timeout and carry-over shell logic. 3500 tests pass, 0 failures.

@PureWeen
Copy link
Copy Markdown
Owner Author

/review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

Expert Code Review completed successfully!

@github-actions
Copy link
Copy Markdown
Contributor

Additional Findings (Design-Level)

🟡 MODERATE — idlePayloadIsStale detection is now dead code (Flagged by: 2/3 reviewers)

In CopilotService.Events.cs lines 989–1006: preIdleFingerprint and currentFingerprint now read the same field (state.DeferredBackgroundTaskFingerprint) with no mutation between reads. The old code called RefreshDeferredBackgroundTaskTracking between them — that was the mutation the stale detection was guarding against. With SDK v0.2.2, no mutation occurs, so idlePayloadIsStale is logically impossible: if preIdleTicks == 0 then deferTicks == 0, which makes hasTrackedTasks false (requires deferTicks > 0). The safety net is dead code that gives false confidence.

Recommendation: Remove the preIdle* variables and idlePayloadIsStale check, or redesign the stale detection for the v0.2.2 model where SessionBackgroundTasksChangedEvent is the sole source of truth.


🟢 MINOR — GroupCreationConcurrencyTests deleted with no replacement (Flagged by: 3/3 reviewers)

Three tests in SessionOrganizationTests.cs validated that concurrent GetOrCreateRepoGroup/GetOrCreateLocalFolderGroup/PromoteOrCreateLocalFolderGroup calls produced exactly one group. These were the only thread-safety tests for group creation and should be restored as regression guards, regardless of the synchronization mechanism used.

Generated by Expert Code Review for issue #641 ·

- processing-state-safety SKILL.md: CompactionApi → HistoryApi.CompactAsync,
  mark InfiniteSessions as adopted, add TruncateAsync and ForkAsync entries
- copilot-instructions.md: update SessionIdleData docs — BackgroundTasks
  removed in v0.2.2, tracking now via SessionBackgroundTasksChangedEvent

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant