fix(orchestration-v2): stop stamping first-attempt workflow agents as retries
Live testing showed every workflow agent wearing a "retry 2" badge on its first attempt: the SDK reports attempt 1-based once an agent starts, and the adapter added 1 on top assuming 0-based. Clamp absent or 0 up to 1 instead of incrementing. Found by a computer-use pass against a real workflow run; the replay fixture's hand-authored attempt: 0 normalizes to the same 1 as before. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
c62f0ccded
commit
9099ca6007
1 file changed
+5
-1
@@ -4274,7 +4274,11 @@ export function makeClaudeAdapterV2(
|
||||
const status = claudeWorkflowAgentStatus(entry);
|
||||
if (status === null) continue;
|
||||
const phaseIndex = nonNegativeRecordField(entry, ["phaseIndex", "phase_index"]);
|
||||
const attempt = (nonNegativeInteger(recordField(entry, "attempt")) ?? 0) + 1;
|
||||
// The live SDK reports `attempt` 1-based once an agent starts
|
||||
// (verified against 2.1.x: first attempts arrive as 1, and a
|
||||
// +1 here stamped every agent with a spurious "retry 2"
|
||||
// badge). Clamp 0 — absent or pre-start — up to 1 instead.
|
||||
const attempt = Math.max(nonNegativeInteger(recordField(entry, "attempt")) ?? 1, 1);
|
||||
const model = recordField(entry, "model");
|
||||
const lastToolName = firstRecordField(entry, ["lastToolName", "last_tool_name"]);
|
||||
const tokens = nonNegativeRecordField(entry, ["tokens", "total_tokens"]);
|
||||
|
||||
Reference in new issue
Block a user