Skip to content

feat(execute_code): stdout spillover — recover truncated output instead of re-running - #97043

Merged
teknium1 merged 1 commit into
mainfrom
execute-code-stdout-spillover
Aug 28, 2026
Merged

teknium1 merged 1 commit into
mainfrom
execute-code-stdout-spillover

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Maintainer-directed. execute_code's 50KB head(40%)/tail(60%) truncation DISCARDED the middle forever — unlike web_extract, which stores full text to cache/web with a read_file recipe in its footer. This ports that recover-don't-rerun pattern to execute_code, at both layers where clipping happens:

Host-side (_truncate_stdout_text — kernel results + remote per-call fallback)

Full stdout spilled to cache/exec/stdout-<digest>.txt (content-keyed, so identical reruns coalesce; spill_safety.write_text_exclusive, same hardening as cache/web). Result gains stdout_spill_path, and the truncation warning now teaches the recipe: "FULL output saved to … — page it with read_file(path=…, offset=…) instead of re-running." 5MB spill ceiling mirrors web_tools' MAX_STORED_TEXT_CHARS rationale.

Cell-side (kernel runner — clips in the CHILD before replying, so host-side alone can't see the middle)

Runner's _bounded() spills full text to the kernel tmpdir (HERMES_KERNEL_SPILL_DIR, set at spawn) before clipping; reply carries stdout_spill_path; host surfaces it with the same recipe plus the kernel-specific hint that variables still exist ("printing a narrower slice next call is often cheaper"). Best-effort at both layers: a failed spill degrades to today's plain clipping, never blocks the result.

Verified live (real kernel, temp HERMES_HOME)

~400KB output with a unique needle at the midpoint (inside the discarded window):

  • inline output: needle absent (clipped, as before) → spill file: needle recovered, 500,026 bytes
  • warning carries the read_file recipe; small outputs produce zero spill artifacts; kernel reuse unaffected

One pre-existing test updated: the remote-truncation contract now also asserts the spill path exists and the file holds both HEAD and TAIL (stronger than the old warning-text pin). Per-call remote wording kept path-neutral — the kernel-state hint appears only on the kernel path where it's true.

Suites: 86 passed / 1 pre-existing failure (TestRpcTokenAuthorization). Refs #94647/#96787/#96991 (kernel arc), web_tools _store_full_text (pattern source).

…aved to cache/exec (host) or kernel tmpdir (cells), path + read_file recipe in the result
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on bc09d3e — feat(execute_code): stdout spillover — truncated output's fu

⚠️ Warnings

OSV vulnerability scan · View job

6 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 4m3s vs 4m6s (-1.2%). 8 job(s) slower, 3 faster, 1 unchanged.

  • Check no committed infographics / check-no-committed-infographics: +108.0s
  • OS-specific tests / Windows-only tests: -9.0s
  • OS-specific tests / macOS-only tests: +7.0s
  • OSV scan / Scan lockfiles / osv-scan: +6.0s
  • Python tests / Run tests: -4.0s

@teknium1
teknium1 merged commit ae8c976 into main Aug 28, 2026
35 checks passed
@teknium1
teknium1 deleted the execute-code-stdout-spillover branch August 28, 2026 10:05
@alt-glitch alt-glitch added type/feature New feature or request tool/code-exec execute_code sandbox tool/file File tools (read, write, patch, search) P3 Low — cosmetic, nice to have labels Aug 28, 2026
teknium1 added a commit that referenced this pull request Aug 28, 2026
…KB cap (#97048)

* fix(execute_code): limits line teaches spillover — big stdout is saved, not lost (follow-up to #97043)

* fix(execute_code): drop the editorializing tail from the limits line (maintainer review)
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
…aved to cache/exec (host) or kernel tmpdir (cells), path + read_file recipe in the result (NousResearch#97043)
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
…KB cap (NousResearch#97048)

* fix(execute_code): limits line teaches spillover — big stdout is saved, not lost (follow-up to NousResearch#97043)

* fix(execute_code): drop the editorializing tail from the limits line (maintainer review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have tool/code-exec execute_code sandbox tool/file File tools (read, write, patch, search) type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants