Skip to content

Commit 28779f5

Browse files
fix: count workspace skills only in a bound turn; attachment reads carry the binding
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_011AhtJPr3nmT1Po92ZQk4VE
1 parent d852acf commit 28779f5

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎packages/opencode/src/session/prompt.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3335,6 +3335,8 @@ export namespace SessionPrompt {
33353335
const model = await Provider.getModel(info.model.providerID, info.model.modelID)
33363336
const readCtx: Tool.Context = {
33373337
sessionID: input.sessionID,
3338+
// altimate_change — the project's binding, so the attachment read's tool rows name the workspace
3339+
workspaceId: (await readLocalBinding(Instance.directory).catch(() => null))?.datamateId,
33383340
abort: new AbortController().signal,
33393341
agent: input.agent!,
33403342
messageID: info.id,

‎packages/opencode/src/tool/skill.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,10 @@ export const SkillTool = Tool.define("skill", async (ctx) => {
271271
// altimate_change start — classify origin once, reused for telemetry and the source badge
272272
const skillOrigin = classifySkillSource(skill.location, Instance.directory)
273273
// altimate_change start — count workspace skill use for the session's summary rows
274-
if (skillOrigin === "workspace") Telemetry.noteWorkspaceUse(ctx.sessionID, "skills", 1, "add", ctx.turn)
274+
// Only a bound turn's use counts: a stale `_workspace` folder in an unbound project is not the workspace's.
275+
if (skillOrigin === "workspace" && ctx.workspaceId !== undefined) {
276+
Telemetry.noteWorkspaceUse(ctx.sessionID, "skills", 1, "add", ctx.turn)
277+
}
275278
// altimate_change end
276279
// altimate_change end
277280

0 commit comments

Comments
 (0)