t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Kiro context window does not appear in thread details

Open gujunxiang opened this issue 1 week ago • 2 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Install and enable Kiro CLI 3.5.0 as a T3 Code provider.
  2. Open a thread backed by Kiro.
  3. In the thread details menu, enable Context window.
  4. Send at least one prompt and let Kiro finish.
  5. Open the thread details panel.

Expected behavior

The Context row should appear after Kiro reports context usage, showing the current context usage (at minimum the percentage reported by Kiro).

Actual behavior

The entire Context section is absent, even though the display setting is enabled.

Kiro reports context usage through a Kiro-specific ACP session_info_update:

{
  "sessionUpdate": "session_info_update",
  "_meta": {
    "kiro": {
      "kind": "context_usage",
      "usagePercentage": 9.38,
      "contextUsage": {
        "usagePercentage": 9.38
      }
    }
  }
}

T3's generic ACP adapter currently derives providerThread.contextUsage only from standard ACP usage_update notifications. Kiro's context_usage notification is therefore treated as session metadata and the web client receives no context-window snapshot, so it hides the row entirely.

Kiro's initialize capabilities also advertise _kiro/session/context, but the Kiro adapter does not currently call it.

Impact

Minor bug or occasional failure

Version or commit

Kiro CLI 3.5.0; T3 Code checkout 2808e878

Environment

Windows; T3 Code desktop; Kiro CLI provider

Logs or stack traces

Kiro reports a valid session_info_update with:
_meta.kiro.kind = "context_usage"
_meta.kiro.usagePercentage = 9.38

T3 does not produce a providerThread.contextUsage snapshot from this update.

Workaround

None. Enabling the Context window setting does not help because the provider snapshot has no usage data.

gujunxiang avatar Nov 23 '26 08:11 gujunxiang

I tried to reproduce this on the current build and could not.

Not run in the real app: this VM has no kiro-cli and no Kiro account, and Kiro's status probe needs both. Instead, on origin/main 8851fb79fe, ran the real Kiro adapter (makeKiroAdapterV2) against a scripted Kiro ACP subprocess (acp-replay-agent) in apps/server/src/orchestration-v2/Adapters/KiroAdapterV2.test.ts. Steps: open a session with Kiro's V3 initialize result (which advertises _kiro/session/context) and model claude-sonnet-4.5; start a turn; Kiro sends an agent_message_chunk, then the reporter's exact session_info_update with _meta.kiro.kind = "context_usage" and usagePercentage 9.38; Kiro answers session/prompt with end_turn. Observed: the turn completes, but no event carries a providerThread with contextUsage set (the collected list is []). Control: adding a standard usage_update in the same place makes the same assertion pass, so Kiro's context_usage notification is the only thing dropped. The web client hides the Context row when contextUsage is null, which matches the report. The failing test is on factory/repro-41338 (bb0032dc50).

Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

juliusmarminge avatar Nov 23 '26 08:11 juliusmarminge

This reproduction actually confirms the report rather than disproving it:

  • The exact Kiro context_usage notification produces no providerThread.contextUsage event.
  • Replacing it with a standard usage_update makes the assertion pass.
  • The web client hides the Context row when contextUsage is null.

That is the bug described in this issue, and the supplied evidence is deterministic at the adapter boundary. The fact that this VM could not run the real Kiro app means the complete end-to-end UI could not be checked, but it does not negate the confirmed protocol-to-state mismatch.

I can still reproduce it in the real app with Kiro CLI 3.5.0 on T3 Code checkout 2808e878: the Context window setting is enabled, Kiro emits kind: "context_usage" with a percentage, and the right-side Context section is absent.

Could you reopen this? The fix can be scoped to normalizing Kiro's context_usage notification (and/or using _kiro/session/context) into T3's ThreadTokenUsageSnapshot; the maximum-token question can be handled separately based on what _kiro/session/context returns.

gujunxiang avatar Nov 23 '26 08:11 gujunxiang