Skip to content

fix(orch): read gates and standing orders containing Unicode line separators - #829

Open
rudycelekli wants to merge 1 commit into
cursor:mainfrom
rudycelekli:fix/orch-line-separators-20261023
Open

rudycelekli wants to merge 1 commit into
cursor:mainfrom
rudycelekli:fix/orch-line-separators-20261023

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

orch gate park and orch standing add only fold \n and \r out of their text, but the readers parse each line with regexes whose . does not match the other JavaScript line terminators, U+2028 and U+2029. Text pasted from a web page, PDF, or model output can contain these characters. The write succeeds, but every later read of the file then throws. One gate question with U+2028 makes gates.md report "has a malformed gate", which breaks gate list, gate park, gate resolve, and orch status until someone edits the file by hand. The same thing in a standing order breaks standing show and standing add with "malformed numbering". When a unit state contains one, orch status cannot read back its previous summary comment and reports "first render" on every run.

The gate field, standing-order, and status-summary patterns now use the s flag, so . matches the entire value. Each file is still split on \n first, so line-based parsing works as before, and stores already damaged this way read correctly again. The Claude Code harness copy is regenerated.

Validation: added "reads back gates, standing orders, and status containing Unicode line separators" to orch/orch.test.ts. On origin/main it fails with "gates.md has a malformed gate release". With only the gate and standing fixes it still fails because the second status render reports "first render". With the full fix, bun test --timeout 900000 orch gives 22 pass and 0 fail. Also ran npm install --no-save ajv ajv-formats && node scripts/validate-plugins.mjs && node scripts/generate-pstack-harness-trees.mjs --check && node --test pstack/skills/*/scripts/test/*.test.mjs (57 pass, 0 fail, 93 skipped without TLC) and git diff --check.


Note

Low Risk
Localized parser regex changes for edge-case Unicode; behavior for normal \n/\r text is unchanged, with new regression coverage.

Overview
Fixes orch store read paths that broke when pasted text contained JavaScript Unicode line terminators (U+2028 / U+2029). Writers already accepted that text, but parsers used . without the s flag, so gates.md, preferences.md, and the status.md summary comment could fail on read and block gate/standing/status commands until manual edits.

store.ts adds the s flag to the gate field, standing-order line, and <!-- orch-summary ... --> regexes so captured values include those characters. Line splitting on \n is unchanged.

orch.test.ts adds a test that parks a gate and standing order with U+2028/U+2029, sets a unit state with U+2028, and asserts round-trip list/show and stable status changed (not "first render" every time).

Reviewed by Cursor Bugbot for commit 86a56e6. Bugbot is set up for automated code reviews on this repo. Configure here.

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