Skip to content

fix(context): make provider-dropping note truthful for declared windows - #5174

Open
SummerC0zyR0ck wants to merge 1 commit into
apache:mainfrom
SummerC0zyR0ck:fix/context-provider-dropping-declared-window
Open

fix(context): make provider-dropping note truthful for declared windows#5174
SummerC0zyR0ck wants to merge 1 commit into
apache:mainfrom
SummerC0zyR0ck:fix/context-provider-dropping-declared-window

Conversation

@SummerC0zyR0ck

@SummerC0zyR0ck SummerC0zyR0ck commented Sep 11, 2026

Copy link
Copy Markdown

Summary

Fixes #5137

context_provider_dropping could be emitted for requests with an already-declared context window, but its Desktop and TUI copy always told the user to declare one. This produced contradictory system notes when context_window_overrun simultaneously acknowledged the existing declaration.

The note now records the declaration state at call time, using midTurnState.capacity as the Runtime authority. Rendering handles all three cases:

  • Declared window: acknowledges that the window is already configured and does not repeat the declaration recommendation.
  • Undeclared window: recommends declaring one so Maka can compact before sending.
  • Legacy records without the new field: uses a neutral explanation and does not infer current settings from mutable configuration.

The behavior is consistent across Runtime data, Desktop materialization, English, zh-CN, zh-TW, and TUI rendering.

Verification

The issue reproduction was confirmed on the current main branch: the existing declared-window Runtime fixtures passed while the zh-CN renderer still told the user to declare a context window. After the fix, the declaration state is recorded in the durable note and the rendered guidance is truthful for declared, undeclared, and legacy records.

Passed affected builds and regressions:

  • Runtime provider-dropping suite: 8/8 passed, including normal and slow-ledger-consumer variants. The tests verify both the diagnostic payload and the persisted contextWindowDeclared value.
  • UI materialization tests covering declared-window, undeclared-window, and legacy-note rendering.
  • TUI transcript rendering test for an already-declared context window.
  • Runtime, UI, runtime-host, eval, and CLI builds.
  • npm run format:check
  • npm run check:tui-copy
  • npm run check:locale-hygiene

The commit-time ASF license-header and protocol-epoch checks also passed.

The full repository test suite and full repository lint/typecheck suite were not run.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex investigated the defect and fixed, authored the implementation review, Runtime/UI/TUI regression tests.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — system notes now provide declaration-aware guidance and use a conservative fallback for legacy records.
  • No

@github-actions github-actions Bot added the effort/M Under 500 readable lines label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(context): provider-dropping note asks to declare an already-declared window

1 participant