Skip to content

Harden Semantic Function Refactoring against empty terminal exits#45418

Merged
pelikhan merged 2 commits into
mainfrom
copilot/aw-failures-fix-semantic-function
Jul 14, 2026
Merged

Harden Semantic Function Refactoring against empty terminal exits#45418
pelikhan merged 2 commits into
mainfrom
copilot/aw-failures-fix-semantic-function

Conversation

Copilot AI commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Semantic Function Refactoring regressed from a long green streak to a red scheduled run after the Claude CLI completed a large analysis session but exited with zero safe outputs. The failing path was consistent with the workflow drifting into blocked shell patterns and finishing without emitting either a finding or an explicit no-op.

  • Root-cause guardrail

    • Require every successful run to end with exactly one terminal safe output:
      • create_issue when meaningful refactoring findings exist
      • noop when analysis completes with nothing worth filing
    • This closes the empty-exit path that left the agent job red despite a completed session.
  • Safer GitHub issue discovery

    • Replace prompt guidance that implicitly encouraged gh issue list/Bash reads with direct GitHub MCP issue tools.
    • Prefer search_issues for [refactor] title lookup before analysis starts, keeping the workflow on supported read paths.
  • Lower-friction analysis commands

    • Tighten prompt guidance around shell usage so the agent favors Serena semantic tools plus Grep/Read over approval-blocked shell pipelines, loops, and awk-style command composition.
    • Clarify that “no matching open refactor issues” is a normal branch and should not emit close_issue.
  • Prompt change reflected in compiled workflow

    • Recompiled semantic-function-refactor.lock.yml so runtime YAML matches the updated prompt behavior.

Example of the new terminal contract:

End every successful run with exactly one safe output:

- create_issue when significant refactoring findings were verified
- noop when the analysis completed successfully but found nothing worth filing

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix terminal failure in Semantic Function Refactoring Harden Semantic Function Refactoring against empty terminal exits Jul 14, 2026
Copilot AI requested a review from pelikhan July 14, 2026 09:51
@pelikhan pelikhan marked this pull request as ready for review July 14, 2026 11:02
Copilot AI review requested due to automatic review settings July 14, 2026 11:02
@pelikhan pelikhan merged commit 9417573 into main Jul 14, 2026
@pelikhan pelikhan deleted the copilot/aw-failures-fix-semantic-function branch July 14, 2026 11:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Hardens the scheduled semantic refactoring workflow against successful runs producing no terminal safe output.

Changes:

  • Directs issue discovery through GitHub MCP tools.
  • Adds safer shell guidance and explicit create_issue/noop termination.
  • Refreshes compiled workflow metadata.
Show a summary per file
File Description
.github/workflows/semantic-function-refactor.md Updates analysis and terminal-output instructions.
.github/workflows/semantic-function-refactor.lock.yml Refreshes the generated body hash.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Medium

**Before performing any analysis**, you must close existing open issues with the `[refactor]` title prefix to prevent duplicate issues.

Use the GitHub API tools to:
Use the GitHub MCP issue tools directly (for example `search_issues` with `repo:${{ github.repository }} is:issue is:open "[refactor]" in:title`, or `list_issues` with `state: open` and client-side filtering). **Do not use `gh issue list` or Bash for GitHub reads.**

Group files by package/directory to understand the organization.

When shell access is needed, keep each Bash command simple and single-purpose. Prefer Serena tools plus `Grep`/`Read` over shell pipelines, loops, `awk`, or command substitutions that may be blocked by approval policy.

## Required Terminal Safe Output

End every successful run with exactly one safe output:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants