Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/scripts/agent_delegation_policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ function decideNextAgent({
reason: explicitAgent ? 'explicit-label' : 'default',
shouldSwitch: false,
alternatives: [],
delegationSource: 'static',
};
}

Expand Down Expand Up @@ -282,6 +283,7 @@ function decideNextAgent({
reason: 'no-agents-available',
shouldSwitch: false,
alternatives: [],
delegationSource: 'static',
};
}

Expand All @@ -294,6 +296,7 @@ function decideNextAgent({
reason: 'initial-selection',
shouldSwitch: false,
alternatives: availableAgents.filter((a) => a !== initialAgent),
delegationSource: 'static',
};
}

Expand All @@ -306,6 +309,7 @@ function decideNextAgent({
shouldSwitch: true,
previousAgent: currentAgent,
alternatives: availableAgents.filter((agent) => agent !== nextAgent),
delegationSource: 'static',
};
}

Expand All @@ -325,6 +329,7 @@ function decideNextAgent({
reason: `effective (${effectiveness.summary})`,
shouldSwitch: false,
alternatives: availableAgents.filter((a) => a !== currentAgent),
delegationSource: 'static',
};
}

Expand All @@ -335,6 +340,7 @@ function decideNextAgent({
reason: `cooldown (${5 - roundsSinceSwitch} rounds remaining)`,
shouldSwitch: false,
alternatives: availableAgents.filter((a) => a !== currentAgent),
delegationSource: 'static',
};
}

Expand Down Expand Up @@ -373,7 +379,7 @@ function decideNextAgent({
reason: `stalled-no-alternatives (${sourceSuffix})`,
shouldSwitch: false,
alternatives: [],
delegationSource: 'static',
delegationSource,
};
}
core?.info?.(`Switching from ${currentAgent} to ${nextAgent} due to stall (${sourceSuffix})`);
Expand Down
11 changes: 9 additions & 2 deletions scripts/langchain/issue_dedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from __future__ import annotations

import logging
import math
import os
from collections.abc import Iterable, Mapping
from dataclasses import dataclass
Expand Down Expand Up @@ -198,16 +199,19 @@ def find_similar_issues(
min_score = _resolve_threshold(threshold)
matches: list[IssueMatch] = []
for doc, raw_score in results:
float_score = float(raw_score)
if not math.isfinite(float_score):
continue
metadata = getattr(doc, "metadata", {}) or {}
fallback_title = getattr(doc, "page_content", None)
issue = _issue_from_metadata(metadata, fallback_title)
similarity = _similarity_from_score(float(raw_score), score_type)
similarity = _similarity_from_score(float_score, score_type)
if similarity >= min_score:
matches.append(
IssueMatch(
issue=issue,
score=similarity,
raw_score=float(raw_score),
raw_score=float_score,
score_type=score_type,
)
)
Expand All @@ -217,6 +221,9 @@ def find_similar_issues(


def _format_similarity(score: float) -> str:
"""Format finite scores as percentages; invalid scores provide no similarity."""
if not math.isfinite(score):
return "0%"
clamped = min(max(score, 0.0), 1.0)
return f"{round(clamped * 100):d}%"

Expand Down
Loading