Skip to content

Add per-model compaction budgets across Aiden runtimes - #301

Merged
sambitcreate merged 16 commits into
mainfrom
codex/pi-1-compaction
Oct 6, 2026
Merged

sambitcreate merged 16 commits into
mainfrom
codex/pi-1-compaction

Conversation

@sambitcreate

@sambitcreate sambitcreate commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Aiden previously used one compaction budget for every model. Settings → Memory now supports exact provider/model overrides for reserved and recent tokens, with validation and reset to defaults. Automatic foreground and subagent runs capture immutable settings; manual compaction uses the saved model's budget. The context meter follows the same reserve while preserving existing safety floors and unconfigured defaults.

The change preserves the existing Pi journal format, bounds impossible budgets for small windows and pi-vcc, ignores malformed externally edited budgets at runtime, and leaves mobile/Remote DTOs unchanged.

Stacked on #302 (codex/pi-1-integrations) through normal merges, including the atomic desktop/CLI Pi 1.0 upgrade and main afe51116d.

Validation:

  • Full compaction suite: 399 tests plus VCC/shared tests; real Agent retention tests cover default and zero-recent budgets and immutable child snapshots.
  • Config/child suite: 130; supervisor/child runner/portable/shared: 125; settings design: 61; final malformed-config/shared tests: 65.
  • Manual compaction test verifies a settings change during provider resolution does not alter its captured budget.
  • Electron settings test validates invalid input, save, relaunch persistence and reset: passed on first run with --fail-on-flaky-tests.
  • Electron build, root TypeScript, e2e TypeScript, scoped ESLint and React Doctor passed.
  • After merging the exact base: 51 focused tests, root TypeScript, standalone CLI build and CLI TypeScript passed. CLI types require its generated advisor declaration, so the fresh-install check was run after the normal CLI build.

After merging the latest integrations baseline: 126 focused compaction/config/child/codemode/tool-discovery tests and root TypeScript passed.

CI follow-up: an earlier hosted inventory job failed because newly added test files were missing from the explicit CI lane registry. Registration is now fixed in both the package scripts and CI registry; local registry validation passes. This was a configuration defect, not a flaky test.

CI follow-up (VCC build): runtime-subagents job110926895585 exposed a missing worker-build prerequisite for the zero-retention child compaction test. The lane now builds VCC first, and the CI registry regression verifies that mapping. A controlled missing-worker reproduction matched the failure; the real lane-selected build followed by the focused test passes on Node22.22.3. This was a deterministic CI configuration defect.

Review follow-up:

Editing a new model key preserves unsaved budgets. Initial and refreshed AGENTS instructions are checked against the captured model reserve before changing the admitted context. Restack validation at 0c5cefe65: 229 focused tests, CI policy47, and root types pass after building the required native reader and VCC worker. The earlier real Electron save/relaunch/reset regression also passes. A direct local test invocation initially omitted those build prerequisites; the correctly prepared run passed without production changes.

Validation counts above identify local or historical evidence, not hosted acceptance of a newer commit. Exact-head CI acceptance is recorded below; no PR in this stack has been merged. Historical failures and rerun evidence are retained above.

Historical exact-head CI acceptance

Verified 2026-10-02 at 20:35 UTC: all 23 reported checks passed on a1e480adac29b075904db379072506e00aae6f38, and all review threads are resolved. Historical failures and local validation scopes remain documented above. No PR has been merged; signed-package, physical-device, and live paid-provider acceptance remain separate.

Main integration and current CI

Main 2681471de is merged through the stack using normal merges. Head at that checkpoint: dc2831f880fde5d6227cdcabd6b7621ded87750c. This brings in #308’s correction for ActivityKit content delivery, the committed offline model catalog refresh, and the plan archive updates while preserving the active Pi plan. Earlier green checks above apply only to their recorded historical heads. Current-head CI is pending.

Local validation of the foundation merge passed 26 native integration tests, 204 offline catalog tests, 47 CI policy tests, and root/CLI TypeScript. Native tests used an explicitly selected iPhone 17 Pro / iOS 26.2 simulator with Xcode 27 beta; this is regression evidence, not physical-device or signed-release acceptance. All 96 plan-index links resolve. The remaining stack merges introduced no application, protocol, package, CI-registry, or vendored-advisor changes beyond the imported main delta. No old-head hosted job rerun was used; historical failures remain recorded.

Current-head reviewer status: Pullfrog run 37062326184 failed before review execution because the configured ChatGPT reviewer account reached its usage limit. No hosted retry has been requested while that quota condition persists. Product CI and review acceptance remain pending.

Reviewer retry: the reviewer service successfully completed #304 run37070135572 on its current head, providing evidence that capacity returned. On 2026-10-02, the single permitted retry of reviewer run 37062326184 was accepted for this PR’s unchanged dc2831f880fde5d6227cdcabd6b7621ded87750c head. The original quota failure remains recorded; the retry result is pending. No second retry will be used.

Plan-status review correction

Current head: ed8c88a3a14ed02ccfae67b15676ff578c6c059c. The #302 plan index and detail page now identify the custom MCP OAuth authorization-server metadata override as implemented, while retaining unfinished work as active. Normal downstream merges preserve their fuller completion summaries and acceptance matrix. This correction changes documentation only; all 96 local plan-index links resolve, and the cache-warming cancellation/accounting fix remains included. Review thread PRRT_kwDOTctvDc6ogeYl was answered and resolved with commit 56cb16abacd1ec96ddbfc897f72fd9e0a549a2c2. Prior behavioral validation retains its recorded scope; fresh exact-head CI is pending.

The previous-head reviewer retry completed successfully with no new issues. The current documentation-only head was also reviewed with no new issues. The original quota failure remains recorded; the single permitted retry has been used and will not be repeated.

Current exact-head CI acceptance

Verified 2026-10-02 at 23:26 UTC: all 23 reported checks passed on ed8c88a3a14ed02ccfae67b15676ff578c6c059c, and all review threads are resolved. Reviewer checks found no new issues after the main synchronization and documentation-only status correction. Historical failures and the single reviewer retry remain documented above. No PR has been merged; signed-package, physical-device and live paid-provider acceptance remain separate.

@very-hermes-bot very-hermes-bot 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.

Inline review — 1 finding(s) anchored to the diff. See the pinned summary comment for the overview.

@very-hermes-bot

very-hermes-bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Hermes Review Bot

Confidence: 5

Engine: agy/gemini-3.8-flash-high
Review mode: full
Head: 369ef9ddd90fc3540c3fa4af8e87f1184cb347a4
Generated: 2026-10-03T19:49:02+00:00
Reviews: 1

Summary

Per-model compaction budgets allow users to set exact token reservation and retention targets for individual provider/model combinations in Settings → Memory, replacing the previous global default across all models. The configuration is validated and stored in settings.json, with atomic single-model mutations that guard against lost updates and reject malformed external edits. Foreground runs (main/services/llm-client.ts), child agents (main/services/subagents/child-agent-runtime.ts), and manual compactions (main/services/context-lifecycle-service.ts) capture immutable budget snapshots, clamping infeasible configurations against small context windows and VCC engine requirements while keeping standard safety floors intact. The composer's context meter leverages a memoized compaction snapshot cached against DataStore document identity to avoid redundant cloning on hot paths. Maintainers should double-check that downstream custom tool providers or custom connection proxies conform to the expected provider/model key format without unexpected whitespace or control characters.

Confidence Score: 5/5

Fully traced and verified end-to-end across IPC boundaries, DataStore persistence, runtime context projection, subagent supervisor inheritance, and test coverage.

📁 Important Files Changed
  • renderer/shared/compaction.ts: Core validation, parsing, and bounding logic (parseCompactionModelOverrides, resolveCompactionModelBudget, and configuredCompactionReserveTokens).
  • renderer/components/settings/compaction-budget-settings.tsx: Settings UI component for managing and resetting per-model overrides with datalist autocomplete and input validation.
  • renderer/components/settings/memory-settings.tsx: Wires compaction budget settings into the Memory panel, sourcing model suggestions from configured providers and cached Codex status.
  • main/services/config-store-core.ts: Persists overrides, exposes an atomic single-model mutation (setCompactionModelBudget), and provides a memoized getCompactionSettings accessor for hot read paths.
  • main/services/generation-context.ts: Enforces captured compaction reserve floors during static context sizing and atomically validates updated AGENTS.md instructions via updateGenerationContextOptions.
  • main/services/llm-client.ts: Captures immutable per-model compaction budgets and input reserves during run preparation and binds them to the generation harness.
  • main/services/subagents/subagent-supervisor-core.ts & main/services/subagents/child-agent-runtime.ts: Propagates captured compaction settings to child agents and registers bounded budgets with the child runtime harness.
  • main/services/context-lifecycle-service.ts: Captures snapshot overrides during manual chat compaction before async provider runtime resolution.
  • scripts/ci-test-registry.json & scripts/ci-test-registry.test.mjs: Registers vcc-build prerequisite for the runtime-subagents CI lane to support child compaction budget recovery tests.

Findings

No findings.

📊 Sequence Diagram
sequenceDiagram
  autonumber
  actor User
  participant UI as MemorySettings / CompactionBudgetSettings
  participant IPC as IPC Main (providers.ts)
  participant Store as ConfigStore (config-store-core.ts)
  participant Runtime as LLM Client / Subagents / ContextLifecycle
  participant Coord as PiCompactionCoordinator

  User->>UI: Configure model budget (reserveTokens / keepRecentTokens)
  UI->>IPC: settings:setCompactionModelBudget(modelKey, budget)
  IPC->>Store: setCompactionModelBudget(modelKey, budget)
  Store->>Store: Atomic mutation & parseCompactionModelOverrides
  Store-->>UI: Return updated AppSettings
  Runtime->>Store: getCompactionSettings() / getSettings()
  Store-->>Runtime: CompactionSettingsSnapshot (memoized)
  Runtime->>Coord: Initialize with resolveCompactionModelBudget()
Loading

Machine-Readable Findings

[]

Last reviewed commit: 369ef9ddd90f
Reviews (1) · Comment /hermes review to trigger a new review · /hermes review full for full re-review

@pullfrog pullfrog 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.

Important

The post-instruction capacity recheck can bypass a configured model reserve; please address this before merging.

Reviewed changes This review covers per-model compaction budget validation, persistence, propagation across foreground/manual/subagent runtimes, and the Memory settings UI.

  • Validated model overrides. Exact provider/model keys and bounded reserve/recent-token values are persisted, with malformed external values ignored at runtime.
  • Applied budgets across runtimes. Captured overrides feed generation projection, context pressure, manual compaction, and child compaction, with small-window bounds and immutable subagent snapshots.
  • Added Settings and behavior coverage. Memory settings expose editing/reset, while tests cover persistence, limits, and captured budgets.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6-luna | 𝕏

Comment thread main/services/llm-client.ts Resolved
# Conflicts:
#	main/services/portable-config-core.test.ts
@sambitcreate
sambitcreate changed the base branch from codex/pi-1-runtime to codex/pi-1-integrations October 2, 2026 16:11

@pullfrog pullfrog 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.

ℹ️ No new compaction findings in the merge-only delta; the prior capacity-check finding remains open.

Reviewed changes This incremental review covers the commits added since the prior review: the branch merged the latest codex/pi-1-runtime baseline, and the compaction feature diff is unchanged relative to that base.

  • Merged the updated runtime baseline. Commit 0edec179 brings in c42320a2, which updates CLI MCP revocation handling; it adds no compaction-budget behavior.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6-luna | 𝕏

@pullfrog pullfrog 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.

ℹ️ No new compaction findings in the merged integrations baseline; the prior capacity-check finding remains open.

Reviewed changes This incremental review covers the merge added since the prior review. The codex/pi-1-integrations baseline adds codemode/deferred-tool and MCP OAuth work; the compaction feature diff remains unchanged against the updated base.

  • Merged the integrations baseline. The new Pi runtime tool partitioning retains the existing captured compaction reserve, and the merge introduces no additional compaction-budget behavior.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6-luna | 𝕏

@pullfrog pullfrog 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.

ℹ️ No new compaction findings in the latest baseline merge; the prior capacity-check finding remains open.

Reviewed changes This incremental review covers the merge added since the prior review. It brings in the latest codex/pi-1-integrations commit, with no change to the compaction-budget feature diff.

  • Merged latest integration fixes. The update preserves stdio MCP initialization and registers Pi codemode/tool-discovery suites in CI; it adds no compaction-budget behavior.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6-luna | 𝕏

@pullfrog pullfrog 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.

ℹ️ No new issues were found in this CI-only incremental delta. The existing capacity-check thread is unchanged and remains open.

Reviewed changes This incremental review covers the VCC worker prerequisite correction added after the previous Pullfrog review.

  • Registered the VCC worker build. Added vcc-build to the runtime-subagents lane and allowed that lane in the prerequisite mapping, so standalone CI plans the worker build before child-compaction tests.
  • Strengthened the registry check. Extended the behavioral test to verify the lane assignment and prerequisite eligibility.
  • Recorded the CI root cause. Added the failure reproduction and validation context to .memory/pi-100-ci-prerequisites.md.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6-luna | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes This incremental review covers changes since the prior Pullfrog review: the instruction-capacity correction, new-model editing behavior, and updated integrations merge.

  • Revalidated instruction updates. Initial and refreshed AGENTS changes now check the updated system prompt and tools against the generation's captured reserve before publishing; coverage verifies oversized instructions reject without replacing the previously admitted prompt.
  • Preserved in-progress budget values. Typing a new exact model key no longer clears reserve/recent values, with Electron coverage through save, relaunch, and reset.
  • Merged the updated integrations baseline. The merge introduces no new compaction-budget concerns in the reviewed delta.

Pullfrog  | View workflow run | Using gpt-6-luna | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes This incremental review covers the merge added since the previous Pullfrog review.

  • Established the held-response phase. Added a provider-request check before navigating away in the detached-response Stop E2E scenario, and documented the related hosted flake investigation and validation.

Pullfrog  | View workflow run | Using gpt-6-luna | 𝕏

@pullfrog

pullfrog Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Run failed. View the logs →

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using gpt-6-luna | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes This incremental review covers the merge since the prior Pullfrog review. The PR's compaction-budget implementation remains unchanged in this delta.

  • Imported the updated main baseline. Merged the plan archive/status refresh and generated offline model-capability snapshot.
  • Updated ActivityKit test synchronization. Replaced polling assertions with delivered-content events and a failure-only ceiling.

Pullfrog  | View workflow run | Using gpt-6-luna | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes This incremental review covers the documentation-only Pi plan-status correction merged since the previous Pullfrog review.

  • Corrected the active Pi plan status. Marked PR #302's provider/MCP OAuth metadata work implemented across the plan index and parity checklist; no runtime behavior changed.

Pullfrog  | View workflow run | Using gpt-6-luna | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes This incremental review covers the normal integration merges since the prior Pullfrog review: the refreshed integrations baseline and its documentation and status updates.

  • Integrated the main baseline. Merged the latest codex/pi-1-integrations updates, including #308's ActivityKit delivery-test correction, the offline model-capability refresh, and plan archives.
  • Reconciled Pi plan status. Updated the Pi parity plan and index to record PR #302's custom MCP OAuth metadata override as implemented.

Pullfrog  | View workflow run | Using gpt-6-luna | 𝕏

sambitcreate and others added 4 commits October 3, 2026 15:30
…om shrinking budgets (PR-301-1, PR-301-2)

Name the renderer's 16,384 / 20,000 fallbacks as shared constants, use them
for the settings descriptions and placeholders, and check them against pi's
DEFAULT_COMPACTION_SETTINGS so a pi upgrade cannot silently drift.

A model override that set only keepRecentTokens used to resolve a full budget
whose reserve fell back to pi's 16,384 default, which then replaced the
model-derived request reserve and shrank the input budget of small-window
models. The input-budget reserve now applies only when the user configured
reserveTokens; pi's compaction settings still receive the complete budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f all settings (PR-301-4)

The composer's context meter runs while the user types and was cloning and
re-normalizing the entire settings document on every call just to read two
compaction fields. The config store now exposes getCompactionSettings, which
reparses only when the settings store replaces its cached document (on every
write or external reload), and context pressure uses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Saving a budget fetched all settings and wrote the whole override map back,
costing two round trips and losing a concurrent edit to another model. A new
settings:setCompactionModelBudget IPC merges or clears one validated entry
inside the settings mutation, and refuses to overwrite a hand-edited invalid
map. The Memory page also stops firing a Codex auth-status request on open
and window focus (it reuses cached Codex models), and memoizes the model
suggestion list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes This incremental review covers the compaction optimizations and atomic settings updates added since the prior Pullfrog review at ed8c88a3.

  • Preserved recent-only input budgets. Applied an explicit-only request reserve consistently across foreground generation, child runtimes, and context-pressure reads while retaining the complete Pi compaction settings.
  • Centralized renderer defaults. Replaced duplicated default values with shared constants and checked them against Pi's runtime defaults.
  • Memoized compaction preferences. Reused validated settings snapshots until the stored document changes, with coverage for writes and external reloads.
  • Saved model budgets atomically. Added per-model IPC mutations that preserve concurrent edits, clear individual overrides, and refuse to overwrite malformed stored maps.
  • Reduced passive settings work. Reused cached Codex model suggestions without initiating auth-status reads and memoized suggestion lists.

Validation: 348 focused tests and root TypeScript passed after aligning installed dependencies with this branch using npm ci. Exact-head hosted CI remains pending; this approval does not establish merge acceptance.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

Base automatically changed from codex/pi-1-integrations to main October 6, 2026 00:28
@sambitcreate
sambitcreate merged commit 5413fb9 into main Oct 6, 2026
23 checks passed
@sambitcreate
sambitcreate deleted the codex/pi-1-compaction branch October 6, 2026 00:29
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.

2 participants