fix: compact boundary marker showing "undefined · ~NaNK tokens" on codex sessions#3378
Draft
k11kirky wants to merge 1 commit into
Draft
fix: compact boundary marker showing "undefined · ~NaNK tokens" on codex sessions#3378k11kirky wants to merge 1 commit into
k11kirky wants to merge 1 commit into
Conversation
…dex sessions The codex adapter emitted _posthog/compact_boundary with only sessionId, while the UI assumed trigger/preTokens were always present. Make the UI render gracefully without them and have the codex adapter report trigger: "auto" plus preTokens from its usage tracker. Generated-By: PostHog Code Task-Id: 71484330-f52a-49bb-a528-5c708028bbf9
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A user on a codex model (gpt-5.6-sol) saw the compaction marker render as "Conversation compacted · undefined · ~NaNK tokens". The codex app-server adapter emits
_posthog/compact_boundarywith onlysessionId, but the UI assumedtriggerandpreTokens(which only the Claude adapter sends) were always present, so it interpolatedundefinedandNaNstraight into the marker.Why
Codex sessions compact regularly, so every codex user hitting auto-compaction sees this broken marker in the transcript.
Changes
CompactBoundaryView(and the item types feeding it) now treattrigger/preTokensas optional and drop the missing segments instead of renderingundefined/NaN.trigger: "auto"(codex only self-compacts) andpreTokensfrom its usage tracker's last context-occupancy reading, so the marker shows real data going forward.How did you test this?
vitest run codex-app-server-agentinpackages/agent(75 passed), including an updated boundary test assertingtrigger/preTokens.vitest run buildConversationItemsinpackages/ui(32 passed).tsc --noEmiton@posthog/agentand@posthog/ui; biome check on changed files (only pre-existing warnings).Automatic notifications
Created with PostHog Code