shmuelie / shmuelie/powershell-modules

Workspace YAML parsing interprets block-scalar text as session metadata

Open
#285 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug module:copilot theme:testing
Dominant language
PowerShell
Stars
0
Forks
0
Avg merge
21m
Merged PRs (30d)
124

Description

Peer-review finding

Reviewed snapshot: 5c38677469756c69f86678c0b907d82e15d0a539.
The reviewer and parent independently reproduced this against unchanged source.
Only fresh synthetic session homes and a fixed non-mutating native stub were
used; no real conversation history, user configuration or Copilot process was
accessed. Do not run destructive reproduction commands against real sessions.

Severity: Medium. Confidence: 10/10.
Suggested existing labels: bug, module:copilot.

Location: modules\Shmuelie.Copilot\WorkspaceYaml.ps1:117-132, especially
124-125. Both readers (204) and writers (277) use this helper.

Find-CopilotWorkspaceFieldLine searches every line with arbitrary leading
indentation, without excluding the body of a preceding block scalar. A literal
branch: ... inside a session's multiline display name is consequently read as
the session's branch when it precedes the real branch field. This is plain data,
not an authorized selector callback or an attempt to execute code.

Minimal public-surface reproduction:

Create a fake workspace in the following supported shape, with ordinary valid
timestamps and events:

id: 11111111-1111-1111-1111-111111111111
cwd: <existing-scratch-workspace>
name: Original
summary: Original
branch: main
created_at: 2026-09-01T12:00:00Z
updated_at: 2026-09-01T12:00:00Z

Then run, against the fake home:

$renamed = Rename-CopilotSession -Id $idA `
    -Summary "Review plan`nbranch: invented-branch" -Confirm:$false
$renamed.Branch
@(Get-CopilotSession -All -Branch main).Count

Actual: Branch is invented-branch; the main filter returns zero sessions,
although the physical top-level branch: main is still present and unchanged.
An independent in-memory example with cwd: inside an earlier name: |- block
likewise returns the block's text instead of the real top-level Cwd.

Expected: Literal block contents remain part of the name/summary. Renaming a
session must not alter the interpreted branch, Cwd, timestamps, or other metadata.

Acceptance criteria: Field lookup and replacement must distinguish mapping
fields from block-scalar bodies. Cover |, |-, >, and >-, field-like text
inside blocks, public Rename followed by discovery/filtering, and preservation of
existing supported indentation and line endings.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with modules\Shmuelie.Copilot\WorkspaceYaml.ps1, especially Find-CopilotWorkspaceFieldLine and its readers and writers around the cited lines, then run the supplied fake-home Rename-CopilotSession/Get-CopilotSession reproduction. Done means block-scalar contents no longer affect metadata lookup or replacement, including the listed scalar styles, indentation, line endings, and Rename followed by discovery/filtering.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, yaml
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.