Add optional Remote Control for task sessions#557
Conversation
|
#559 Makes "suppresses the task-guidance system-prompt preamble" irrelevant. |
Lets a task opt into launching its Claude session as a remote-drivable (--remote-control) session, so it appears at claude.ai/code and on phone while remaining ty-managed. - RemoteControl flag on tasks (DB column + CreateTask/UpdateTask + scans) - ty create --remote-control; remote_control on taskyou_create_task MCP tool - Executor launches claude with --remote-control and suppresses the task-guidance preamble + initial prompt for RC (interactive) sessions
Extract the triplicated Remote Control flag logic into a single rcFlag(task) helper alongside effortFlag/claudePermissionFlag, and replace the two inlined blocks at the claude launch sites with calls to it. Behavior is byte-identical; the systemPromptFlag/promptArg RC-suppression stays inline. Add tests: - internal/db: RemoteControl CreateTask -> GetTask round-trip (true and default-false). - internal/executor: rcFlag unit test (enabled contains flag + name, disabled empty, empty title falls back to task-<id>). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ves the injection)
89abc13 to
dfe12c9
Compare
…ommand injection rcFlag built the flag with fmt's %q (Go-string quoting), then the result is concatenated into a script run via `sh -c`. %q does not escape $, backticks, etc., so a task title like $(...) or `...` executed arbitrary commands. Titles are arbitrary user/MCP/daemon-supplied text, so this was a real injection vector. Quote the name with proper shell single-quoting instead. Adds a regression test that runs the flag through `sh` and asserts injected commands never fire. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Pushed a fix directly to this branch ( Why: This matters because task titles are arbitrary text and can arrive from the MCP Fix: quote the name with proper shell single-quoting ( The flag itself is correct and the rest of the PR is clean — nice, well-scoped feature with good gating and tests. A few non-blocking notes I had while reviewing (no changes made, your call):
|
Add optional Remote Control for task sessions
What
Adds an opt-in
--remote-controlmode for tasks. When enabled, a task launches itsClaude session as a remote-drivable session (
claude --remote-control "<name>"),so it appears at claude.ai/code and in the phone app — while remaining fully ty-managed
(status tracking,
ty input/ty output).RemoteControl boolon theTaskmodel — DB columnremote_control(default0,with migration), wired through
CreateTask/UpdateTaskand all scan sites.ty create --remote-controlflag.remote_controlboolean on thetaskyou_create_taskMCP tool.--remote-control "<title>"(falls back totask-<id>).For remote-control (interactive) sessions it skips the initial piped task prompt, so the
human gets a clean interactive session to drive. Non-RC behavior is byte-identical.
(The hardcoded task-guidance system prompt is removed separately in Remove hardcoded TASK GUIDANCE; default 'code' task type owns it instead #559; this PR no
longer touches it.)
Why
Some tasks are better driven interactively by a human (from the web or phone) while still
benefiting from ty's queue, worktree isolation, and status tracking. This makes that a
first-class, opt-in option instead of an either/or choice.
How tested
go build ./...clean;go vet ./...clean;go test ./internal/executor/... ./internal/db/...passing.and the session is drivable by both Remote Control and
ty input/ty output.Notes
permission-mode disambiguation is intentionally left to Disambiguate "auto" permission mode from Claude Code auto mode (label as "accept edits") #556.