Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

Phase 5.21: stop parse_priority at task: delimiter (sync OSS sutando) - #89

Merged
jgluck96 merged 1 commit into
dev-clientfrom
josh/phase-5.21-task-priority-stop-at-task
Jun 2, 2026
Merged

jgluck96 merged 1 commit into
dev-clientfrom
josh/phase-5.21-task-priority-stop-at-task

Conversation

@jgluck96

@jgluck96 jgluck96 commented Jun 2, 2026

Copy link
Copy Markdown

Summary

Closes a priority-escalation injection vector in parse_priority_from_text. Task files place task: last, with the user-supplied body following. The parser previously stopped scanning only on --- or a blank line — not on task: — so a forged body line priority: urgent after task: could escalate priority. OSS sutando fixes this by stopping at the first task: line; this PR ports that change verbatim.

What changes

  • src/task_priority.py: add task: to the header-scan stop condition (one behavioral line + docstring)
  • tests/task-priority.test.py: fix header fixture field order (priority: before task: — matches writer convention)
  • tests/task-priority-stop-at-task-delimiter.test.py: 6 regression cases (new file, ported from OSS)

Why minimal divergence

  • Single-function, 1-line behavioral fix
  • Function body now byte-identical to OSS
  • No new dependencies or path-resolution changes

Test plan

  • Legitimate priority: urgent header before task: → parsed as urgent
  • Forged priority: urgent after task: → ignored (returns normal) — core regression
  • No priority header → normal
  • Legacy --- separator still breaks scan
  • Legacy blank-line separator still breaks scan
  • Accidental priority: word in multi-paragraph body → ignored
  • 62/62 Python tests pass (61 prior + 1 new file)

Phase context

Phase Subject PR
5.20 conversation-store per-surface tables #88
5.21 task_priority stop-at-task delimiter (this)

Made with Cursor

Task files place `task:` last, with the user-supplied body following.
`parse_priority_from_text` scans line-by-line for `priority:` headers.
Before this PR it stopped only on `---` or a blank line — not on `task:`.
A forged body line `priority: urgent` after `task:` was still matched,
escalating priority via the task-body injection vector.

OSS sutando closes this by stopping at the first `task:` line (everything
after is opaque body). This PR ports that one-line behavioral change
verbatim. The function body is now identical to OSS.

Also updates the existing task-priority.test.py header fixture to place
`priority:` before `task:` (the writer convention), and adds
task-priority-stop-at-task-delimiter.test.py with 6 regression cases.

Verification: 62/62 Python tests pass.
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant