Conversation
added 2 commits
July 27, 2026 11:42
…ckup/vendor dirs SubdirectoryHintTracker re-injected identical context files whenever the same AGENTS.md was reachable through more than one path. Symlinked shared workspaces, hardlinks, and timestamped backup copies all alias a single file, so a normal session could ship the same 8KB of instructions two or three times. Nothing deduped it and nothing excluded directories that only ever hold copies. Two changes: * Track a sha256 of every injected hint body. Repeat content is skipped, and the working directory's own context file is seeded at construction so the copy prompt_builder already loaded at startup is never sent again. * Skip directories that hold copies rather than authoritative context (backups, node_modules, venv, site-packages, .git, .Trash, vendor, caches). Screening is relative to working_dir, so a project that legitimately lives under vendor/ keeps discovering its own subdirectory hints. Measured on a real session that touched a symlinked shared workspace: 3 injections / ~24,000 chars before, 1 injection / 8,112 chars after. 14 new tests cover symlink aliasing, byte-identical copies, working-dir seeding, distinct content still being injected, each excluded directory name, excluded ancestors, and the working-dir-inside-excluded-name case.
…ng it silently Both context-loading paths shed content without telling anyone. The in-band '[...truncated]' marker is addressed to the model, not the author, so a repo whose AGENTS.md outgrows CONTEXT_FILE_MAX_CHARS keeps booting cleanly while the middle of the file stops reaching the model. This repo's own AGENTS.md sat at 52,488 chars and lost 66% of itself on every session — the Plugins, Skills, Delegation, Policies, and Known Pitfalls sections were never loaded, and nothing anywhere said so. _truncate_content() and the subdirectory-hint loader now log a WARNING naming the file, its size, the limit, how much was dropped, and what to do about it. Files under the limit are returned untouched and stay silent, so the warning only fires when content is genuinely lost. 4 tests: each path warns when oversized and stays quiet when within budget.
Collaborator
|
Thanks for identifying the silent subdirectory-context truncation path. The remaining subdirectory warning is still useful on current main. Problems
Suggested changes
Automated hermes-sweeper review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Both context-loading paths shed content without telling anyone who can act on it.
_truncate_content()inserts an in-band marker:That string is addressed to the model. The person who wrote the file gets nothing — no log line, no startup notice, no non-zero exit. A repo whose
AGENTS.mdoutgrowsCONTEXT_FILE_MAX_CHARSkeeps booting cleanly while the middle of the file stops reaching the model.This repo's own
AGENTS.mdis the case in point. At 52,488 chars against a 20,000 cap with a 70/20 head-tail split, 66% was dropped on every single session. The discarded middle was not filler — Plugins, Skills, Toolsets, Delegation, Curator, Cron, Kanban, Important Policies, Profiles, and Known Pitfalls all sat inside it. The prompt-caching rules and the entire pitfalls list were never actually loaded, and nothing anywhere said so.The subdirectory-hint loader has the same shape at its own 8,000-char limit.
Change
Both truncation points log a WARNING naming the file, its size, the limit, how much was dropped, and what to do about it:
Files under the limit are returned untouched and stay silent, so a warning firing means content was genuinely lost — no ambient noise to tune out.
Tests
4 added. Each path: warns when oversized, silent when within budget.
159 passed, 1 skipped.