Skip to content

Comments

t1055: Issue-sync includes PR proof-log when closing issues#1504

Merged
marcusquinn merged 1 commit intomainfrom
fix/issue-sync-proof-log
Feb 15, 2026
Merged

t1055: Issue-sync includes PR proof-log when closing issues#1504
marcusquinn merged 1 commit intomainfrom
fix/issue-sync-proof-log

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 15, 2026

Summary

  • Issue closing comments now include PR number, merge state, and file count as proof-log
  • When no PR exists, comment flags it for manual review instead of silently closing
  • Cancelled/failed issues include the DB error reason in the closing comment
  • Prevents knowledge loss — issues may be the only record of subtask work

Problem

sync_issue_status_label() closed issues with generic comments like "Task t1049.11 reached state: verified" — no PR reference, no proof the work was done. When subtasks don't have TODO.md entries, the issue is the sole knowledge trail. Closing without proof loses traceability.

Changes

  • issue-sync.sh: verified/deployed path looks up pr_url from DB, calls gh pr view for state/files, builds proof comment
  • cancelled path includes error field from DB as cancellation reason
  • failed path includes error field from DB as failure context

Closes #1503

Summary by CodeRabbit

  • Bug Fixes
    • Issue closure comments now include enhanced context such as PR references, deployment details, cancellation reasons, and error information for better tracking and transparency.

…issues (t1055)

When closing issues for verified/deployed/cancelled/failed tasks, the
closing comment now includes:
- PR number, merge state, and changed file count (for verified/deployed)
- 'No PR on record' warning when no PR exists (flags manual review)
- Cancellation reason from DB error field (for cancelled)
- Failure error from DB (for failed)

Prevents knowledge loss when issues are the only record of work.

Closes #1503
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the issue closing process within the issue-sync.sh script by integrating more comprehensive details into the closing comments. The primary goal is to improve traceability and prevent knowledge loss by providing a clear proof-log for completed tasks, including Pull Request information, or flagging issues for manual review when no PR is linked. Additionally, it ensures that cancelled or failed tasks include specific error reasons, offering better insights into their resolution.

Highlights

  • Enhanced Issue Closing Comments: Issue closing comments for 'verified' and 'deployed' states now include the associated Pull Request number, its merge state, and the count of changed files, providing a detailed proof-log.
  • Manual Verification Flag: If no Pull Request is found on record for a 'verified' or 'deployed' task, the closing comment explicitly flags the issue for manual verification of deliverables, preventing silent closures.
  • Detailed Cancellation/Failure Reasons: For 'cancelled' and 'failed' issues, the closing comments now incorporate the specific error reason retrieved from the database, improving traceability and understanding of task termination.
  • Improved Knowledge Traceability: These changes collectively prevent knowledge loss by ensuring that issue closures provide comprehensive context, especially when issues are the primary record of subtask work.
Changelog
  • .agents/scripts/supervisor/issue-sync.sh
    • Modified the sync_issue_status_label function to dynamically construct issue closing comments based on the task's new state.
    • Implemented logic to query the database for a pr_url when an issue transitions to 'verified' or 'deployed'.
    • Added functionality to use the GitHub CLI (gh pr view) to fetch PR state, merged status, and changed file count, incorporating this data into the closing comment.
    • Introduced a fallback message for 'verified'/'deployed' issues that lack a recorded PR, prompting manual verification.
    • Updated the 'cancelled' state handling to retrieve and include the error field from the database in the cancellation comment.
    • Updated the 'failed' state handling to retrieve and include the error field from the database in the failure comment.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 15, 2026

Walkthrough

The PR enhances GitHub issue closure with data-driven context. When issues reach terminal states (verified, deployed, cancelled, failed), the script now constructs rich close comments by querying task lineage, extracting stored PR URLs, and fetching PR details via gh API, replacing static closure messages with evidence-backed information.

Changes

Cohort / File(s) Summary
Issue Sync Enhancement
.agents/scripts/supervisor/issue-sync.sh
Enhanced sync_issue_status_label to construct context-rich close comments for terminal states: verified/deployed include task lineage and dynamically queried PR details (merged status, changed files); cancelled appends DB-sourced cancellation reason; failed includes error context. Replaces static messages with data-driven proof logs and improved logging visibility.

Sequence Diagram

sequenceDiagram
    participant Script as issue-sync.sh
    participant DB as Database
    participant GH as GitHub API (gh)
    participant Issue as GitHub Issue
    
    Script->>Script: Detect terminal state
    alt Verified/Deployed
        Script->>DB: Query task lineage & PR URL
        DB-->>Script: PR URL (or none)
        alt PR URL exists
            Script->>Script: Extract PR number
            Script->>GH: Query PR details (state, mergedAt, files)
            GH-->>Script: PR metadata
            Script->>Script: Build composite message with proof
        else No PR URL
            Script->>Script: Build manual delivery notice
        end
    else Cancelled
        Script->>DB: Fetch cancellation reason
        DB-->>Script: Reason text
        Script->>Script: Append reason to close comment
    else Failed
        Script->>DB: Fetch error message
        DB-->>Script: Error context
        Script->>Script: Include error in close comment
    end
    
    Script->>Issue: Close with data-driven comment
    Issue-->>Script: Closure confirmed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🔍 Close comments now speak with proof in hand,
PR proof-logs from database stand,
GitHub queries fetch the truth of change—
No more guesses on the deployment range,
Evidence-rich closures, DevOps planned! 🚀

🚥 Pre-merge checks | ✅ 5 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (2 files):

⚔️ .agents/scripts/supervisor/issue-sync.sh (content)
⚔️ .task-counter (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding PR proof-log functionality to issue-sync closing comments, which is the primary focus of the changeset.
Linked Issues check ✅ Passed The code changes fully implement all requirements from #1503: including PR metadata in closing comments, handling missing PR cases with warnings, and incorporating DB error reasons for cancelled/failed tasks.
Out of Scope Changes check ✅ Passed All changes in issue-sync.sh are directly scoped to the PR proof-log feature—no unrelated modifications to other functionality or files are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/issue-sync-proof-log
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch fix/issue-sync-proof-log
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 16 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sun Feb 15 22:36:01 UTC 2026: Code review monitoring started
Sun Feb 15 22:36:02 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 16

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 16
  • VULNERABILITIES: 0

Generated on: Sun Feb 15 22:36:04 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the issue-sync process by adding more detailed, context-rich comments when closing GitHub issues. It now includes pull request details for 'verified' or 'deployed' tasks, and database-sourced reasons for 'cancelled' or 'failed' tasks, which significantly improves traceability. My review focuses on improving code structure and ensuring adherence to the repository's shell scripting style guide. I've identified opportunities to simplify conditional logic and correct a style guide violation related to error suppression.

local close_comment
close_comment="Task $task_id reached state: $new_state (from $old_state)"
local pr_url=""
pr_url=$(db "$SUPERVISOR_DB" "SELECT pr_url FROM tasks WHERE id='$(sql_escape "$task_id")';" 2>/dev/null || echo "")

Choose a reason for hiding this comment

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

medium

Suppressing stderr with 2>/dev/null violates the repository's style guide (line 50), which states that 2>/dev/null is only acceptable when redirecting to log files. This blanket suppression can hide important error messages from the db command, making debugging more difficult. Please remove the suppression to allow errors to be visible or logged appropriately. This issue is present in multiple places in this function (e.g., lines 418, 427, 430, 438, 444, 447, 455, 461, 463).

Suggested change
pr_url=$(db "$SUPERVISOR_DB" "SELECT pr_url FROM tasks WHERE id='$(sql_escape "$task_id")';" 2>/dev/null || echo "")
pr_url=$(db "$SUPERVISOR_DB" "SELECT pr_url FROM tasks WHERE id='$(sql_escape "$task_id")';" || echo "")
References
  1. The style guide prohibits blanket error suppression with 2>/dev/null. Errors should be logged or visible, and suppression is only allowed when redirecting to a log file. (link)

Comment on lines +412 to +424
if [[ -n "$pr_url" && "$pr_url" != "null" ]]; then
local pr_number=""
pr_number=$(echo "$pr_url" | grep -oE '[0-9]+$' || echo "")
if [[ -n "$pr_number" ]]; then
local pr_state=""
pr_state=$(gh pr view "$pr_number" --repo "$repo_slug" --json state,mergedAt,changedFiles \
--jq '"state:\(.state) merged:\(.mergedAt // "n/a") files:\(.changedFiles)"' 2>/dev/null || echo "")
close_comment="Verified: PR #$pr_number ($pr_state). Task $task_id: $old_state -> $new_state"
fi
fi
if [[ -z "$pr_url" || "$pr_url" == "null" ]]; then
close_comment="Task $task_id reached state: $new_state (from $old_state). No PR on record — verify deliverables manually."
fi

Choose a reason for hiding this comment

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

medium

The two if statements checking for pr_url are redundant. The condition in the second if is the logical negation of the first. This can be simplified into a more readable and maintainable if/else block.

Suggested change
if [[ -n "$pr_url" && "$pr_url" != "null" ]]; then
local pr_number=""
pr_number=$(echo "$pr_url" | grep -oE '[0-9]+$' || echo "")
if [[ -n "$pr_number" ]]; then
local pr_state=""
pr_state=$(gh pr view "$pr_number" --repo "$repo_slug" --json state,mergedAt,changedFiles \
--jq '"state:\(.state) merged:\(.mergedAt // "n/a") files:\(.changedFiles)"' 2>/dev/null || echo "")
close_comment="Verified: PR #$pr_number ($pr_state). Task $task_id: $old_state -> $new_state"
fi
fi
if [[ -z "$pr_url" || "$pr_url" == "null" ]]; then
close_comment="Task $task_id reached state: $new_state (from $old_state). No PR on record — verify deliverables manually."
fi
if [[ -n "$pr_url" && "$pr_url" != "null" ]]; then
local pr_number=""
pr_number=$(echo "$pr_url" | grep -oE '[0-9]+$' || echo "")
if [[ -n "$pr_number" ]]; then
local pr_state=""
pr_state=$(gh pr view "$pr_number" --repo "$repo_slug" --json state,mergedAt,changedFiles \
--jq '"state:\(.state) merged:\(.mergedAt // "n/a") files:\(.changedFiles)"' 2>/dev/null || echo "")
close_comment="Verified: PR #$pr_number ($pr_state). Task $task_id: $old_state -> $new_state"
fi
else
close_comment="Task $task_id reached state: $new_state (from $old_state). No PR on record — verify deliverables manually."
fi

@marcusquinn marcusquinn merged commit a0ac22a into main Feb 15, 2026
18 of 19 checks passed
@marcusquinn marcusquinn deleted the fix/issue-sync-proof-log branch February 15, 2026 22:38
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.agents/scripts/supervisor/issue-sync.sh:
- Around line 407-431: The proof-log logic should treat an unusable PR URL or a
failed gh query as "no usable PR" and avoid empty parentheticals: after
extracting pr_url, if pr_number is empty set close_comment to the "No PR on
record" message (or append a note that the PR URL is unusable) instead of
leaving the default; when running gh pr view, check if pr_state is non-empty
before building close_comment (only include "PR #$pr_number ($pr_state)" when
pr_state is non-empty), otherwise fall back to the "No PR on record — verify
deliverables manually" message or a clear "PR info unavailable" message. Update
the logic around variables pr_url, pr_number, pr_state and the construction of
close_comment (and the gh pr view call) so both edge cases (malformed pr_url and
gh failures) produce a clear fallback comment.
🧹 Nitpick comments (1)
.agents/scripts/supervisor/issue-sync.sh (1)

435-461: Optional: Extract the DB error fetch into a small helper to DRY up cancelled/failed paths.

Both blocks perform the same SELECT error FROM tasks WHERE id=... query and the same empty/null guard. A tiny helper like get_task_error() would reduce duplication and make future changes (e.g., truncating long errors) single-point.

Example helper
# At the top of the function or as a standalone helper
_get_task_db_field() {
    local field="$1" task_id="$2"
    local val=""
    val=$(db "$SUPERVISOR_DB" "SELECT $field FROM tasks WHERE id='$(sql_escape "$task_id")';" 2>/dev/null || echo "")
    if [[ -n "$val" && "$val" != "null" ]]; then
        echo "$val"
    fi
}

Comment on lines +407 to +431
# Build proof-log comment with PR reference and changed files
local close_comment
close_comment="Task $task_id reached state: $new_state (from $old_state)"
local pr_url=""
pr_url=$(db "$SUPERVISOR_DB" "SELECT pr_url FROM tasks WHERE id='$(sql_escape "$task_id")';" 2>/dev/null || echo "")
if [[ -n "$pr_url" && "$pr_url" != "null" ]]; then
local pr_number=""
pr_number=$(echo "$pr_url" | grep -oE '[0-9]+$' || echo "")
if [[ -n "$pr_number" ]]; then
local pr_state=""
pr_state=$(gh pr view "$pr_number" --repo "$repo_slug" --json state,mergedAt,changedFiles \
--jq '"state:\(.state) merged:\(.mergedAt // "n/a") files:\(.changedFiles)"' 2>/dev/null || echo "")
close_comment="Verified: PR #$pr_number ($pr_state). Task $task_id: $old_state -> $new_state"
fi
fi
if [[ -z "$pr_url" || "$pr_url" == "null" ]]; then
close_comment="Task $task_id reached state: $new_state (from $old_state). No PR on record — verify deliverables manually."
fi
# Close the issue with proof-log comment
gh issue close "$issue_number" --repo "$repo_slug" \
--comment "Task $task_id reached state: $new_state (from $old_state)" 2>/dev/null || true
--comment "$close_comment" 2>/dev/null || true
# Add status:done and remove all other status labels
gh issue edit "$issue_number" --repo "$repo_slug" \
--add-label "status:done" "${remove_args[@]}" 2>/dev/null || true
log_verbose "sync_issue_status_label: closed #$issue_number ($task_id -> $new_state)"
log_verbose "sync_issue_status_label: closed #$issue_number ($task_id -> $new_state) proof: ${pr_url:-none}"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Proof-log fallback has a gap when PR URL exists but details can't be fetched.

Two edge cases in the verified/deployed path:

  1. pr_url is non-empty but pr_number extraction fails (e.g., malformed URL without trailing digits): the code skips lines 415–420 and falls to line 422 where pr_url is not empty, so the "No PR on record" warning is not set. You end up with the generic default from line 409 — no proof-log, no warning. Consider restructuring so the "No PR on record" fallback also covers "PR URL present but unusable."

  2. gh pr view fails (API error, network issue): pr_state is empty, and line 419 produces "Verified: PR feat(plan+): add granular bash permissions for file discovery #123 (). Task ..." — an empty parenthetical. A guard on pr_state being non-empty would keep the comment clean.

Suggested restructure
 		local close_comment
-		close_comment="Task $task_id reached state: $new_state (from $old_state)"
 		local pr_url=""
 		pr_url=$(db "$SUPERVISOR_DB" "SELECT pr_url FROM tasks WHERE id='$(sql_escape "$task_id")';" 2>/dev/null || echo "")
+		close_comment=""
 		if [[ -n "$pr_url" && "$pr_url" != "null" ]]; then
 			local pr_number=""
 			pr_number=$(echo "$pr_url" | grep -oE '[0-9]+$' || echo "")
 			if [[ -n "$pr_number" ]]; then
 				local pr_state=""
 				pr_state=$(gh pr view "$pr_number" --repo "$repo_slug" --json state,mergedAt,changedFiles \
 					--jq '"state:\(.state) merged:\(.mergedAt // "n/a") files:\(.changedFiles)"' 2>/dev/null || echo "")
-				close_comment="Verified: PR #$pr_number ($pr_state). Task $task_id: $old_state -> $new_state"
+				if [[ -n "$pr_state" ]]; then
+					close_comment="Verified: PR #$pr_number ($pr_state). Task $task_id: $old_state -> $new_state"
+				fi
 			fi
 		fi
-		if [[ -z "$pr_url" || "$pr_url" == "null" ]]; then
+		if [[ -z "$close_comment" && ( -z "$pr_url" || "$pr_url" == "null" ) ]]; then
 			close_comment="Task $task_id reached state: $new_state (from $old_state). No PR on record — verify deliverables manually."
 		fi
+		if [[ -z "$close_comment" ]]; then
+			close_comment="Task $task_id reached state: $new_state (from $old_state)"
+		fi
🤖 Prompt for AI Agents
In @.agents/scripts/supervisor/issue-sync.sh around lines 407 - 431, The
proof-log logic should treat an unusable PR URL or a failed gh query as "no
usable PR" and avoid empty parentheticals: after extracting pr_url, if pr_number
is empty set close_comment to the "No PR on record" message (or append a note
that the PR URL is unusable) instead of leaving the default; when running gh pr
view, check if pr_state is non-empty before building close_comment (only include
"PR #$pr_number ($pr_state)" when pr_state is non-empty), otherwise fall back to
the "No PR on record — verify deliverables manually" message or a clear "PR info
unavailable" message. Update the logic around variables pr_url, pr_number,
pr_state and the construction of close_comment (and the gh pr view call) so both
edge cases (malformed pr_url and gh failures) produce a clear fallback comment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t1055: Issue-sync must include PR proof-log when closing issues

1 participant