fix(cli): claimAndPrintTask zeigt neuesten Handoff statt ersten (Architekt-Hotfix)
This commit is contained in:
parent
97db2358bb
commit
52e5d0bf28
@ -104,11 +104,23 @@ export async function claimAndPrintTask(ctx: AgentContext, task: Listed, handoff
|
||||
/* body is optional */
|
||||
}
|
||||
|
||||
const hof = handoffs.find((h) => h.taskId === task.id);
|
||||
// Pick the LATEST handoff for this task, not the first one created. When a
|
||||
// task is reopened with a corrective handoff, the newer handoff supersedes
|
||||
// the older; showing the stale first-created one made agents rebuild against
|
||||
// an outdated spec — the architect's correction never actually reached them.
|
||||
// Handoff ids are zero-padded (HOF-0061 > HOF-0056), so a descending string
|
||||
// sort yields the newest.
|
||||
const taskHofs = handoffs
|
||||
.filter((h) => h.taskId === task.id)
|
||||
.sort((a, b) => String(b.id).localeCompare(String(a.id)));
|
||||
const hof = taskHofs[0];
|
||||
if (hof) {
|
||||
try {
|
||||
const hd = ctx.serverUrl ? await remoteClient.getHandoff(ctx.serverUrl, hof.id) : svcGetHandoff(ctx.projectCwd, hof.id);
|
||||
console.log(`\n─ Handoff ${hof.id} ──────────────`);
|
||||
if (taskHofs.length > 1) {
|
||||
console.log(`(latest of ${taskHofs.length} handoffs — supersedes ${taskHofs.slice(1).map((h) => h.id).join(', ')})`);
|
||||
}
|
||||
console.log(hd.handoff.summary);
|
||||
if (hd.body && hd.body.trim()) console.log(hd.body.trim());
|
||||
} catch {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user