fix(hooks): use actual context window token counts

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-04 01:27:40 +09:00
parent 53eeac3f31
commit 146ca34a7a
3 changed files with 10 additions and 16 deletions
+3 -3
View File
@@ -106,7 +106,7 @@ describe("context-window-monitor", () => {
// #given token usage exceeds 70% threshold
// #when tool.execute.after is called
// #then context reminder should be appended to output
it("should append context reminder with doubled displayed counts when usage exceeds threshold", async () => {
it("should append context reminder with actual token counts when usage exceeds threshold", async () => {
const hook = createContextWindowMonitorHook(ctx as never)
const sessionID = "ses_high_usage"
@@ -138,8 +138,8 @@ describe("context-window-monitor", () => {
)
expect(output.output).toContain("context remaining")
expect(output.output).toContain("400,000-token context window")
expect(output.output).toContain("[Context Status: 80.0% used (320,000/400,000 tokens), 20.0% remaining]")
expect(output.output).toContain("200,000-token context window")
expect(output.output).toContain("[Context Status: 80.0% used (160,000/200,000 tokens), 20.0% remaining]")
expect(ctx.client.session.messages).not.toHaveBeenCalled()
})