diff --git a/docs/public/api-reference/fabro-api.yaml b/docs/public/api-reference/fabro-api.yaml index 5c294ed86..aa5938af4 100644 --- a/docs/public/api-reference/fabro-api.yaml +++ b/docs/public/api-reference/fabro-api.yaml @@ -1181,7 +1181,8 @@ paths: Failures return the standard error body. The intent lane responds `404` (`workflow_version_not_found`, `environment_not_found`), `422` (`run_intent_invalid`, `target_invalid`, - `target_environment_unsupported`, `workflow_version_unusable`, + `target_environment_unsupported`, + `pull_request_environment_unsupported`, `workflow_version_unusable`, `run_compile_invalid`), `503` (`integration_unavailable`), or `500` (`workflow_version_store_error`, `credential_store_error`, `variable_store_error`, `run_persistence_failed`). diff --git a/docs/public/execution/run-configuration.mdx b/docs/public/execution/run-configuration.mdx index e3eaa93cc..699c3b3c4 100644 --- a/docs/public/execution/run-configuration.mdx +++ b/docs/public/execution/run-configuration.mdx @@ -555,9 +555,7 @@ The `sandbox` transport runs the MCP server inside the workflow's sandbox. This ### `[run.pull_request]` -Automatically open a GitHub pull request when the workflow run completes successfully. Requires a [GitHub App](/integrations/github) to be configured. - -Automatic pull requests require a clone-based Docker or Daytona environment. For in-place Local runs, leave pull requests disabled; run creation rejects a Local environment when `enabled = true`. +Automatically open a GitHub pull request when the workflow run completes successfully. Requires a [GitHub App](/integrations/github) to be configured and a clone-based Docker or Daytona environment; run creation rejects `enabled = true` on a Local environment. ```toml title="run.toml" [run.pull_request] diff --git a/lib/apps/fabro-server/src/server/handler/runs.rs b/lib/apps/fabro-server/src/server/handler/runs.rs index decd392fd..2c9076e89 100644 --- a/lib/apps/fabro-server/src/server/handler/runs.rs +++ b/lib/apps/fabro-server/src/server/handler/runs.rs @@ -1123,13 +1123,9 @@ async fn validate_intent_environment( if image_incompatible || target_incompatible { return Err(EnvironmentSelectionError::TargetUnsupported { detail }); } - if configured_provider == SandboxProviderKind::Local - && settings - .run - .pull_request - .as_ref() - .is_some_and(|pull_request| pull_request.enabled) - { + // Settings resolution drops `run.pull_request` unless it is enabled, so + // `Some` means automatic pull requests were requested. + if !configured_provider.is_clone_based() && settings.run.pull_request.is_some() { return Err(EnvironmentSelectionError::AutomaticPullRequestUnsupported); } if let Some(detail) = diff --git a/lib/apps/fabro-server/src/server/tests.rs b/lib/apps/fabro-server/src/server/tests.rs index 887f0c7da..c70c92486 100644 --- a/lib/apps/fabro-server/src/server/tests.rs +++ b/lib/apps/fabro-server/src/server/tests.rs @@ -4299,23 +4299,8 @@ async fn post_runs_run_intent_accepts_disabled_pull_requests_for_local_environme ) .await; - let body = post_run_manifest(&app, folder_intent(workflow_version_id, target.path())).await; - let run_id = body["id"].as_str().unwrap().parse::().unwrap(); - let projection = state - .stores - .runs - .open_run_reader(&run_id) - .await - .unwrap() - .state() - .await - .unwrap(); - - assert_eq!( - projection.spec.settings.run.environment.provider, - EnvironmentProvider::Local - ); - assert!(projection.spec.settings.run.pull_request.is_none()); + // `post_run_manifest` asserts the `201 Created` admission outcome. + post_run_manifest(&app, folder_intent(workflow_version_id, target.path())).await; } #[tokio::test] @@ -4358,14 +4343,7 @@ async fn post_runs_run_intent_accepts_automatic_pull_requests_for_configured_doc EnvironmentProvider::Docker ); assert_eq!(projection.spec.settings.run.execution.mode, RunMode::DryRun); - assert!( - projection - .spec - .settings - .run - .pull_request - .is_some_and(|pull_request| pull_request.enabled) - ); + assert!(projection.spec.settings.run.pull_request.is_some()); } #[tokio::test]