## MODIFIED Requirements ### Requirement: Git branch as task execution unit 每个任务 SHALL 关联一个 Git 分支,无论哪种执行模式。Agent 在该分支上工作,通过 PR 提交结果。 #### Scenario: ssh_cli mode — Orchestrator creates branch - **WHEN** ssh_cli 模式任务开始执行 - **THEN** Orchestrator SHALL 在目标仓库创建分支 `task/{task_id}`(通过 SSH 在远程主机执行 `git checkout -b`) - **AND** 将分支名传入 Agent prompt #### Scenario: http_pull mode — Agent creates branch - **WHEN** http_pull 模式任务被 Agent 领取 - **THEN** Agent SHALL 自行创建分支 `task/{task_id}` ### Requirement: PR webhook as completion notification 无论哪种执行模式,Agent 完成任务后 SHALL 通过 Forgejo PR 触发状态更新。 #### Scenario: ssh_cli mode — Agent creates PR via CLI - **WHEN** ssh_cli 模式的 Agent 执行完成 - **THEN** Agent(或 Orchestrator 通过 SSH) SHALL push 到 task 分支并创建 PR - **AND** Forgejo PR webhook 触发状态更新 #### Scenario: http_pull mode — same flow - **WHEN** http_pull 模式的 Agent 执行完成 - **THEN** Agent SHALL push 到 task 分支并创建 PR - **AND** Forgejo PR webhook 触发状态更新(与 ssh_cli 模式相同) ### Requirement: Push events as progress tracking 无论哪种执行模式,Forgejo push webhook SHALL 作为进度信号。 #### Scenario: ssh_cli mode — push detected - **WHEN** ssh_cli 模式执行中,Agent push 到 task 分支 - **THEN** Orchestrator 更新 `last_activity_at`(与 http_pull 模式相同)