Skip to content

fix(agents): avoid repeated subagent-result prompt rendering - #115263

Merged
steipete merged 1 commit into
mainfrom
codex/fix-106574-steering-single-pass
Jul 28, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-106574-steering-single-pass

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #106574

What Problem This Solves

Fixes an issue where users receiving many completed subagent results would incur quadratic prompt-rendering work while OpenClaw assembled their next parent turn. Thanks to @aniruddhaadak80 for reporting the repeated-rendering path.

Why This Change Was Made

Render each completion section exactly once, account for the existing 24,000-character soft limit including its actual separators, and assemble the final prompt once. Preserve deterministic ordering, exact existing prompt bytes, metadata sanitization, the per-result limit, the first-oversized-item exception, pending overflow, and empty-queue behavior. No provider, configuration, public API, or dependency changes.

User Impact

Subagent completion backlogs are incorporated in linear time without changing what users see in the agent prompt or which completion results are delivered.

Evidence

  • Regression-first remote Linux proof: the unchanged production code rendered 12 completion sections 90 times, failing expected 90 to be 12; the other 10 focused tests passed.
  • After the single-pass fix, node scripts/run-vitest.mjs src/agents/agent-steering-queue.test.ts passes 11/11 tests on the same trusted Blacksmith Testbox.
  • Added deterministic tests for exact prompt bytes and section numbering, one render per selected completion, and an empty queue; existing coverage verifies overflow remains pending, ordering, sanitization, fallback results, stale leases, and Unicode-safe truncation.
  • Regression-run evidence: https://github.com/openclaw/openclaw/actions/runs/30372333867
  • Fresh gpt-5.6-sol xhigh autoreview: autoreview clean: no accepted/actionable findings reported (overall: patch is correct (0.97)).
  • git diff --check passes; the two affected source files were verified unchanged against the frozen latest main before the reviewed patch was committed.

AI-assisted; independently source-reviewed and tested against the repository's existing steering queue behavior.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Jul 28, 2026
@steipete
steipete merged commit 76f57da into main Jul 28, 2026
122 of 125 checks passed
@steipete
steipete deleted the codex/fix-106574-steering-single-pass branch July 28, 2026 15:53
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 28, 2026
…etwork-none

* origin/main: (24 commits)
  refactor(sessions): isolate legacy transcript fixtures (#115231)
  fix(discord): clear pending launch watchdog (#115100)
  fix(agents): stop quadratic subagent prompt rendering (#115263)
  fix(memory-core): recover dreaming cron reconciliation (#115174)
  fix(qa-lab): filter incompatible channel scenarios (#115087)
  fix(android): respect locale in compact labels
  test(i18n): prove iOS discovery catalog ownership
  chore(i18n): refresh gateway discovery catalogs
  fix(i18n): include shared discovery copy in macOS catalog
  fix(apple): localize gateway discovery status
  chore(i18n): drop release-owned changelog entry
  fix(macos): localize privacy permission prompts
  fix(voice-call): bracket IPv6 webhook hosts (#115135)
  test(ci): split control UI scope coverage
  fix(ui): detect composed accessibility copy
  fix(ci): run localization checks for UI changes
  test(ui): catch untranslated accessibility labels
  fix(ui): localize chat action labels
  fix(ui): localize chat status indicators
  fix(ui): sync document locale metadata
  ...
vincentkoc added a commit that referenced this pull request Jul 28, 2026
…-20260728

* origin/main: (21 commits)
  refactor(sessions): isolate legacy transcript fixtures (#115231)
  fix(discord): clear pending launch watchdog (#115100)
  fix(agents): stop quadratic subagent prompt rendering (#115263)
  fix(memory-core): recover dreaming cron reconciliation (#115174)
  fix(qa-lab): filter incompatible channel scenarios (#115087)
  fix(android): respect locale in compact labels
  test(i18n): prove iOS discovery catalog ownership
  chore(i18n): refresh gateway discovery catalogs
  fix(i18n): include shared discovery copy in macOS catalog
  fix(apple): localize gateway discovery status
  chore(i18n): drop release-owned changelog entry
  fix(macos): localize privacy permission prompts
  fix(voice-call): bracket IPv6 webhook hosts (#115135)
  test(ci): split control UI scope coverage
  fix(ui): detect composed accessibility copy
  fix(ci): run localization checks for UI changes
  test(ui): catch untranslated accessibility labels
  fix(ui): localize chat action labels
  fix(ui): localize chat status indicators
  fix(ui): sync document locale metadata
  ...
vincentkoc added a commit to LZY3538/openclaw that referenced this pull request Jul 28, 2026
* origin/main: (199 commits)
  refactor(workboard): tidy Control UI card execution helpers (openclaw#115195)
  perf(agents): amortize history-limit eviction with hysteresis (openclaw#115273) (openclaw#115281)
  fix: schema-version refusal blames a downgrade that never happened and cannot identify the stale install (openclaw#115232)
  fix: restore Fish completion after global CLI options (openclaw#115222)
  refactor(agents): collapse the client-tool catalog branch (openclaw#115212)
  fix(macos): signed rebuild no longer stalls on app shutdown (openclaw#103957)
  fix(agents): prevent repeated Code Mode output across waits (openclaw#115213)
  refactor(ui): split Profile (identity) from Usage (statistics) (openclaw#115245)
  fix(channels): report a channel that cannot receive as unhealthy instead of connected (openclaw#115229)
  fix(cli): reject malformed infer model refs (openclaw#115225)
  feat(ui): finish the Lobsterdex at 42 with wild variants, squish fix, and blink variance (openclaw#115264)
  test(migrations): avoid mtime precision in checkpoint fixture (openclaw#115269)
  test(signal): verify archive limits without malformed tar (openclaw#115270)
  refactor(sessions): isolate legacy transcript fixtures (openclaw#115231)
  fix(discord): clear pending launch watchdog (openclaw#115100)
  fix(agents): stop quadratic subagent prompt rendering (openclaw#115263)
  fix(memory-core): recover dreaming cron reconciliation (openclaw#115174)
  fix(qa-lab): filter incompatible channel scenarios (openclaw#115087)
  fix(android): respect locale in compact labels
  test(i18n): prove iOS discovery catalog ownership
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Quadratic String Concatenation Bottleneck in selectPromptBoundedItems

1 participant