feat: batch PM work into hourly autopilot sweep#7
Merged
Conversation
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
Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run_task.py --pm-replyvia SSM. The PM processes all accumulated chat messages AND reviews human-assigned tasks with pending replies in a single agent session.COMMENT_REPLY_PROMPTand newHUMAN_TASK_REPLY_PROMPTinclude the task title and description, so the agent understands what it's replying to.Files changed (13)
run_poller.pyproject_idin reply loopsrc/pm_agent.pyrun_pm_replyto load human tasks, build context, processcomplete_tasks/reply_to_tasksJSON actionssrc/pipeline.pyHUMAN_TASK_REPLY_PROMPT;run_comment_replydefers human+project tasks to PM, uses task-aware promptssrc/dynamo_store.pylist_human_reply_pending_for_project()using project-index GSIinfra/packages/api/src/routes/tasks.tsreply_pendingon PROJECT for human-assigned tasksinfra/packages/autopilot/src/index.tsreply_pendingprojects, triggers PM sweep via SSMinfra/packages/api/src/lib/types.tsreply_pendingAGENTS.md,src/AGENTS.md,docs/dynamo-schema.md,.cursor/rules/project-conventions.mdctests/test_runner_helpers.pyTest plan
Made with Cursor