GeezerVison is showing github.com — refactor(site/src/pages/AgentsPage): require non-null context usage in the indicator by DanielleMaywood · Pull Request #29905 · coder/coder
Conversation
Stacked on #29890.
ContextUsageIndicator accepted usage: AgentContextUsage | null and read every field with usage?.. Inside the indicator, null and {} render the same thing: every field is missing. The indicator is hidden when AgentChatInput gets no contextUsage prop, and that stays true.
ChatPageContent now always builds one usage object: { ...rawUsage, compressionThreshold, context: chatContext }. Before, it passed null when there was no usage and no pinned context. In that case the new object only adds compressionThreshold, and the indicator only shows it when a percentage exists. A percentage needs usedTokens and contextLimitTokens, and neither is set in that case, so the output is the same.
AgentChatInputProps.contextUsage is now AgentContextUsage (optional, no null), and ContextUsageIndicator.usage is now required and non-null. This replaces 14 usage?. reads with usage..
- The
NoUsage story arg is now {} instead of null.
ChatPageContent is the only production caller that passes contextUsage. The other AgentChatInput callers leave it out, so the indicator stays hidden for them.
Verified: pnpm lint:types, check, lint:oxlint, lint:compiler, lint:knip, pnpm test src/pages/AgentsPage, and pnpm test:storybook for ContextUsageIndicator, AgentChatInput, ChatPageContent, AgentChatPage and AgentChatPageView stories.
Part of the AgentsPage nullability cleanup; see #29888 for the methodology.
Plan excerpt
Analysed on a local, unpushed merge of all cleanup branches; ranked with a local analysis script. After the bottom-up PRs only 43 dead slots remain, so what's left is nullability that is real at its origin. Two read-only agents reviewed the top origins in code. Guard counts from the tool overstate the win: many "guards" are real branches (loading, no workspace, first/last row).
| # |
Change |
Guards removed |
Size |
Risk |
| T1 |
ContextUsageIndicator.usage: build the usage object once in ChatPageContent (null behaves exactly like {}), make usage non-null; omitted prop keeps meaning "hidden" |
14 usage?. |
~4 files / 25 lines |
Very low; NoUsage story arg becomes {} |
This PR was generated by Coder Agents on behalf of @DanielleMaywood.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-09-25T14:15:30.443240Z |
f837077 |
Draft marked ready |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
jakehwll
jakehwll approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|