Skip to content

fix(ci): reconcile review-state labels against latest check run per name#270

Merged
edelauna merged 1 commit into
mainfrom
fix/deepseek-reasoning-history-0mzxfggobdyyv
Jul 13, 2026
Merged

fix(ci): reconcile review-state labels against latest check run per name#270
edelauna merged 1 commit into
mainfrom
fix/deepseek-reasoning-history-0mzxfggobdyyv

Conversation

@roomote

@roomote roomote Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Naved Merchant. View the task or mention @roomote for follow-up asks.

Related GitHub Issue

Fixes: #884

Description

The Label PR review state workflow evaluates a PR's CI by scanning every check run that checks.listForRef returns for the head commit, then taking .some() across all of them. A single stale failed check run — one later superseded by a green run of the same check — keeps ciFailed = true forever. As a result awaiting-author / awaiting-review labels get stripped on the next hourly run and never come back, even though the PR UI and branch protection correctly show CI as green.

Observed on #509 (and #476): the head commit carries an old failed e2e-mock run alongside later green e2e-mock runs, so the workflow logs PR #509: CI failed — stripping state labels on every run and the review-state label never returns.

Change

Reduce to the latest check run per name before evaluating ciPending / ciFailed, so the workflow sees the same current state that branch protection and the PR UI use:

const latestByName = new Map();
for (const run of checkRuns) {
  const prev = latestByName.get(run.name);
  if (!prev || run.id > prev.id) {
    latestByName.set(run.name, run);
  }
}

The latest run is selected by run.id (GitHub-assigned, monotonically increasing, never null) rather than started_at, because a freshly re-queued run can have started_at: null and would lose a string comparison against an older completed run's timestamp — reintroducing a narrowed version of the same bug.

After this change, the next schedule / workflow_dispatch run re-applies the correct review-state label to affected PRs (e.g. awaiting-author on #509).

Test Procedure

  • Inspected the real e2e-mock check runs on fix: use VS Code default shell for command execution instead of /bin/sh #509's head commit (50b9df8): run.id is monotonic with recency (79875030339 failure → 79880428333 success → 82684589430 success), confirming the dedup resolves to the latest green run.
  • Manually dispatched the workflow before the change: log read PR #509: CI failed — stripping state labels.
  • Validated the embedded script block's JS syntax (async-wrapped parse) and confirmed the workflow's top-level YAML keys are intact.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to the approved issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable). (N/A — no test harness exists for this workflow script; validated via real GitHub API data and a manual dispatch.)
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Not applicable — internal CI-workflow logic change.

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required. (Please describe what needs to be updated or link to a PR in the docs repository).

Additional Notes

The workflow's own inline comments already note that schedule / workflow_dispatch runs reconcile fork PRs normally; this change is orthogonal to that fork-handling path. PRs that were stuck unlabeled due to stale check runs (e.g. #509, #476) will recover automatically once this merges and the next hourly run fires.

Get in Touch

Roomote (task 0mzxfggobdyy)

@roomote roomote Bot added the roomote:auto-resolve-conflicts Allow Roomote to auto-resolve merge conflicts for this PR label May 23, 2026
@roomote

roomote Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor Author

1 issue outstanding; 2 checks still running. Action required. See task

  • Preserve reasoning replay for Anthropic-style preserveReasoning providers instead of only replaying stored top-level reasoning_content.
  • platform-unit-test (ubuntu-latest) is still running.
  • platform-unit-test (windows-latest) is still running.

Comment thread src/core/task/Task.ts Outdated
role: "assistant",
content: assistantContent,
} satisfies Anthropic.Messages.MessageParam)
...(shouldReplayReasoningContent ? { reasoning_content: preservedReasoningContent } : {}),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

prepareApiConversationMessage() only stores top-level reasoning_content for apiProtocol === "openai" (src/core/task/apiConversationHistory.ts). Anthropic-style thinking providers in this repo still set info.preserveReasoning (for example MiniMax and the Bedrock Kimi/MiniMax models) but persist their reasoning as embedded blocks, so this branch now strips the reasoning those continuations need.

@codecov

codecov Bot commented May 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@edelauna
edelauna force-pushed the fix/deepseek-reasoning-history-0mzxfggobdyyv branch from eed0aaf to 6184c33 Compare July 13, 2026 03:45
@edelauna edelauna changed the title [Fix] DeepSeek 400 errors when mixed-model tasks continue long conversations fix(ci): reconcile review-state labels against latest check run per name Jul 13, 2026

@edelauna edelauna 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.

Squatting this old PR - to fix a small bug in how labels are tagged

@edelauna
edelauna marked this pull request as ready for review July 13, 2026 03:58
@edelauna
edelauna enabled auto-merge July 13, 2026 03:58
@edelauna
edelauna added this pull request to the merge queue Jul 13, 2026
Merged via the queue into main with commit 9e218a5 Jul 13, 2026
22 checks passed
@edelauna
edelauna deleted the fix/deepseek-reasoning-history-0mzxfggobdyyv branch July 13, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

roomote:auto-resolve-conflicts Allow Roomote to auto-resolve merge conflicts for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Label PR review state workflow treats stale check runs as current (strips awaiting-author/awaiting-review on green PRs)

1 participant