{
  "automationId": "github-repo-monitor",
  "description": "Direct scheduled setup. Every create request body below is verified against the live CreatePromptAutomationRequest model in OpenHands/automation (openhands/automation/preset_router.py).",
  "capabilities": "supported",
  "blockedBy": [
    "notReady"
  ],
  "scenarios": [
    {
      "id": "happy-path",
      "description": "Defaults plus a repository and a base branch. Preflight passes, the automation is created.",
      "formValues": {
        "repository": "OpenHands/agent-server-gui",
        "triggerPhrase": "@openhands",
        "ref": "main",
        "schedule": "*/15 * * * *",
        "timezone": "UTC"
      },
      "preflight": {
        "request": {
          "method": "POST",
          "path": "/v1/validate",
          "body": {
            "automationId": "github-repo-monitor",
            "endpoint": "/v1/preset/prompt",
            "draft": {
              "name": "GitHub repository monitor - OpenHands/agent-server-gui",
              "prompt": "Poll OpenHands/agent-server-gui for any new issue or pull request comments since the last run. For every comment mentioning '@openhands', read the surrounding issue or pull request context and post a helpful reply as a comment on the same thread.",
              "repos": [
                {
                  "url": "OpenHands/agent-server-gui",
                  "provider": "github",
                  "ref": "main"
                }
              ],
              "trigger": {
                "type": "cron",
                "schedule": "*/15 * * * *",
                "timezone": "UTC"
              },
              "template": {
                "id": "github-repo-monitor",
                "version": "1.0.0",
                "config": {
                  "repository": "OpenHands/agent-server-gui",
                  "triggerPhrase": "@openhands",
                  "ref": "main",
                  "schedule": "*/15 * * * *",
                  "timezone": "UTC"
                }
              }
            }
          }
        },
        "response": {
          "status": 200,
          "body": {
            "valid": true,
            "errors": []
          }
        }
      },
      "create": {
        "request": {
          "method": "POST",
          "path": "/v1/preset/prompt",
          "body": {
            "name": "GitHub repository monitor - OpenHands/agent-server-gui",
            "prompt": "Poll OpenHands/agent-server-gui for any new issue or pull request comments since the last run. For every comment mentioning '@openhands', read the surrounding issue or pull request context and post a helpful reply as a comment on the same thread.",
            "repos": [
              {
                "url": "OpenHands/agent-server-gui",
                "provider": "github",
                "ref": "main"
              }
            ],
            "trigger": {
              "type": "cron",
              "schedule": "*/15 * * * *",
              "timezone": "UTC"
            },
            "template": {
              "id": "github-repo-monitor",
              "version": "1.0.0",
              "config": {
                "repository": "OpenHands/agent-server-gui",
                "triggerPhrase": "@openhands",
                "ref": "main",
                "schedule": "*/15 * * * *",
                "timezone": "UTC"
              }
            }
          }
        },
        "response": {
          "status": 201,
          "body": {
            "id": "b2d47c10-5a91-4e3f-8c62-1d7a9f0e4c33",
            "user_id": "1a2b3c4d-0000-4000-8000-000000000001",
            "org_id": "1a2b3c4d-0000-4000-8000-000000000002",
            "model": null,
            "name": "GitHub repository monitor - OpenHands/agent-server-gui",
            "prompt": "Poll OpenHands/agent-server-gui for any new issue or pull request comments since the last run. For every comment mentioning '@openhands', read the surrounding issue or pull request context and post a helpful reply as a comment on the same thread.",
            "preset_metadata": {
              "preset_type": "prompt",
              "prompt": "Poll OpenHands/agent-server-gui for any new issue or pull request comments since the last run. For every comment mentioning '@openhands', read the surrounding issue or pull request context and post a helpful reply as a comment on the same thread.",
              "repos": [
                {
                  "url": "OpenHands/agent-server-gui",
                  "ref": "main",
                  "provider": "github"
                }
              ],
              "template": {
                "id": "github-repo-monitor",
                "version": "1.0.0",
                "config": {
                  "repository": "OpenHands/agent-server-gui",
                  "triggerPhrase": "@openhands",
                  "ref": "main",
                  "schedule": "*/15 * * * *",
                  "timezone": "UTC"
                }
              }
            },
            "trigger": {
              "type": "cron",
              "schedule": "*/15 * * * *",
              "timezone": "UTC"
            },
            "tarball_path": "oh-internal://uploads/c41e7b28-9d05-4a6b-8f13-2e5c7a90d146",
            "setup_script_path": "setup.sh",
            "entrypoint": ".venv/bin/python main.py",
            "timeout": 600,
            "keep_alive": null,
            "enabled": true,
            "last_triggered_at": null,
            "created_at": "2026-07-27T12:00:00Z",
            "updated_at": "2026-07-27T12:00:00Z"
          }
        }
      }
    },
    {
      "id": "interval-below-deployment-minimum",
      "description": "A one-minute schedule. The create model accepts it, so only the deployment can reject it - this is precisely why preflight exists and why local validation is not authoritative.",
      "formValues": {
        "repository": "OpenHands/agent-server-gui",
        "triggerPhrase": "@openhands",
        "ref": "main",
        "schedule": "*/1 * * * *",
        "timezone": "UTC"
      },
      "preflight": {
        "request": {
          "method": "POST",
          "path": "/v1/validate",
          "body": {
            "automationId": "github-repo-monitor",
            "endpoint": "/v1/preset/prompt",
            "draft": {
              "name": "GitHub repository monitor - OpenHands/agent-server-gui",
              "prompt": "Poll OpenHands/agent-server-gui for any new issue or pull request comments since the last run. For every comment mentioning '@openhands', read the surrounding issue or pull request context and post a helpful reply as a comment on the same thread.",
              "repos": [
                {
                  "url": "OpenHands/agent-server-gui",
                  "provider": "github",
                  "ref": "main"
                }
              ],
              "trigger": {
                "type": "cron",
                "schedule": "*/1 * * * *",
                "timezone": "UTC"
              },
              "template": {
                "id": "github-repo-monitor",
                "version": "1.0.0",
                "config": {
                  "repository": "OpenHands/agent-server-gui",
                  "triggerPhrase": "@openhands",
                  "ref": "main",
                  "schedule": "*/1 * * * *",
                  "timezone": "UTC"
                }
              }
            }
          }
        },
        "response": {
          "status": 200,
          "body": {
            "valid": false,
            "errors": [
              {
                "field": "trigger.schedule",
                "code": "interval_too_short",
                "message": "Minimum interval for this deployment is 5 minutes."
              }
            ]
          }
        }
      },
      "expectedFieldErrors": {
        "schedule": "Minimum interval for this deployment is 5 minutes."
      }
    },
    {
      "id": "unfireable-cron-rejected-at-create",
      "description": "31 February. Syntactically valid, so a local check passes, but the service rejects it. Shows the real 422 body: detail is a list and the loc path carries the trigger discriminator tag.",
      "formValues": {
        "repository": "OpenHands/agent-server-gui",
        "triggerPhrase": "@openhands",
        "ref": "main",
        "schedule": "0 0 31 2 *",
        "timezone": "UTC"
      },
      "create": {
        "request": {
          "method": "POST",
          "path": "/v1/preset/prompt",
          "body": {
            "name": "GitHub repository monitor - OpenHands/agent-server-gui",
            "prompt": "Poll OpenHands/agent-server-gui for any new issue or pull request comments since the last run. For every comment mentioning '@openhands', read the surrounding issue or pull request context and post a helpful reply as a comment on the same thread.",
            "repos": [
              {
                "url": "OpenHands/agent-server-gui",
                "provider": "github",
                "ref": "main"
              }
            ],
            "trigger": {
              "type": "cron",
              "schedule": "0 0 31 2 *",
              "timezone": "UTC"
            },
            "template": {
              "id": "github-repo-monitor",
              "version": "1.0.0",
              "config": {
                "repository": "OpenHands/agent-server-gui",
                "triggerPhrase": "@openhands",
                "ref": "main",
                "schedule": "0 0 31 2 *",
                "timezone": "UTC"
              }
            }
          }
        },
        "response": {
          "status": 422,
          "body": {
            "detail": [
              {
                "type": "value_error",
                "loc": [
                  "body",
                  "trigger",
                  "cron",
                  "schedule"
                ],
                "msg": "Value error, Cron expression cannot produce any future fire times: 0 0 31 2 *"
              }
            ]
          }
        }
      },
      "expectedFieldErrors": {
        "schedule": "Value error, Cron expression cannot produce any future fire times: 0 0 31 2 *"
      }
    },
    {
      "id": "short-repo-url-without-provider-is-rejected",
      "description": "The mapping bug this fixture set exists to prevent. A short owner/repo URL without an explicit provider is a hard 422, because CreatePromptAutomationRequest is extra-forbid and RepoSource requires the provider. The setup block's payload always sets it; this records what happens if that is ever dropped.",
      "formValues": {
        "repository": "OpenHands/agent-server-gui",
        "triggerPhrase": "@openhands",
        "ref": "main",
        "schedule": "*/15 * * * *",
        "timezone": "UTC"
      },
      "create": {
        "request": {
          "method": "POST",
          "path": "/v1/preset/prompt",
          "body": {
            "name": "GitHub repository monitor - OpenHands/agent-server-gui",
            "prompt": "Poll OpenHands/agent-server-gui for any new issue or pull request comments since the last run. For every comment mentioning '@openhands', read the surrounding issue or pull request context and post a helpful reply as a comment on the same thread.",
            "repos": [
              {
                "url": "OpenHands/agent-server-gui"
              }
            ],
            "trigger": {
              "type": "cron",
              "schedule": "*/15 * * * *",
              "timezone": "UTC"
            },
            "template": {
              "id": "github-repo-monitor",
              "version": "1.0.0",
              "config": {
                "repository": "OpenHands/agent-server-gui",
                "triggerPhrase": "@openhands",
                "ref": "main",
                "schedule": "*/15 * * * *",
                "timezone": "UTC"
              }
            }
          }
        },
        "response": {
          "status": 422,
          "body": {
            "detail": [
              {
                "type": "value_error",
                "loc": [
                  "body",
                  "repos",
                  0
                ],
                "msg": "Value error, Short URL format 'OpenHands/agent-server-gui' requires explicit 'provider' field. Use: {\"url\": \"owner/repo\", \"provider\": \"github\"} or provide a full URL like https://github.com/owner/repo"
              }
            ]
          }
        }
      },
      "matchesSetupPayload": false
    },
    {
      "id": "fallback-conversation-when-direct-unavailable",
      "description": "A deployment that cannot run the scheduled monitor seeds the setup conversation with this message; the agent confirms the repository, trigger phrase, and polling schedule there.",
      "formValues": {
        "repository": "OpenHands/agent-server-gui",
        "triggerPhrase": "@openhands",
        "ref": "main",
        "schedule": "*/15 * * * *",
        "timezone": "UTC"
      },
      "conversation": {
        "request": {
          "message": "This deployment cannot run the scheduled monitor directly. Set it up in this conversation instead: confirm the repository to watch, the trigger phrase, and the polling schedule, then create the automation."
        }
      }
    }
  ]
}
