Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

ci: preserve merge labels while state is unknown

JerrettDavis2d418335a1e5
diff --git a/.github/workflows/pr-health.yml b/.github/workflows/pr-health.yml
index 688b39046..4cc6ba24b 100644
--- a/.github/workflows/pr-health.yml
+++ b/.github/workflows/pr-health.yml
@@ -204,17 +204,17 @@ jobs:
is_draft="$(jq -r '.isDraft' <<<"$data")"
review_decision="$(jq -r '.reviewDecision // ""' <<<"$data")"
- if [[ "$merge_state" == "BEHIND" ]]; then
- gh pr edit "$pr" --repo "$REPO" --add-label "status: needs rebase"
- else
- gh pr edit "$pr" --repo "$REPO" --remove-label "status: needs rebase" || true
- fi
-
- if [[ "$merge_state" == "DIRTY" ]]; then
- gh pr edit "$pr" --repo "$REPO" --add-label "status: has conflicts"
- else
- gh pr edit "$pr" --repo "$REPO" --remove-label "status: has conflicts" || true
- fi
+ if [[ "$merge_state" == "BEHIND" ]]; then
+ gh pr edit "$pr" --repo "$REPO" --add-label "status: needs rebase"
+ elif [[ "$merge_state" != "UNKNOWN" ]]; then
+ gh pr edit "$pr" --repo "$REPO" --remove-label "status: needs rebase" || true
+ fi
+
+ if [[ "$merge_state" == "DIRTY" ]]; then
+ gh pr edit "$pr" --repo "$REPO" --add-label "status: has conflicts"
+ elif [[ "$merge_state" != "UNKNOWN" ]]; then
+ gh pr edit "$pr" --repo "$REPO" --remove-label "status: has conflicts" || true
+ fi
if [[ "$check_state" == "failing" ]]; then
gh pr edit "$pr" --repo "$REPO" --add-label "status: ci failing"
diff --git a/scripts/tests/test_pr_health_workflow.py b/scripts/tests/test_pr_health_workflow.py
index 42c9a2f56..c317cae04 100644
--- a/scripts/tests/test_pr_health_workflow.py
+++ b/scripts/tests/test_pr_health_workflow.py
@@ -22,3 +22,11 @@ def test_ready_for_review_label_is_removed_when_changes_are_requested() -> None:
assert "reviewDecision" in workflow
assert 'review_decision="$(jq -r \'.reviewDecision // ""\'' in workflow
assert '$review_decision" == "CHANGES_REQUESTED"' in workflow
+
+
+def test_merge_state_unknown_does_not_clear_conflict_or_rebase_labels() -> None:
+ workflow = Path(".github/workflows/pr-health.yml").read_text(encoding="utf-8")
+
+ assert 'elif [[ "$merge_state" != "UNKNOWN" ]]; then' in workflow
+ assert 'gh pr edit "$pr" --repo "$REPO" --remove-label "status: needs rebase"' in workflow
+ assert 'gh pr edit "$pr" --repo "$REPO" --remove-label "status: has conflicts"' in workflow