Skip to content

fix(automations): reliably deliver prompts to unattended agents - #2986

Open
BTM-cmd wants to merge 1 commit into
generalaction:mainfrom
BTM-cmd:fix/automation-initial-prompt-handoff
Open

fix(automations): reliably deliver prompts to unattended agents#2986
BTM-cmd wants to merge 1 commit into
generalaction:mainfrom
BTM-cmd:fix/automation-initial-prompt-handoff

Conversation

@BTM-cmd

@BTM-cmd BTM-cmd commented Aug 11, 2026

Copy link
Copy Markdown

Summary

  • route unattended PTY automations through ACP when the provider can only receive the initial prompt via synthetic keystrokes
  • preserve explicit ACP and normal argv-based PTY providers
  • verify Kimi receives the complete assignment as the structured first initialQueue turn and that startSession is called

Root cause

Automation persisted the full prompt, provisioned the task, and marked the run launched. Kimi PTY, however, starts without a prompt argument and depends on delayed synthetic paste/Enter into its TUI. A background card cannot recover if that injection is missed, leaving a running kimi-code process with no work. ACP sends the prompt as a protocol turn and acknowledges session startup.

Checks

  • pnpm run build
  • pnpm --filter @emdash/emdash-desktop run typecheck
  • pnpm --filter @emdash/emdash-desktop run lint
  • pnpm --filter @emdash/emdash-desktop exec vitest run src/main/core/automations/actions/taskCreate.test.ts --project node (16 passed)
  • git diff --check

Risk

This changes transport selection for background automations configured as PTY only when the provider advertises both keystroke-only prompt delivery and ACP support. Interactive/manual task behavior is unchanged.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR routes unattended automations through ACP when a provider supports ACP but can deliver PTY prompts only through synthetic keystrokes, ensuring the initial prompt is sent as a structured protocol turn.

  • Adds capability-based automation transport selection while preserving explicit ACP and argv-based PTY behavior.
  • Adds coverage confirming Kimi receives the full prompt through initialQueue and eagerly starts its ACP session.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The new capability check currently targets Kimi as intended, preserves explicit ACP and normal argv-based PTY paths, and supplies the prompt through the existing ACP initial-queue startup contract.

Important Files Changed

Filename Overview
apps/emdash-desktop/src/main/core/automations/actions/taskCreate.ts Adds capability-based transport resolution so unattended keystroke-only providers with ACP support receive prompts through an eagerly started ACP session.
apps/emdash-desktop/src/main/core/automations/actions/taskCreate.test.ts Adds focused coverage verifying Kimi PTY automation configuration is routed through ACP with the complete structured initial prompt.

Sequence Diagram

sequenceDiagram
  participant A as Automation Runner
  participant R as Provider Registry
  participant C as Conversation Store
  participant ACP as ACP Runtime
  A->>R: Read prompt and ACP capabilities
  alt Keystroke prompt and ACP supported
    R-->>A: Select ACP
    A->>C: Create ACP conversation with initialQueue
    A->>ACP: startSession(initialQueue)
  else Explicit ACP
    R-->>A: Preserve ACP
    A->>C: Create ACP conversation with initialQueue
    A->>ACP: startSession(initialQueue)
  else Normal PTY provider
    R-->>A: Select PTY
    A->>C: Create PTY conversation with initialPrompt
  end
Loading

Reviews (1): Last reviewed commit: "fix(automations): hand off keystroke pro..." | Re-trigger Greptile

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