[PR #3684] [CLOSED] [GUI] Preserve Output Room In Small Agent Contexts #4749

Closed
opened 2026-11-07 15:38:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3684
Author: @medking82
Created: 10/22/2026
Status: ❌ Closed

Base: main ← Head: codex/agent-output-budget-20261022


📝 Commits (2)

  • 2ee3fbe fix(gui): preserve output room in small agent contexts
  • f273ef6 fix: preserve output room after small-context tool calls

📊 Changes

9 files changed (+903 additions, -0 deletions)

View changed files

➕ apps/desktop/scripts/harness-budget.mjs (+52 -0)
📝 apps/desktop/scripts/stage-harness.mjs (+5 -0)
📝 apps/host/server/agent/README.md (+11 -0)
➕ apps/host/server/agent/output-budget-native-webview.png (+0 -0)
➕ apps/host/server/agent/output-budget-validation.json (+459 -0)
➕ apps/host/server/agent/output-budget-validation.md (+152 -0)
➕ apps/host/tests/fixtures/pi-ai-1.1.0-simple-options.js.fixture (+73 -0)
➕ apps/host/tests/fixtures/pi-ai-LICENSE (+25 -0)
➕ apps/host/tests/harness-budget.test.mjs (+126 -0)

📄 Description

Problem and result

At 8K Context, App 0.2.2's default agent can stop during thinking without an answer. The earlier draft also reproduced this after a successful read: its follow-up request had max_completion_tokens: 1 although the native prompt used only 6722 tokens. The final staged candidate completes the same tool turn and displays READY-3684 in the official native App (stop; follow-up cap 242).

Related App 0.2.2 acceptance: #3365 and #3373. This is a focused output-budget fix for the existing default agent.

Approach

The existing Harness staging step applies a guarded pi-ai 1.1.0 correction to its copied dependency. Below 64K, safety padding is at most one sixteenth of the window and half the estimated remaining room. Caller caps and the one-token no-room floor remain; 64K+ keeps the previous 4096-token calculation. Exact dependency version/source hashes and standalone-file checks guard the patch, and BUNDLE.json.patches records provenance.

Validation

Passed:

  • Windows / Node v24.12.0 / Harness 57190202: fresh frozen install, full build (9 build gates), production deploy, flatten/prune/import checks, staged --version, and authenticated web-profile boot.
  • 10 focused regression/guard tests; 12 staged integration tests; 0 failed, 0 skipped. The staged batch resolves the earlier inventory, compaction and response-settings skips. The real Harness compaction fixture uses six long scripted-model turns at 16K.
  • Real engine 0.1.47 / Swift Qwen3.8 IQ3_XXS / RTX 5080: official App 0.2.2 native WebView2 composer → default agent → read → READY-3684, with agent: true, demo: false, 8K, Manual, Medium and all 26 tools. First/follow-up wire caps 298 / 242.
  • Four additional real 8K turns through the App Host: 4 answers, 2 completed reads, all stop, final context 7106 tokens; no error, empty answer or one-token request.
  • Syntax, diff, receipt/source-hash consistency and privacy checks. All 189 protected file hashes remained unchanged; test processes and listeners were cleaned up.

Failed:

  • Expected pre-fix regression: 1 instead of 221; the earlier real follow-up also ended empty with length. Both drove the revised fix. No final functional check failed.

Not run:

  • Signed release installer, other operating systems/providers, and unbounded 8K tool/long-form stress. No Rust or engine source changed; CUDA/HIP/SYCL builds are not applicable.

Limits

The common clamp affects small windows across protocols; live model coverage is the local OpenAI chat route on Windows. The 8K conversation coverage is bounded. Cached prompt tokens were reused, so there is no performance claim. The correction ships with a newly staged component; installed Harness files are unchanged.

Source-bound report and exact commands · machine-readable receipts · actual native WebView2 capture.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3684 **Author:** [@medking82](https://github.com/medking82) **Created:** 10/22/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/agent-output-budget-20261022` --- ### 📝 Commits (2) - [`2ee3fbe`](https://github.com/Niko1221/Strata/commit/2ee3fbe32aa3c27a0159fb837137231063b1a58b) fix(gui): preserve output room in small agent contexts - [`f273ef6`](https://github.com/Niko1221/Strata/commit/f273ef65e8f4548125f3e72833cd61019b82080f) fix: preserve output room after small-context tool calls ### 📊 Changes **9 files changed** (+903 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `apps/desktop/scripts/harness-budget.mjs` (+52 -0) 📝 `apps/desktop/scripts/stage-harness.mjs` (+5 -0) 📝 `apps/host/server/agent/README.md` (+11 -0) ➕ `apps/host/server/agent/output-budget-native-webview.png` (+0 -0) ➕ `apps/host/server/agent/output-budget-validation.json` (+459 -0) ➕ `apps/host/server/agent/output-budget-validation.md` (+152 -0) ➕ `apps/host/tests/fixtures/pi-ai-1.1.0-simple-options.js.fixture` (+73 -0) ➕ `apps/host/tests/fixtures/pi-ai-LICENSE` (+25 -0) ➕ `apps/host/tests/harness-budget.test.mjs` (+126 -0) </details> ### 📄 Description ## Problem and result At 8K Context, App 0.2.2's default agent can stop during thinking without an answer. The earlier draft also reproduced this after a successful `read`: its follow-up request had `max_completion_tokens: 1` although the native prompt used only 6722 tokens. The final staged candidate completes the same tool turn and displays `READY-3684` in the official native App (`stop`; follow-up cap 242). ## Related discussion Related App 0.2.2 acceptance: #3365 and #3373. This is a focused output-budget fix for the existing default agent. ## Approach The existing Harness staging step applies a guarded pi-ai 1.1.0 correction to its copied dependency. Below 64K, safety padding is at most one sixteenth of the window and half the estimated remaining room. Caller caps and the one-token no-room floor remain; 64K+ keeps the previous 4096-token calculation. Exact dependency version/source hashes and standalone-file checks guard the patch, and `BUNDLE.json.patches` records provenance. ## Validation **Passed:** - Windows / Node v24.12.0 / Harness `57190202`: fresh frozen install, full build (**9 build gates**), production deploy, flatten/prune/import checks, staged `--version`, and authenticated web-profile boot. - **10 focused regression/guard tests; 12 staged integration tests; 0 failed, 0 skipped.** The staged batch resolves the earlier inventory, compaction and response-settings skips. The real Harness compaction fixture uses six long scripted-model turns at 16K. - Real engine 0.1.47 / Swift Qwen3.8 IQ3_XXS / RTX 5080: official App 0.2.2 native WebView2 composer → default agent → `read` → `READY-3684`, with `agent: true`, `demo: false`, 8K, Manual, Medium and all 26 tools. First/follow-up wire caps **298 / 242**. - Four additional real 8K turns through the App Host: **4 answers, 2 completed reads, all `stop`**, final context 7106 tokens; no error, empty answer or one-token request. - Syntax, diff, receipt/source-hash consistency and privacy checks. All 189 protected file hashes remained unchanged; test processes and listeners were cleaned up. **Failed:** - Expected pre-fix regression: `1` instead of `221`; the earlier real follow-up also ended empty with `length`. Both drove the revised fix. No final functional check failed. **Not run:** - Signed release installer, other operating systems/providers, and unbounded 8K tool/long-form stress. No Rust or engine source changed; CUDA/HIP/SYCL builds are not applicable. ## Limits The common clamp affects small windows across protocols; live model coverage is the local OpenAI chat route on Windows. The 8K conversation coverage is bounded. Cached prompt tokens were reused, so there is no performance claim. The correction ships with a newly staged component; installed Harness files are unchanged. [Source-bound report and exact commands](https://github.com/medking82/Strata/blob/f273ef65e8f4548125f3e72833cd61019b82080f/apps/host/server/agent/output-budget-validation.md) · [machine-readable receipts](https://github.com/medking82/Strata/blob/f273ef65e8f4548125f3e72833cd61019b82080f/apps/host/server/agent/output-budget-validation.json) · [actual native WebView2 capture](https://github.com/medking82/Strata/blob/f273ef65e8f4548125f3e72833cd61019b82080f/apps/host/server/agent/output-budget-native-webview.png). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:38:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4749
No description provided.