Skip to content

Post-code script should apply ready-for-review label before validation gates to ensure review dispatch on successful PR creation #660

Description

@guyoron1

What happened

On PR #3448, the code agent (workflow run 28904209250) created a correct PR at 22:57 UTC on July 7 but the overall run was marked as failure (the 'Run code agent' step failed). Because the run failed, the post-code.sh script never reached line 541-544 where the ready-for-review label is applied. The PR timeline API confirms no label events occurred on PR fullsend-ai#3448.

Without the ready-for-review label, the review agent was never dispatched. The dispatch.yml routing for pull_request_target.opened requires is_event_actor_authorized(PR_USER_LOGIN), which fails for the coder bot account (GitHub App bots have no collaborator role). The label-based dispatch path (issues.labeled with ready-for-review) is the designed workaround, but it was never triggered.

The PR sat for ~59 hours with no automated review, receiving only a human approval from rh-hemartin on July 10 before merge.

For comparison, PR #3868 (a successful coder run) did receive the ready-for-review label at 12:34 UTC on July 9. However, even that PR showed no review agent comment, suggesting there may be a second issue in the dispatch chain beyond label application.

What could go better

The ready-for-review label application is at the very end of post-code.sh (line 541-544), after PR creation, after all validation steps. When the code agent fails for any reason after creating the PR, the label is never applied and the review agent is never dispatched. This creates an ironic gap: PRs from failed code agent runs — the ones most likely to need automated review — are the ones that don't get it.

Confidence: high that the label was not applied on PR fullsend-ai#3448 (confirmed via GitHub timeline API). High confidence that this prevented review dispatch via the issues.labeled path. Medium overall confidence because PR fullsend-ai#3868 got the label but still had no review agent activity, suggesting a possible second issue. Related to issue fullsend-ai#2908 (harness failure reporting).

Proposed change

In internal/scaffold/fullsend-repo/scripts/post-code.sh, move the ready-for-review label application (currently lines 535-544) to immediately after successful PR creation (after line 533 echo "PR created: ${PR_URL}"). The label should be applied as soon as the PR exists, regardless of what happens in subsequent validation steps.

Alternatively, add a trap or cleanup handler in the code agent harness (harness/code.yaml) that applies the label if a PR URL was captured, ensuring it runs even on failure. The post-code.sh comment at line 536-538 already documents why the label workaround exists — extend that approach to be failure-resilient.

Also investigate why PR fullsend-ai#3868 received the label but still had no review agent comment — there may be a dispatch-chain issue in the .fullsend repo's workflow routing for label-triggered events.

Validation criteria

After the change: (1) Create a test scenario where the code agent creates a PR but the run fails — verify the ready-for-review label is still applied. (2) On the next coder-generated PR, verify the review agent is dispatched and posts a review comment. (3) Check that PR fullsend-ai#3868-like cases (label applied, successful run) also result in review agent activity — if not, file a separate issue for the dispatch chain bug.


Generated by retro agent from fullsend-ai#3448

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-to-codeTriaged and ready for the code agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions