mirror of
https://github.com/turnstonelabs/turnstone.git
synced 2026-08-15 00:12:26 -06:00
fix(coord): restore reload-time pending approval gate
Agent-Logs-Url: https://github.com/turnstonelabs/turnstone/sessions/30f630fe-3ded-4abe-991b-b5a95f699127 Co-authored-by: eous <13773563+eous@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7fb2f1c78f
commit
93cb3d9a2b
@@ -119,3 +119,9 @@ def test_coordinator_js_exposes_inline_approval_helpers():
|
||||
# call short-circuits on non-visible rows, leaving them stuck.
|
||||
assert "_maybeStartJudgePoll" in body
|
||||
assert "_judgePollTick" in body
|
||||
# Reload parity for the coord-self approval gate: init() must
|
||||
# consume the authoritative GET /workstreams snapshot's
|
||||
# pending_approval_detail so a freshly opened tab can render
|
||||
# Approve/Deny before SSE replay arrives.
|
||||
assert "wsSnapshot.pending_approval_detail" in body
|
||||
assert "appendToolBatch(pendingDetail.items" in body
|
||||
|
||||
@@ -3046,12 +3046,13 @@
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
async function init() {
|
||||
let wsSnapshot = null;
|
||||
try {
|
||||
const data = await getJSON(
|
||||
wsSnapshot = await getJSON(
|
||||
"/v1/api/workstreams/" + encodeURIComponent(wsId),
|
||||
);
|
||||
nameEl.textContent = data.name || "";
|
||||
statusEl.textContent = data.state || "";
|
||||
nameEl.textContent = wsSnapshot.name || "";
|
||||
statusEl.textContent = wsSnapshot.state || "";
|
||||
} catch (e) {
|
||||
appendText("error", "Failed to load coordinator: " + e.message);
|
||||
return;
|
||||
@@ -3226,6 +3227,24 @@
|
||||
appendText(role, content, { label: role });
|
||||
}
|
||||
});
|
||||
// History alone can't tell whether an orphaned assistant
|
||||
// tool_calls turn is awaiting approval or merely still running.
|
||||
// The live workstream snapshot can: if pending_approval_detail is
|
||||
// present, upgrade the matching batch immediately so a reload
|
||||
// still exposes Approve/Deny even before SSE reconnects.
|
||||
const pendingDetail =
|
||||
wsSnapshot &&
|
||||
wsSnapshot.pending_approval &&
|
||||
wsSnapshot.pending_approval_detail &&
|
||||
Array.isArray(wsSnapshot.pending_approval_detail.items)
|
||||
? wsSnapshot.pending_approval_detail
|
||||
: null;
|
||||
if (pendingDetail) {
|
||||
appendToolBatch(pendingDetail.items, {
|
||||
pending: true,
|
||||
judgePending: !!pendingDetail.judge_pending,
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("history load failed", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user