Skip to content

Commit 99db746

Browse files
anandgupta42claude
andcommitted
fix: convert single-line altimate_change markers to start/end pairs
The strict marker guard (`analyze.ts --markers --strict`) only credits lines between a `start`/`end` pair; the single-line `// altimate_change —` comments introduced in #980 and #1004 covered the comment itself but left the code beneath unmarked, failing the release gate against v0.9.1. Wrap all five flagged sites (mcp/index.ts, session/prompt.ts, session/tools.ts, tool/registry.ts x2, session/prompt/default.txt) in proper pairs. No behavior change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 9761436 commit 99db746

6 files changed

Lines changed: 54 additions & 22 deletions

File tree

packages/opencode/src/mcp/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,13 @@ interface State {
277277
export interface Interface {
278278
readonly status: () => Effect.Effect<Record<string, Status>>
279279
readonly clients: () => Effect.Effect<Record<string, MCPClient>>
280-
// altimate_change — carry the original (pre-sanitize) client name so tool-source classification
281-
// works from the real name, not the flattened `<client>_<tool>` key (see altimate/tool-source).
280+
// altimate_change start — carry the original (pre-sanitize) client name so tool-source
281+
// classification works from the real name, not the flattened `<client>_<tool>` key
282+
// (see altimate/tool-source).
282283
readonly tools: () => Effect.Effect<Record<string, Tool & { client: string }>>
283284
readonly prompts: () => Effect.Effect<Record<string, PromptInfo & { client: string }>>
284285
readonly resources: () => Effect.Effect<Record<string, ResourceInfo & { client: string }>>
286+
// altimate_change end
285287
readonly add: (name: string, mcp: ConfigMCPV1.Info) => Effect.Effect<{ status: Record<string, Status> | Status }>
286288
readonly connect: (name: string) => Effect.Effect<void, NotFoundError>
287289
readonly disconnect: (name: string) => Effect.Effect<void, NotFoundError>
@@ -1012,8 +1014,9 @@ export const layer = Layer.effect(
10121014
}
10131015

10141016
const tools = Effect.fn("MCP.tools")(function* () {
1015-
// altimate_change — values carry the original client name (see Interface.tools).
1017+
// altimate_change start — values carry the original client name (see Interface.tools).
10161018
const result: Record<string, Tool & { client: string }> = {}
1019+
// altimate_change end
10171020
const s = yield* InstanceState.get(state)
10181021

10191022
const cfg = yield* cfgSvc.get()
@@ -1031,8 +1034,9 @@ export const layer = Layer.effect(
10311034
const timeout = requestTimeout(s, clientName, mcpConfig, defaultTimeout)
10321035
for (const mcpTool of listed) {
10331036
const key = McpCatalog.sanitize(clientName) + "_" + McpCatalog.sanitize(mcpTool.name)
1034-
// altimate_change — attach the original client name for source classification downstream.
1037+
// altimate_change start — attach the original client name for source classification downstream.
10351038
result[key] = Object.assign(McpCatalog.convertTool(mcpTool, client, timeout), { client: clientName })
1039+
// altimate_change end
10361040
}
10371041
}
10381042
return result

packages/opencode/src/session/prompt.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ import { registerAltimateValidators } from "../altimate/validators"
7171
registerAltimateValidators()
7272
import { Config } from "../config/config"
7373
import { Tracer } from "../altimate/observability/tracing"
74-
// altimate_change — stamp an authoritative tool source + humanized MCP title
74+
// altimate_change start — stamp an authoritative tool source + humanized MCP title
7575
import { stampRegistryToolSource, describeMcpTool } from "../altimate/tool-source"
7676
// altimate_change end
77+
// altimate_change end
7778
import { Telemetry } from "@/telemetry" // altimate_change — session telemetry
7879

7980
// @ts-ignore
@@ -1609,9 +1610,10 @@ export namespace SessionPrompt {
16091610
messageID: input.processor.message.id,
16101611
})),
16111612
}
1612-
// altimate_change — stamp authoritative tool source so clients render the right badge.
1613-
// Shared with SessionTools.resolve (session/tools.ts) so the two resolvers can't drift.
1613+
// altimate_change start — stamp authoritative tool source so clients render the right
1614+
// badge. Shared with SessionTools.resolve (session/tools.ts) so the resolvers can't drift.
16141615
const stamped = stampRegistryToolSource(output, item)
1616+
// altimate_change end
16151617
await Plugin.trigger(
16161618
"tool.execute.after",
16171619
{
@@ -1620,17 +1622,22 @@ export namespace SessionPrompt {
16201622
callID: ctx.callID,
16211623
args,
16221624
},
1625+
// altimate_change start — plugins observe the source-stamped output
16231626
stamped,
1627+
// altimate_change end
16241628
)
1629+
// altimate_change start — return the source-stamped output
16251630
return stamped
1631+
// altimate_change end
16261632
},
16271633
})
16281634
}
16291635

1636+
// altimate_change start — split the original client name off the model-facing tool object so
1637+
// it's used only for source classification and never leaks into the schema sent to the model.
16301638
for (const [key, entry] of Object.entries(await MCP.tools())) {
1631-
// altimate_change — split the original client name off the model-facing tool object so it's
1632-
// used only for source classification and never leaks into the tool schema sent to the model.
16331639
const { client: clientName, ...item } = entry
1640+
// altimate_change end
16341641
const execute = item.execute
16351642
if (!execute) continue
16361643

@@ -1708,19 +1715,23 @@ export namespace SessionPrompt {
17081715
}
17091716

17101717
const truncated = await Truncate.output(textParts.join("\n\n"), {}, input.agent)
1711-
// altimate_change — authoritative source + readable title from the original client name,
1712-
// shared with SessionTools.resolve (session/tools.ts) so the two resolvers can't drift.
1718+
// altimate_change start — authoritative source + readable title from the original client
1719+
// name, shared with SessionTools.resolve (session/tools.ts) so the resolvers can't drift.
17131720
const described = describeMcpTool(key, clientName)
1721+
// altimate_change end
17141722
const metadata = {
17151723
...(result.metadata ?? {}),
17161724
truncated: truncated.truncated,
17171725
...(truncated.truncated && { outputPath: truncated.outputPath }),
1726+
// altimate_change start — stamp the authoritative source badge
17181727
source: described.source,
1728+
// altimate_change end
17191729
}
17201730

17211731
return {
1722-
// altimate_change — MCP tools have no native title; give a readable label
1732+
// altimate_change start — MCP tools have no native title; give a readable label
17231733
title: described.title,
1734+
// altimate_change end
17241735
metadata,
17251736
output: truncated.content,
17261737
attachments: attachments.map((attachment) => ({

packages/opencode/src/session/prompt/default.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ If the user asks for help or wants to give feedback inform them of the following
66
- /help: Get help with using Altimate Code
77
- To give feedback, users should report the issue at https://github.com/AltimateAI/altimate-code/issues
88

9+
// altimate_change start — altimate docs URL
910
When the user directly asks about Altimate Code (eg 'can altimate do...', 'does altimate have...') or asks in second person (eg 'are you able...', 'can you do...'), use the WebFetch tool to gather information to answer the question from Altimate Code docs. The list of available docs is available at https://help.altimate.ai/code
11+
// altimate_change end
1012

1113
# Tone and style
1214
You should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).

packages/opencode/src/session/tools.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ import { Session } from "./session"
1818
import { SessionProcessor } from "./processor"
1919
import { PartID } from "./schema"
2020
import { EffectBridge } from "@/effect/bridge"
21-
// altimate_change — shared tool-source stamping so this resolver can't drift from prompt.ts
21+
// altimate_change start — shared tool-source stamping so this resolver can't drift from prompt.ts
2222
import { stampRegistryToolSource, describeMcpTool } from "@/altimate/tool-source"
23+
// altimate_change end
2324
// altimate_change start — upstream_fix: ToolRegistry expects fork-branded model ids here
2425
import { ModelID } from "@/provider/schema"
2526
// altimate_change end
@@ -104,27 +105,33 @@ export const resolve = Effect.fn("SessionTools.resolve")(function* (input: {
104105
messageID: input.processor.message.id,
105106
})),
106107
}
107-
// altimate_change — stamp authoritative tool source (shared with prompt.ts resolveTools)
108+
// altimate_change start — stamp authoritative tool source (shared with prompt.ts resolveTools)
108109
const stamped = stampRegistryToolSource(output, item)
110+
// altimate_change end
109111
yield* plugin.trigger(
110112
"tool.execute.after",
111113
{ tool: item.id, sessionID: ctx.sessionID, callID: ctx.callID, args },
114+
// altimate_change start — plugins observe the source-stamped output
112115
stamped,
116+
// altimate_change end
113117
)
118+
// altimate_change start — propagate the source-stamped output
114119
if (options.abortSignal?.aborted) {
115120
yield* input.processor.completeToolCall(options.toolCallId, stamped)
116121
}
117122
return stamped
123+
// altimate_change end
118124
}),
119125
)
120126
},
121127
})
122128
}
123129

130+
// altimate_change start — split the original client name off the model-facing tool object so
131+
// it's used only for source classification and never leaks into the schema sent to the model.
124132
for (const [key, entry] of Object.entries(yield* mcp.tools())) {
125-
// altimate_change — split the original client name off the model-facing tool object so it's
126-
// used only for source classification and never leaks into the tool schema sent to the model.
127133
const { client: clientName, ...item } = entry
134+
// altimate_change end
128135
const execute = item.execute
129136
if (!execute) continue
130137

@@ -184,18 +191,23 @@ export const resolve = Effect.fn("SessionTools.resolve")(function* (input: {
184191
}
185192

186193
const truncated = yield* truncate.output(textParts.join("\n\n"), {}, input.agent)
187-
// altimate_change — authoritative source + readable title from the original client name,
188-
// shared with prompt.ts resolveTools so the two resolvers can't drift.
194+
// altimate_change start — authoritative source + readable title from the original client
195+
// name, shared with prompt.ts resolveTools so the two resolvers can't drift.
189196
const described = describeMcpTool(key, clientName)
197+
// altimate_change end
190198
const metadata = {
191199
...result.metadata,
192200
truncated: truncated.truncated,
193201
...(truncated.truncated && { outputPath: truncated.outputPath }),
202+
// altimate_change start — stamp the authoritative source badge
194203
source: described.source,
204+
// altimate_change end
195205
}
196206

197207
const output = {
208+
// altimate_change start — MCP tools have no native title; give a readable label
198209
title: described.title,
210+
// altimate_change end
199211
metadata,
200212
output: truncated.content,
201213
attachments: attachments.map((attachment) => ({

packages/opencode/src/tool/registry.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,11 @@ export namespace ToolRegistry {
240240
function fromPlugin(id: string, def: ToolDefinition): Tool.Info {
241241
return {
242242
id,
243-
// altimate_change — user custom tools (file-scanned) and third-party plugin tools both flow
244-
// through here; mark them "external" so the tool-source badge stays neutral and never
243+
// altimate_change start — user custom tools (file-scanned) and third-party plugin tools both
244+
// flow through here; mark them "external" so the tool-source badge stays neutral and never
245245
// over-claims them as Altimate-owned.
246246
registrySource: "external",
247+
// altimate_change end
247248
init: () =>
248249
legacyToInit({
249250
// altimate_change start — tolerate JSON-Schema-shaped legacy args (see argsToZodShape)
@@ -559,8 +560,9 @@ export namespace ToolRegistry {
559560
await Plugin.trigger("tool.definition", { toolID: t.id }, output)
560561
return {
561562
id: t.id,
562-
// altimate_change — carry declared origin to the resolvers' source-badge stamping.
563+
// altimate_change start — carry declared origin to the resolvers' source-badge stamping.
563564
registrySource: t.registrySource,
565+
// altimate_change end
564566
// altimate_change start — upstream_fix: hide disabled runtime-gated tool schema fields.
565567
...applyRuntimeToolSchemaFlags(t.id, tool, runtimeFlags),
566568
// altimate_change end

packages/opencode/src/tool/skill.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,9 @@ export const SkillTool = Tool.define("skill", async (ctx) => {
204204
metadata: {
205205
name: skill.name,
206206
dir,
207-
// altimate_change — origin drives the source badge (see altimate/tool-source.ts skillToolSource)
207+
// altimate_change start — origin drives the source badge (see altimate/tool-source.ts skillToolSource)
208208
skillOrigin,
209+
// altimate_change end
209210
},
210211
}
211212
// altimate_change end

0 commit comments

Comments
 (0)