Skip to content

feat: batch PM work into hourly autopilot sweep#7

Merged
gf5901 merged 2 commits into
mainfrom
feat/pm-hourly-sweep
Mar 22, 2026
Merged

feat: batch PM work into hourly autopilot sweep#7
gf5901 merged 2 commits into
mainfrom
feat/pm-hourly-sweep

Conversation

@gf5901
Copy link
Copy Markdown
Owner

@gf5901 gf5901 commented Mar 22, 2026

Summary

  • PM now runs on a schedule, not reactively. Instead of the poller triggering PM chat replies within 15 seconds, messages queue up and the hourly Autopilot Lambda triggers run_task.py --pm-reply via SSM. The PM processes all accumulated chat messages AND reviews human-assigned tasks with pending replies in a single agent session.
  • Human-assigned task replies handled by the PM. When a human comments on a PM-created task (e.g. answering a DNS confirmation question), the generic comment reply agent no longer runs. Instead, the PM reviews the response during its next sweep and can mark the task complete, post follow-ups, or create engineering tasks.
  • Comment reply prompts now include task context. Both the regular COMMENT_REPLY_PROMPT and new HUMAN_TASK_REPLY_PROMPT include the task title and description, so the agent understands what it's replying to.

Files changed (13)

Area Files What
Poller run_poller.py Remove PM reply spawning; skip human tasks with project_id in reply loop
PM Agent src/pm_agent.py Enhanced run_pm_reply to load human tasks, build context, process complete_tasks/reply_to_tasks JSON actions
Pipeline src/pipeline.py New HUMAN_TASK_REPLY_PROMPT; run_comment_reply defers human+project tasks to PM, uses task-aware prompts
Store src/dynamo_store.py New list_human_reply_pending_for_project() using project-index GSI
Lambda API infra/packages/api/src/routes/tasks.ts Comment endpoint sets reply_pending on PROJECT for human-assigned tasks
Autopilot Lambda infra/packages/autopilot/src/index.ts Scans for reply_pending projects, triggers PM sweep via SSM
Types infra/packages/api/src/lib/types.ts Updated comment on reply_pending
Docs AGENTS.md, src/AGENTS.md, docs/dynamo-schema.md, .cursor/rules/project-conventions.mdc Updated to reflect new PM sweep flow
Tests tests/test_runner_helpers.py 3 new tests: human task deferred to PM, human task fallback prompt, task context in prompts

Test plan

  • All 331 existing tests pass
  • 3 new tests for human-assigned task comment reply behavior
  • No TypeScript errors in changed Lambda files
  • Deploy Autopilot Lambda (SST) to activate hourly PM sweep
  • Post a project chat message → verify it queues (no immediate reply) → verify PM replies on next hourly tick
  • Comment on a human-assigned task with a project → verify poller skips it → PM handles it on next sweep

Made with Cursor

gf5901 added 2 commits March 22, 2026 00:59
Instead of the poller triggering PM chat replies immediately, queue them
for the hourly Autopilot Lambda. The PM now processes all accumulated
chat messages AND reviews human-assigned tasks with pending replies in a
single agent session, which gives it full context to acknowledge
responses, mark tasks complete, or create follow-up work.

Key changes:
- Poller no longer spawns --pm-reply; skips human-assigned tasks with a
  project_id in the reply loop (PM handles them)
- Autopilot Lambda scans for projects with reply_pending and triggers
  run_task.py --pm-reply via SSM alongside plan proposals
- PM prompt updated with complete_tasks / reply_to_tasks JSON actions so
  the PM can mark human tasks done or post follow-ups
- Comment API sets reply_pending on the PROJECT record when a
  human-assigned task gets a comment (so the Lambda picks it up)
- run_comment_reply uses task-aware prompts with title/description
  context; human tasks without a project use a dedicated
  HUMAN_TASK_REPLY_PROMPT that prevents the agent from executing work
- New DynamoTaskStore.list_human_reply_pending_for_project() helper
- Updated docs, AGENTS.md, project-conventions rule, dynamo-schema

Made-with: Cursor
@gf5901 gf5901 merged commit 87ddf76 into main Mar 22, 2026
4 checks passed
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