Simplify the Local pull-request admission check

Use the shared clone-based provider predicate and rely on the settings
resolver dropping disabled pull-request settings instead of re-checking
the enabled flag. List the new intent-lane error code in the OpenAPI
description, trim the acceptance tests to what they actually prove, and
fold the docs note into the existing requirements sentence.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Scott Werner 2026-09-03 11:43:29 -04:00
parent cd20e453ec
commit c5010c0b33
4 changed files with 9 additions and 36 deletions

View file

@ -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`).

View file

@ -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]

View file

@ -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) =

View file

@ -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::<RunId>().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]