From bf5e44ca2725181bd16f9cf9961bd5a38652bf83 Mon Sep 17 00:00:00 2001 From: Sannidhya Sah Date: Tue, 1 Jul 2025 22:31:48 +0530 Subject: [PATCH 1/4] fix: remove context size from environment details (#5165) --- src/core/environment/__tests__/getEnvironmentDetails.spec.ts | 3 ++- src/core/environment/getEnvironmentDetails.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/environment/__tests__/getEnvironmentDetails.spec.ts b/src/core/environment/__tests__/getEnvironmentDetails.spec.ts index 02423f8ebda..b11d9cf863a 100644 --- a/src/core/environment/__tests__/getEnvironmentDetails.spec.ts +++ b/src/core/environment/__tests__/getEnvironmentDetails.spec.ts @@ -146,7 +146,8 @@ describe("getEnvironmentDetails", () => { expect(result).toContain("# VSCode Visible Files") expect(result).toContain("# VSCode Open Tabs") expect(result).toContain("# Current Time") - expect(result).toContain("# Current Context Size (Tokens)") + // Context size removed from model-facing output to prevent behavioral changes + // expect(result).toContain("# Current Context Size (Tokens)") expect(result).toContain("# Current Cost") expect(result).toContain("# Current Mode") expect(result).toContain("test-model") diff --git a/src/core/environment/getEnvironmentDetails.ts b/src/core/environment/getEnvironmentDetails.ts index 944eb941908..23e708dea10 100644 --- a/src/core/environment/getEnvironmentDetails.ts +++ b/src/core/environment/getEnvironmentDetails.ts @@ -203,7 +203,8 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo const contextPercentage = contextTokens && contextWindow ? Math.round((contextTokens / contextWindow) * 100) : undefined - details += `\n\n# Current Context Size (Tokens)\n${contextTokens ? `${contextTokens.toLocaleString()} (${contextPercentage}%)` : "(Not available)"}` + // Context size removed from model-facing output to prevent behavioral changes + // details += `\n\n# Current Context Size (Tokens)\n${contextTokens ? `${contextTokens.toLocaleString()} (${contextPercentage}%)` : "(Not available)"}` details += `\n\n# Current Cost\n${totalCost !== null ? `$${totalCost.toFixed(2)}` : "(Not available)"}` // Add current mode and any mode-specific warnings. From 0589fb52c9d92518dfcc638e2e1e33288b4f69e0 Mon Sep 17 00:00:00 2001 From: Sannidhya Sah Date: Tue, 1 Jul 2025 22:53:24 +0530 Subject: [PATCH 2/4] fix: remove commented-out context size code from PR #5312 --- src/core/environment/__tests__/getEnvironmentDetails.spec.ts | 2 -- src/core/environment/getEnvironmentDetails.ts | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/core/environment/__tests__/getEnvironmentDetails.spec.ts b/src/core/environment/__tests__/getEnvironmentDetails.spec.ts index b11d9cf863a..f7e63d86c6a 100644 --- a/src/core/environment/__tests__/getEnvironmentDetails.spec.ts +++ b/src/core/environment/__tests__/getEnvironmentDetails.spec.ts @@ -146,8 +146,6 @@ describe("getEnvironmentDetails", () => { expect(result).toContain("# VSCode Visible Files") expect(result).toContain("# VSCode Open Tabs") expect(result).toContain("# Current Time") - // Context size removed from model-facing output to prevent behavioral changes - // expect(result).toContain("# Current Context Size (Tokens)") expect(result).toContain("# Current Cost") expect(result).toContain("# Current Mode") expect(result).toContain("test-model") diff --git a/src/core/environment/getEnvironmentDetails.ts b/src/core/environment/getEnvironmentDetails.ts index 23e708dea10..651ea886866 100644 --- a/src/core/environment/getEnvironmentDetails.ts +++ b/src/core/environment/getEnvironmentDetails.ts @@ -203,8 +203,6 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo const contextPercentage = contextTokens && contextWindow ? Math.round((contextTokens / contextWindow) * 100) : undefined - // Context size removed from model-facing output to prevent behavioral changes - // details += `\n\n# Current Context Size (Tokens)\n${contextTokens ? `${contextTokens.toLocaleString()} (${contextPercentage}%)` : "(Not available)"}` details += `\n\n# Current Cost\n${totalCost !== null ? `$${totalCost.toFixed(2)}` : "(Not available)"}` // Add current mode and any mode-specific warnings. From ce819eb8889eba19b6098fb6916cfcafc63f43b2 Mon Sep 17 00:00:00 2001 From: Daniel Riccio Date: Tue, 1 Jul 2025 13:54:05 -0500 Subject: [PATCH 3/4] Remove unused contextPercentage variable (#5312) --- src/core/environment/getEnvironmentDetails.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/core/environment/getEnvironmentDetails.ts b/src/core/environment/getEnvironmentDetails.ts index 651ea886866..102a27cdf18 100644 --- a/src/core/environment/getEnvironmentDetails.ts +++ b/src/core/environment/getEnvironmentDetails.ts @@ -200,9 +200,6 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo const { id: modelId, info: modelInfo } = cline.api.getModel() const contextWindow = modelInfo.contextWindow - const contextPercentage = - contextTokens && contextWindow ? Math.round((contextTokens / contextWindow) * 100) : undefined - details += `\n\n# Current Cost\n${totalCost !== null ? `$${totalCost.toFixed(2)}` : "(Not available)"}` // Add current mode and any mode-specific warnings. From c4d6947baff0b94819b624001dbb2b77e7e0dbf8 Mon Sep 17 00:00:00 2001 From: Daniel <57051444+daniel-lxs@users.noreply.github.com> Date: Tue, 1 Jul 2025 14:06:08 -0500 Subject: [PATCH 4/4] Update src/core/environment/getEnvironmentDetails.ts Co-authored-by: Matt Rubens --- src/core/environment/getEnvironmentDetails.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/environment/getEnvironmentDetails.ts b/src/core/environment/getEnvironmentDetails.ts index 102a27cdf18..9120b5e8c70 100644 --- a/src/core/environment/getEnvironmentDetails.ts +++ b/src/core/environment/getEnvironmentDetails.ts @@ -197,8 +197,7 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo // Add context tokens information. const { contextTokens, totalCost } = getApiMetrics(cline.clineMessages) - const { id: modelId, info: modelInfo } = cline.api.getModel() - const contextWindow = modelInfo.contextWindow + const { id: modelId } = cline.api.getModel() details += `\n\n# Current Cost\n${totalCost !== null ? `$${totalCost.toFixed(2)}` : "(Not available)"}`