Skip to content

Seed Scratch Manager briefs from the .md file only; never paste them (CROW-1327) - #1328

Merged
dgershman merged 1 commit into
mainfrom
feature/crow-1327-scratch-brief-file-seed
Oct 13, 2026
Merged

dgershman merged 1 commit into
mainfrom
feature/crow-1327-scratch-brief-file-seed

Conversation

@dgershman

@dgershman dgershman commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1327

Problem

todo explore / todo ticket wrote the brief to $TMPDIR/crow-explore-<session>.md and launched the Manager with it as argv (CROW-1237) — then also pasted the full multi-line brief via sendToManager, retried Enter, and re-pasted it when the agent looked idle. On a slow SessionStart that second copy landed offset (2026-10-13 repro: the Manager's prompt began at Scratch item, preamble gone).

Change

The .md file is the single source of truth for the seed.

  • Fresh Manager: seeded by its launch command alone. Nothing is pasted afterwards. seeded = brief file written && pane appeared.
  • Live Manager (re-Explore, Ticket on an alive Manager): rewrite the file and type one line — Read and follow the instructions in <path>.
  • sendToManager (pointer line + todo talk only) types one line and retries a bare Enter at most once. The full re-paste and the accepted-prompt polling (promptWasAccepted, agentAnnouncePolls) are removed — the latter were only there to guess whether the argv seed had started.
  • New TodoRPC.writeBriefFile / briefPointer / briefDelivery; exploreSeedLaunchCommand uses writeBriefFile.
  • Warnings on seeded: false now say what actually failed instead of "still starting".
  • Docs: CLAUDE.md, docs/cli-reference.md, ADR 0026 wording, CHANGELOG.

Tests

  • freshManagerSeedsViaArgvWithNoFollowUpPaste — for Claude Code, Cursor, Codex, Grok, OpenCode: the file holds the complete brief (first line intact), the launch command reads it, delivery is .launchArgv (no paste).
  • aliveManagerGetsOnlyThePointerLine — delivery is a single-line pointer, never brief text.
  • unwrittenBriefDeliversNothing.
  • swift test --package-path Packages/CrowEngine --filter TodoRPCSupportTests — 21/21 pass. swift build --package-path Packages/CrowDaemon clean (CrowDaemon tests not run on host — they boot crowd).

Not verified

Repeated cold launches across all five harnesses in a live Crow (the ticket's manual acceptance check) — please run crow todo ticket / todo explore a few times per harness after merge.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…(CROW-1327)

Opening a Manager from a Scratch item launched the agent with the brief
file as argv, then also pasted the full multi-line brief, retried Enter,
and re-pasted it. On a slow SessionStart that second copy landed offset,
so the agent got the raw scratch text without the instruction preamble.

- Fresh Manager: the launch command is the only delivery; no paste.
- Live Manager (re-Explore, Ticket on an alive Manager): rewrite the brief
  file and type one line, "Read and follow the instructions in <path>".
- sendToManager types one line and retries a bare Enter at most once; the
  full re-paste and dead accepted-prompt polling are removed.
- TodoRPC.writeBriefFile / briefPointer / briefDelivery with tests for both
  paths across Claude Code, Cursor, Codex, Grok and OpenCode.

🐦‍⬛ Generated with Claude Code, orchestrated by Crow

Co-Authored-By: Claude <noreply@anthropic.com>
Crow-Session: A0C5CB89-F00F-4D80-A8DA-23D095CAAB0C
@dgershman dgershman added the crow:merge Crow auto-merge on green label Oct 13, 2026
@dgershman
dgershman enabled auto-merge (squash) October 13, 2026 16:24

@dhilgaertner dhilgaertner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code & Security Review

Critical Issues (if any)

None.

Architecture / Existing Patterns

  • Existing pathway: CROW-1237 argv seed — ManagerSessionController.exploreSeedLaunchCommand writes $TMPDIR/crow-explore-<session>.md and wraps the Manager launch with ShellLaunchArgs.evalPromptLaunch (same shape as jobs / #408). sendToManager in TodoRPCHandlers.swift was the leftover paste fallback after that seed.
  • This change extends that path instead of replacing it. Fresh Managers stay argv-only; live Managers get a one-line pointer through the existing typer. Dropping promptWasAccepted and agentAnnouncePolls is the right cut: those existed to guess whether the argv seed had started so a second copy of the brief could be skipped or re-pasted.
  • Green: #1327 asked for a pointer fallback on a fresh Manager if a harness ignores positional argv. This PR does not add that arm — it matches the job launch (argv or nothing). The description already marks repeated cold launches across the five harnesses as unverified.

Security Review

Strengths:

  • The brief path is NSTemporaryDirectory() plus a session UUID (TodoRPCSupport.swift explorePromptPath), not derived from scratch text, so the pointer line cannot be steered at an attacker-chosen file.
  • writeBriefFile refuses whitespace-only bodies and writes atomically. Live Managers never put the multi-line brief (backticks, gh issue create, crow todo link) into a TUI that might still be zsh.
  • sendToManager no longer re-sends the payload. A second full paste was the offset/truncation failure this ticket exists to stop.

Concerns:

  • None that are defects in this diff. managerTerminal still takes appState.terminals[sessionID]?.first rather than isAgentSurface; that is pre-existing on the talk path. A one-line pointer landing in a still-starting shell is safer than the old 20-line brief.

Code Quality

  • Green: freshManagerSeedsViaArgvWithNoFollowUpPaste in TodoRPCSupportTests.swift checks exploreSeedLaunchCommand and briefDelivery == .launchArgv. It does not run openScratchManager, which is the site that used to call sendToManager(..., text: brief). The handler change is the actual "no follow-up paste" guarantee.
  • swift test --package-path Packages/CrowEngine --filter TodoRPCSupportTests — 21/21 passed. swift build --package-path Packages/CrowDaemon — clean.

Summary Table

Color Meaning Verdict effect
Red Must fix Request changes
Yellow Should fix Request changes
Green Consider Approve allowed

Recommendation: Approve — driven by 0 Red, 0 Yellow, 2 Green findings.


🐦‍⬛ Reviewed by Crow via Cursor

@dgershman
dgershman merged commit e883508 into main Oct 13, 2026
5 checks passed
@dgershman
dgershman deleted the feature/crow-1327-scratch-brief-file-seed branch October 13, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crow:merge Crow auto-merge on green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scratch → Manager: seed the brief from a pre-written .md file only; stop pasting it into the TUI

2 participants