Skip to content

chore: drop dead code, a fossil manifest comment, and an AGENTS.example.md over its own cap - #223

Merged
Max17190 merged 3 commits into
mainfrom
chore/drop-dead-code-and-fossil-comments
Aug 18, 2026
Merged

chore: drop dead code, a fossil manifest comment, and an AGENTS.example.md over its own cap#223
Max17190 merged 3 commits into
mainfrom
chore/drop-dead-code-and-fossil-comments

Conversation

@Max17190

@Max17190 Max17190 commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Why

An audit of the tree for accidental bloat, run after #222. The repository itself is clean (68 tracked files, all source; 2.4 MiB pack, no binaries or assets ever committed; the release binary is 7.18 MB on Linux against the 8 MB soft gate, up 0.23 MB across the round-4 stacks with open_max_core at 1.2 MiB of a 4.0 MiB .text and no unexpected crate in the breakdown; the frozen prompt measures 5,324 of its 5,360-char cap, 1,218 o200k tokens). Four small things did not belong, and one of them was silently costing every session in this repo.

  • AGENTS.example.md overflowed its own cap. agents_md() injects at most 2,000 bytes (MAX_AGENTS_MD_BYTES); the shipped template had grown to 2,854. A verbatim copy was cut mid-sentence at inspect before edit; m followed by the truncation note, so every rule under Development (verify commands, "prefer skill/tool/hook/permission file first, always-on costs tokens", "never invent paths", branch and commit rules, and the closing "Token tax?" question) never reached the model. Confirmed on the wire against a scripted endpoint. Each bullet added to "What ships" pushed the rules at the bottom off the end, and most of those bullets duplicate what the frozen prompt already says on every request (extension paths, --check, --spec, PLAN.md, providers).
  • Three #[allow(dead_code)] items in transcript.rs that were dead in fact: BlockKind::Thinking is never constructed (thinking renders as live-tail meta behind ctrl+t, not as a transcript block), and is_following() and scrollbar() have no callers.
  • doctor.rs pushed each tool name into external_names and then rebuilt the vector wholesale from tools_found (fix(core): --check counts warned tools as live names for rules and filters #165), with an #[allow(unused_assignments)] hiding the dead push.
  • crates/tui/Cargo.toml carried feature notes for syntect (default-syntaxes, default-themes, regex-fancy), a crate that is in neither Cargo.lock nor the source.

Summary

  • AGENTS.example.md: 1,930 bytes. Keeps the thesis, the "Not in core / Use instead" table, "Not shipped", the repo map, and every Development rule; the "What ships" list collapses to one paragraph naming what the frozen prompt does not (global ~/.openmax/ mirrors, --approve for hooks and allow rules, --trust-project).
  • prompt.rs: agents_example_fits_the_injection_cap measures the file the way agents_md() does and names the fix ("trim it rather than raising the cap"). It fails on the old file (2,854 bytes) and passes on the new one.
  • transcript.rs, doctor.rs, crates/tui/Cargo.toml: the removals above. Clippy adjudicated each: zero warnings with the allows gone.
  • Deliberately untouched: SandboxPolicy.ro_root (a documented intent field, feat(core): SandboxPolicy in the process spawn path #204), the ignored perf-measurement tests, and the two "use instead" skills.

Test Plan

  • Guard red/green: with main's AGENTS.example.md restored the new test fails with AGENTS.example.md is 2854 bytes; agents_md() injects at most 2000; with the trimmed file it passes.
  • cargo test --workspace: 810 passed, 0 failed, 8 ignored. cargo clippy --workspace --all-targets: zero warnings.
  • Release binary is byte-identical to main (7,042,656 bytes on macOS): the linker was already discarding the dead code, so this is source hygiene, not size.
  • Local AGENTS.md copies of the old template are also over the cap; this checkout's was refreshed from the trimmed text (1,953 bytes) and now injects whole.

Greptile Summary

The prompt-template cap guard now fails when a present template cannot be read, while the focused workspace check confirms the tracked template fits the injection limit. The previous broad read-error behavior is no longer present: placing a directory at the expected template path caused the test to exit with an Is a directory error and panic at crates/core/src/prompt.rs:679 instead of returning successfully.

Confidence Score: 5/5

No blocking failure remains.

The non-missing filesystem error path fails the guard as intended, and the focused cap test passes for the tracked template.

T-Rex T-Rex Logs

What T-Rex did

  • Built and extracted a package-equivalent core crate and ran the focused prompt-cap guard without the workspace template; it printed the missing-template skip and passed.
  • Reran the guard with a directory at the expected template path; it reported Is a directory (os error 21) and exited with code 101 at src/prompt.rs:679:23.
  • Ran cargo test -p open-max-core agents_example_fits_the_injection_cap in the current workspace; the focused cap guard passed.
  • Prepared and attached the authored harness and its exact invoked commands to support validation.
  • Provided a cross-proof validation summary indicating no regression observed and that the focused workspace run passed with the 2,000-byte injection cap; supporting artifacts are attached.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (3): Last reviewed commit: "test: only an absent AGENTS.example.md s..." | Re-trigger Greptile

…le.md over its own cap

- transcript.rs: remove BlockKind::Thinking (never constructed; thinking
  renders as live-tail meta, not a block), is_following() and scrollbar()
  (never called), and the allow(dead_code) attributes that hid all three.
- doctor.rs: external_names was pushed per tool and then rebuilt wholesale
  from tools_found (#165); drop the dead push and the allow(unused_assignments)
  that silenced it, and declare the vector where it is computed.
- crates/tui/Cargo.toml: remove the syntect feature notes; syntect is not a
  dependency (not in Cargo.lock, not in source), so the comment described
  choices about a crate the binary does not carry.
- AGENTS.example.md: 2,854 bytes against a 2,000-byte injection cap
  (prompt.rs MAX_AGENTS_MD_BYTES), so a verbatim copy lost every rule under
  Development to the truncation note, mid-sentence, on every request. Trim to
  1,930 bytes by dropping the surface list the frozen prompt already carries
  on every request; a new test measures the file the way agents_md() does and
  fails on the old size.
Comment thread crates/core/src/prompt.rs Outdated
…rkspace

Review finding (P2): a packaged open-max-core crate carries no copy of the
workspace-root template, so the guard hit NotFound there. It now says what it
could not measure and returns; in the workspace (development and CI) the file
is present and the guard still fails on the old 2,854-byte template.
Comment thread crates/core/src/prompt.rs Outdated
Review finding (P1): the skip swallowed every read error, so a template that
exists but cannot be read passed the guard unmeasured. Only NotFound skips
now; any other read error fails the test with the path and the error.
@Max17190
Max17190 merged commit 2a53870 into main Aug 18, 2026
4 checks passed
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.

1 participant