Skip to content

Commit 8336f52

Browse files
authored
Merge pull request #10085 from loopx-project/codex/issue-fix-validation-exit
Propagate failed Issue Fix validation to the calling process
2 parents 9e9044f + 95271b5 commit 8336f52

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

‎examples/issue-fix-acceptance-loop-smoke.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def main() -> int:
244244
with tempfile.TemporaryDirectory(prefix="loopx-caller-repo-branch-smoke-") as tmp:
245245
repo_path = Path(tmp)
246246
_init_fixture_git_repo(repo_path)
247-
caller_payload = _run_caller_repo_json_command(repo_path)
247+
caller_payload = _run_caller_repo_json_command(repo_path, expect_success=False)
248248
assert caller_payload["ok"] is True, caller_payload
249249
assert caller_payload["schema_version"] == "issue_fix_caller_repo_branch_packet_v0"
250250
assert caller_payload["mode"] == "issue-fix-caller-repo-branch"
@@ -296,6 +296,7 @@ def main() -> int:
296296
current_payload = _run_caller_repo_json_command(
297297
repo_path,
298298
issue_branch="codex/issue-123-current-base",
299+
expect_success=False,
299300
)
300301
assert current_payload["ok"] is True
301302
current_snapshot = current_payload["caller_repo_branch"]["base_snapshot"]
@@ -370,6 +371,7 @@ def main() -> int:
370371
pinned_payload = _run_caller_repo_json_command(
371372
repo_path,
372373
issue_branch="codex/issue-123-pinned-base",
374+
expect_success=False,
373375
env={
374376
**os.environ,
375377
"PATH": str(shim_dir) + os.pathsep + os.environ.get("PATH", ""),
@@ -391,6 +393,7 @@ def main() -> int:
391393
existing_payload = _run_caller_repo_json_command(
392394
repo_path,
393395
issue_branch=issue_branch,
396+
expect_success=False,
394397
)
395398
existing_branch = existing_payload["caller_repo_branch"]
396399
assert existing_branch["branch_action"] == "claimed_current"

‎loopx/capabilities/issue_fix/cli.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ def register_issue_fix_commands(
802802
caller_parser.add_argument(
803803
"--execute",
804804
action="store_true",
805-
help="Actually inspect the approved repo, create or claim the issue branch, and run the caller-declared validation.",
805+
help="Inspect the approved repo, create or claim the issue branch, and run the declared validation. A failed check returns a nonzero exit status.",
806806
)
807807
_add_generated_at_arg(caller_parser, artifact="the artifact")
808808

@@ -1665,4 +1665,8 @@ def handle_issue_fix_command(
16651665
)
16661666
payload.pop("origin_request", None)
16671667
print_payload(payload, output_format(args), renderer)
1668-
return 0 if payload.get("ok") else 1
1668+
if not payload.get("ok"):
1669+
return 1
1670+
if command == "caller-repo-branch" and args.execute:
1671+
return 0 if payload["caller_repo_branch"]["validation"]["passed"] else 1
1672+
return 0

‎loopx/capabilities/issue_fix/docs/protocols/issue-fix-acceptance-loop-v0.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ inspect the local checkout before proceeding when the count is nonzero.
7070
Without `--execute`, the command is a dry-run plan and does not inspect or
7171
modify the local repository.
7272

73+
When using `caller-repo-branch` as a Todo validator, supply `--execute` and
74+
a command that checks the case's acceptance criterion. A failed check returns
75+
exit status 1 and still writes the full report to stdout. Its top-level `ok`
76+
describes report construction. Read `caller_repo_branch.validation.passed`
77+
for the check result and `review_packet.ready` for PR review readiness. A
78+
successful dry run returns zero without running the check.
79+
7380
## Product Contract
7481

7582
The user-facing value is the validated repair path:

0 commit comments

Comments
 (0)