Show empty thread context as zero percent

This commit is contained in:
murashit 2026-07-07 22:26:57 +09:00
parent 42af40c299
commit dffca699f0
2 changed files with 21 additions and 1 deletions

View file

@ -98,7 +98,7 @@ function composerMetaViewModel(
const context = contextSummary(snapshot);
const selectedModel = resolution.model.effective;
const effort = resolution.reasoningEffort.effective;
const composerContext = contextComposerMeter(context?.percent ?? null);
const composerContext = contextComposerMeter(context?.percent ?? emptyThreadContextPercent(snapshot));
const compactEffort = effort ? compactReasoningEffortLabel(effort) : null;
const planActive = resolution.collaborationMode.effective === "plan";
const reviewActive = resolution.autoReview.active;
@ -122,6 +122,10 @@ function composerMetaViewModel(
};
}
function emptyThreadContextPercent(snapshot: RuntimeSnapshot): number | null {
return snapshot.activeThreadId ? null : 0;
}
function runtimeComposerChoices(input: RuntimeComposerChoicesInput): {
modelChoices: ChatPanelComposerRuntimeChoice[];
effortChoices: ChatPanelComposerRuntimeChoice[];

View file

@ -232,6 +232,22 @@ describe("chat panel surface projections", () => {
});
});
it("shows zero percent composer context before a thread starts", () => {
expect(composerProjectionFromState(composerProjectionActionsFixture(), chatStateFixture()).meta).toMatchObject({
fatal: null,
context: {
cells: [
{ text: "⣀", placeholder: true },
{ text: "⣀", placeholder: true },
{ text: "⣀", placeholder: true },
{ text: "⣀", placeholder: true },
],
percent: " 0%",
},
statusSummary: "Context 0%, plan off, auto-review off, fast off, model default, reasoning effort default",
});
});
it("keeps zero percent composer context fixed-width and visible", () => {
let state = chatStateFixture();
state = chatStateWith(state, { activeThread: { id: "thread-1" } });