Skip to content

Let one setting cap summaries at once for chat and import - #190

Merged
jonaslsaa merged 3 commits into
mainfrom
fix/shared-jobs-setting
Oct 17, 2026
Merged

jonaslsaa merged 3 commits into
mainfrom
fix/shared-jobs-setting

Conversation

@jonaslsaa

Copy link
Copy Markdown
Owner

Chat compaction always ran 8 summaries in parallel (jobs = 8 in Memory.open), so a provider that caps parallel requests below that (7 in #186) got 429s on every burst. Only imports had a setting for it.

Fix: the import setting now covers both. importJobs ("Import: summaries at once") is renamed to jobs ("Summaries at once", still default 8, 1 to 64) and is passed into Memory.open for chat as well as into runImport. Chat picks a change up the next time the profile opens (e.g. /reload); imports on the next import.

Legacy key: a config.json that still has importJobs and no jobs keeps its value (one line in readSettings); the next save writes jobs only. One test covers that.

README and docs/recipe-differences.md updated.

Closes #186

Copilot AI balanced review requested due to automatic review settings October 17, 2026 22:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

Both execution paths use the shared setting, legacy values remain supported, and no blocking issues were identified.

No open issues 🎉

What changed in this PR

Unifies chat and import summary concurrency under one setting, allowing users to reduce parallel requests to match provider limits.

Changes:

  • Renames importJobs to jobs and applies it to chat and imports.
  • Preserves legacy configuration values and adds migration coverage.
  • Updates documentation for the shared setting and when changes apply.
File Description
test/​settings.test.ts Updates validation tests and covers legacy configuration loading.
src/​settings.ts Defines the shared setting and legacy fallback.
src/​memory.ts Updates the concurrency parameter comment.
src/​index.ts Passes the shared setting to chat and imports.
src/​import/​job.ts Uses the renamed default and updates its comment.
README.md Documents shared concurrency and legacy compatibility.
docs/​recipe-differences.md Describes configurable summary concurrency.

Review effort: Balanced

@jonaslsaa
jonaslsaa merged commit 1c38c64 into main Oct 17, 2026
4 checks passed
@jonaslsaa
jonaslsaa deleted the fix/shared-jobs-setting branch October 17, 2026 22:29
delneg added a commit to delneg/opt-chat that referenced this pull request Oct 20, 2026
A compaction's context was the compactions' view up to its node, and the
view counts a line not summarized as nothing. At the start of an import,
short messages are built at once, merges far ahead got ready, and each
saw hundreds of message heads: 380 KB at the median, 900 KB at most,
against 16 to 32 KB. One import cost $281 of compactions in a morning.
Now, as in UniiChat (Memory.ts build, `upto`; fit, `seen`), the
compactions' view holds built lines alone and ends at the first message
not summarized; a node starts only when its context ends near the
frontier; the cached first message ends before any line not built.
https://github.com/VictorTaelin/UniiChat/blob/main/Memory.ts

Imported messages are marked and built after the chat's own, and a turn
waits for the chat's lines alone (UniiChat's sides). -jobs sets the
compactions running at once, after
jonaslsaa/pi-optchat#190.

An imported chat's AI replies are of kind ai, not opt: another AI's
words, which Opt must not take for its own (UniiChat prompt.txt).

Also: calls waiting on a prefix go as its writer's response begins
(UniiChat AskAI.ts single flight); free lines are written in one write;
zoom's error lists the valid forms and the roots; an unreadable view.json
is kept aside (after https://github.com/mneves75/uniichat).

TestCacheReplay replays 4,000 messages with an import burst against a
fake cache, after UniiChat's cache.test.ts: master reads 37% of
compactions' input from the cache and sends one 527 KB; now 83%, none
over 32 KB. docs/2026-10-20-compaction-context.md has the measurements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Limiting parallel compactions

2 participants