Skip to content

fix(compaction): skip microcompact when compaction is off - #1800

Merged
kevincodex1 merged 3 commits into
Twigpine:mainfrom
chioarub:fix/microcompact-respects-off
Jun 27, 2026
Merged

kevincodex1 merged 3 commits into
Twigpine:mainfrom
chioarub:fix/microcompact-respects-off

Conversation

@chioarub

@chioarub chioarub commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Skip automatic query-loop microcompact when maxMessagesCompactionThreshold is explicitly "off".
  • Preserve automatic microcompact for unset/default and numeric thresholds, and keep explicit compact-source behavior intact.
  • Preserve unset-vs-explicit config state so "off" can be detected without raw config file reads.

Implementation

  • Read the raw configured threshold once in queryLoop, normalize it once for later message-count logic, and gate only the automatic microcompact call.
  • Keep default global config omitting maxMessagesCompactionThreshold; migration normalizes only present values.
  • Add regression coverage for explicit off, unset/default, numeric threshold, explicit compact source, compacted message handoff, and typed query deps fixtures.

Tests

  • bun test src/query/autoCompactCooldown.test.ts
  • bun test src/query*.test.ts
  • bun test src/query/*.test.ts
  • bun test src/services/compact/autoCompact.test.ts src/services/compact/microCompact.test.ts
  • bun test src/services/contextCollapse/*.test.ts
  • bun run typecheck
  • bun run typecheck:type-tests
  • bun run build
  • bun run smoke
  • bun run security:pr-scan -- --base upstream/main
  • git diff --check

Risk

  • The intentionally preserved behavior is that an unset setting still allows automatic microcompact; only an explicitly persisted "off" disables that automatic path.
  • Known baseline: bun test src/services/compact/*.test.ts fails when compact.test.ts runs before autoCompact.test.ts because of an existing order-dependent test fixture leak; the targeted compact tests above pass.

Fixes #1715

Skip automatic query-loop microcompact when the message-count compaction threshold is explicitly set to off, while preserving default, numeric, and explicit compact behavior.
@coderabbitai

coderabbitai Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e752aebc-f0f0-4417-8b6f-ca5c898450bb

📥 Commits

Reviewing files that changed from the base of the PR and between 419c81e and 860c24d.

📒 Files selected for processing (1)
  • src/query/autoCompactCooldown.test.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: smoke-and-tests
  • GitHub Check: typecheck
🧰 Additional context used
📓 Path-based instructions (9)
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/query/autoCompactCooldown.test.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • src/query/autoCompactCooldown.test.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/query/autoCompactCooldown.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/query/autoCompactCooldown.test.ts
🔇 Additional comments (1)
src/query/autoCompactCooldown.test.ts (1)

13-15: LGTM!

Also applies to: 206-217, 220-237, 311-315, 330-332, 368-392, 436-447, 489-498, 536-552


📝 Walkthrough

Walkthrough

The PR updates compaction threshold handling so unset and explicit 'off' values are distinguished, query compaction runs conditionally, and tests cover the updated behavior.

Changes

Max-message compaction handling

Layer / File(s) Summary
Config default and migration
src/utils/config.ts
maxMessagesCompactionThreshold is left unset in the default config, and migration preserves an absent field instead of rewriting it to 'off'.
Query compaction flow
src/query.ts
The query loop caches the raw and normalized threshold, skips microcompact when the threshold is 'off' unless querySource is 'compact', and reuses the normalized threshold in the force-compaction branch.
Cooldown test coverage
src/query/autoCompactCooldown.test.ts
The test setup restores both config fields and environment values, adds shared successful-query helpers, and covers the updated microcompact threshold cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Gitlawb/openclaude#1587: Introduces the compaction-threshold behavior and config handling that this PR adjusts for unset vs 'off' values and query-loop execution.

Suggested labels

bug

Suggested reviewers

  • jatmn
🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, scoped, and accurately matches the compaction behavior change.
Description check ✅ Passed The description covers the summary, implementation, tests, and risk; the missing template sections are non-critical.
Linked Issues check ✅ Passed The changes address #1715 by preventing automatic microcompact when the threshold is explicitly off while preserving other cases.
Out of Scope Changes check ✅ Passed The config and test updates stay within the compaction fix and regression coverage scope.
Risk Surface Disclosed ✅ Passed Diff only changes compaction threshold handling in query/config/tests; no auth, network, permissions, MCP, CI, release, or startup/home surfaces are touched.
No Hidden Policy Change ✅ Passed Only compaction-threshold handling changed, and it’s explicitly documented; no hidden trust/routing/telemetry/permission-policy shifts found.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/query.ts`:
- Around line 512-528: The explicit off setting is still allowing automatic
compaction because there is another deps.microcompact() path in queryLoop that
is not covered by the new guard. Update query.ts so every automatic microcompact
call is gated by the same maxMessagesCompactionThreshold !== 'off' check, while
keeping querySource === 'compact' as the only bypass; use the queryLoop and
deps.microcompact symbols to locate and apply the fix consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 229a586a-6562-4cc6-b28f-87658251ade4

📥 Commits

Reviewing files that changed from the base of the PR and between 13cf30a and 0fcf24f.

📒 Files selected for processing (3)
  • src/query.ts
  • src/query/autoCompactCooldown.test.ts
  • src/utils/config.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: typecheck
🧰 Additional context used
📓 Path-based instructions (10)
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/query/autoCompactCooldown.test.ts
  • src/utils/config.ts
  • src/query.ts
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • src/query/autoCompactCooldown.test.ts
  • src/utils/config.ts
  • src/query.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/query/autoCompactCooldown.test.ts
  • src/utils/config.ts
  • src/query.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/query/autoCompactCooldown.test.ts
  • src/utils/config.ts
  • src/query.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • src/query/autoCompactCooldown.test.ts
  • src/utils/config.ts
  • src/query.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/query/autoCompactCooldown.test.ts
  • src/utils/config.ts
  • src/query.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/query/autoCompactCooldown.test.ts
{src/services/**/*.ts,src/utils/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use execa for child processes

Files:

  • src/utils/config.ts
🪛 GitHub Check: smoke-and-tests
src/query/autoCompactCooldown.test.ts

[failure] 236-236: error: expect(received).not.toHaveBeenCalled()
Expected number of calls: 0
Received number of calls: 1

  at <anonymous> (/home/runner/work/openclaude/openclaude/src/query/autoCompactCooldown.test.ts:236:28)
🔇 Additional comments (3)
src/utils/config.ts (1)

699-747: LGTM!

Also applies to: 1154-1165

src/query.ts (1)

17-17: LGTM!

Also applies to: 454-459, 584-584

src/query/autoCompactCooldown.test.ts (1)

17-76: LGTM!

Also applies to: 178-286

Comment thread src/query.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/query/autoCompactCooldown.test.ts (1)

216-220: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace the never cast with the real deps type. successfulQueryDeps() and runSuccessfulQuery() should use the actual QueryDeps/Parameters<typeof query>[0]['deps'] type so this fixture still catches deps-shape changes at compile time.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/query/autoCompactCooldown.test.ts` around lines 216 - 220, The query test
fixture is using an incorrect `never` type for the `deps` parameter in
`runSuccessfulQuery`, which prevents compile-time detection of dependency shape
changes. Update `successfulQueryDeps()` and `runSuccessfulQuery()` to use the
real `QueryDeps` type or `Parameters<typeof query>[0]['deps']` from
`loadQuery()`/`query` so the fixture stays aligned with the actual deps
contract.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/query/autoCompactCooldown.test.ts`:
- Around line 216-220: The query test fixture is using an incorrect `never` type
for the `deps` parameter in `runSuccessfulQuery`, which prevents compile-time
detection of dependency shape changes. Update `successfulQueryDeps()` and
`runSuccessfulQuery()` to use the real `QueryDeps` type or `Parameters<typeof
query>[0]['deps']` from `loadQuery()`/`query` so the fixture stays aligned with
the actual deps contract.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c1e18587-d2f3-452f-8db8-547cab1329c6

📥 Commits

Reviewing files that changed from the base of the PR and between 0fcf24f and 419c81e.

📒 Files selected for processing (1)
  • src/query/autoCompactCooldown.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: typecheck
  • GitHub Check: smoke-and-tests
🧰 Additional context used
📓 Path-based instructions (9)
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/query/autoCompactCooldown.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/query/autoCompactCooldown.test.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • src/query/autoCompactCooldown.test.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/query/autoCompactCooldown.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/query/autoCompactCooldown.test.ts
🔇 Additional comments (2)
src/query/autoCompactCooldown.test.ts (2)

14-28: LGTM!


185-189: LGTM!

@chioarub

Copy link
Copy Markdown
Contributor Author

@CodeRabbit final review

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

CodeRabbit chat interactions are restricted to organization members for this repository. Ask an organization member to interact with CodeRabbit, or set chat.allow_non_org_members: true in your configuration.

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. I do not see any actionable issues from my review.

@kevincodex1 LGTM

@kevincodex1
kevincodex1 merged commit 320d63c into Twigpine:main Jun 27, 2026
4 checks passed
@chioarub
chioarub deleted the fix/microcompact-respects-off branch June 27, 2026 23:51
hotmanxp pushed a commit to hotmanxp/openclaude that referenced this pull request Jun 29, 2026
)

* fix(compaction): respect disabled microcompact setting

Skip automatic query-loop microcompact when the message-count compaction threshold is explicitly set to off, while preserving default, numeric, and explicit compact behavior.

* test(query): isolate auto-compact config regression

* test(query): type auto-compact deps fixture
hotmanxp added a commit to hotmanxp/openclaude that referenced this pull request Jun 29, 2026
Cherry-pick 320d63c (fix(compaction): skip microcompact when compaction
is off Twigpine#1800) introduced a call to normalizeMaxMessagesCompactionThreshold
at src/query.ts:473, but during conflict resolution the upstream import
line did not land. query.ts imported only getGlobalConfig from
'./utils/config.js' — the new helper was referenced without being
imported.

Symptom (caught by opencc-full-verify /phase3-tui):
  ReferenceError: normalizeMaxMessagesCompactionThreshold is not defined
  at every node dist/cli.mjs -p invocation.

Fix: extend the existing ./utils/config.js named import to include
normalizeMaxMessagesCompactionThreshold.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: microcompact ignores maxMessagesCompactionThreshold: 'off' setting

3 participants