Summary
The Copilot session tooling contains two independently-written, regex-based
YAML parsers for the same workspace.yaml format, plus a fragile
string-matching heuristic — all without tests.
Details
Get-CopilotLaunchPlan.ps1 (~lines 700-720) parses cwd/summary/name/
branch out of workspace.yaml with one set of regexes.
SessionMaintenance.ps1 Merge-CopilotSession (~lines 237-259) rewrites
the name: field with a different, independently-written block-scalar
handler.
Because neither uses a real YAML parser, an edge case (folded > scalars,
different indentation, quoted flow scalars, CRLF vs LF) may be read correctly in
one place and mis-parsed/corrupted in the other, and a fix in one won't apply to
the other.
Get-CopilotLaunchPlan.ps1 ($ignoredSessionNames, ~line 700) excludes
auto-generated maintenance sessions from auto-resume by matching the session
name against verbatim hardcoded copies of the Copilot CLI's internal
maintenance-prompt text. Any upstream wording/punctuation/localization change
silently breaks the exclusion (maintenance sessions start appearing as
resumable), with nothing to catch the drift.
Recommendation
- Extract one shared internal helper
(Get-CopilotWorkspaceField / Set-CopilotWorkspaceField) used by both call
sites.
- Prefer a stable signal (a session kind/purpose field, tag, or naming prefix)
over verbatim prompt-text matching; if none exists, add a regression test that
fails loudly when the upstream session shape no longer matches.
- Add unit tests covering quoted values, block scalars (
|, |-, >, >-),
and CRLF content.
Filed from an automated peer review (Skeptic persona); please validate before acting.
Summary
The Copilot session tooling contains two independently-written, regex-based
YAML parsers for the same
workspace.yamlformat, plus a fragilestring-matching heuristic — all without tests.
Details
Get-CopilotLaunchPlan.ps1(~lines 700-720) parsescwd/summary/name/branchout ofworkspace.yamlwith one set of regexes.SessionMaintenance.ps1Merge-CopilotSession(~lines 237-259) rewritesthe
name:field with a different, independently-written block-scalarhandler.
Because neither uses a real YAML parser, an edge case (folded
>scalars,different indentation, quoted flow scalars, CRLF vs LF) may be read correctly in
one place and mis-parsed/corrupted in the other, and a fix in one won't apply to
the other.
Get-CopilotLaunchPlan.ps1($ignoredSessionNames, ~line 700) excludesauto-generated maintenance sessions from auto-resume by matching the session
nameagainst verbatim hardcoded copies of the Copilot CLI's internalmaintenance-prompt text. Any upstream wording/punctuation/localization change
silently breaks the exclusion (maintenance sessions start appearing as
resumable), with nothing to catch the drift.
Recommendation
(
Get-CopilotWorkspaceField/Set-CopilotWorkspaceField) used by both callsites.
over verbatim prompt-text matching; if none exists, add a regression test that
fails loudly when the upstream session shape no longer matches.
|,|-,>,>-),and CRLF content.
Filed from an automated peer review (Skeptic persona); please validate before acting.