Skip to content

[External] Copilot SDK: BackgroundTasks agents/shells counts deserialize as -1 when null #539

@PureWeen

Description

@PureWeen

Problem

SessionIdleData.BackgroundTasks reports agents=-1 and shells=-1 when the field is null/missing in the JSON payload, instead of using nullable int? types.

Impact on PolyPilot

PolyPilot must check both bt == null AND agents == -1 to determine if background task info is available:

var bt = idle.Data?.BackgroundTasks;
var agentCount = bt?.Agents ?? -1;
var shellCount = bt?.Shells ?? -1;
// Is this 'no background tasks' or 'data not available'? Can't tell from -1.

This ambiguity means we can't distinguish between 'zero sub-agents running' and 'the server didn't report background task status'. The IDLE-DEFER logic has to treat null/missing as 'no deferral needed' (assumption, not fact).

Desired SDK Behavior

BackgroundTasks.Agents and BackgroundTasks.Shells should be int? (nullable). null = not reported, 0 = none active, >0 = active count.

SDK Reference

GitHub.Copilot.SDK v0.2.1 — SessionIdleData, SessionBackgroundTasks

Metadata

Metadata

Assignees

No one assigned

    Labels

    externalUpstream bug or dependency issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions