Skip to content

Commit e3d6e0a

Browse files
fix(workspace): announce a swap of which declared tool is served at an equal count
The attach verdict was keyed on the served count, so replacing one callable declared tool with another at the same total left the notice unannounced. Key it on the callable catalog entries themselves. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0172qrhMa5TQgETASi5hxMqD
1 parent d4ea16b commit e3d6e0a

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

‎packages/opencode/src/altimate/workspace/engine-overlay.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,12 +724,14 @@ async function reconcile(sessionID: string, directory: string, state: DirectoryS
724724
// from. (multi-model review)
725725
// No report and an empty report are different verdicts (the severity rule
726726
// differs), and so is a change in which declared tools are callable at an equal
727-
// total, so both are in the signature too. (bot review)
727+
// total, so both are in the signature too: the catalog entries themselves, not
728+
// their count, or a swap at an equal count goes unheard. (bot review, codex)
728729
const gaps =
729730
unfulfilled === undefined
730731
? "no-report"
731732
: JSON.stringify((missingReport ?? []).map((u) => [u.integrationId, u.key, u.reason, u.detail ?? ""]))
732-
const signature = `attached:${workspace.key}:${outcome.available}:${outcome.declared ?? "?"}:${served}:${gaps}:${extServed}`
733+
const callable = JSON.stringify([...consumed].sort())
734+
const signature = `attached:${workspace.key}:${outcome.available}:${outcome.declared ?? "?"}:${served}:${callable}:${gaps}:${extServed}`
733735
// A report that is present but malformed is dropped whole (no gap is claimed);
734736
// say so in the log, or the missing reasons are a silent mystery. Checked before
735737
// the announcement is deduplicated, since a malformed report can share its

‎packages/opencode/test/altimate/workspace/engine-overlay.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,25 @@ describe("beforeTurn — what a turn boundary does", () => {
640640
expect(h.toasts[1].message).toBe("2 of 2 declared integration tools available.")
641641
})
642642

643+
test("a swap of which declared tool is served is announced even at an equal count", async () => {
644+
// Same total, same declared share, a different callable tool. (codex)
645+
const h = install({
646+
declared: { keys: ["dbt_build_model", "dbt_compile_model"], extensionKeys: [] },
647+
tools: { datamate_dbt_build_model: {}, datamate_altimate_knowledge_search: {} },
648+
meta: { [UNFULFILLED_META_KEY]: [] },
649+
})
650+
await beforeTurn("s1")
651+
await beforeTurn("s1")
652+
expect(h.toasts).toHaveLength(1)
653+
h.tools = { datamate_dbt_compile_model: {}, datamate_altimate_knowledge_search: {} }
654+
await beforeTurn("s1")
655+
expect(h.toasts).toHaveLength(2)
656+
expect(h.toasts.map((t) => t.message)).toEqual([
657+
"1 of 2 declared integration tools available.",
658+
"1 of 2 declared integration tools available.",
659+
])
660+
})
661+
643662
test("a gap whose error text changed under the same reason is announced again", async () => {
644663
// The remediation in the toast is the detail; a stale one sends the user
645664
// after the wrong fix. (multi-model review)

0 commit comments

Comments
 (0)