Skip to content

✨ agentsmd: 32 KiB default AGENTS.md cap with per-repo override and status - #18498

Merged
kubestellar-prow[bot] merged 3 commits into
v5from
feat/18495-agents-md-cap
Nov 16, 2026
Merged

kubestellar-prow[bot] merged 3 commits into
v5from
feat/18495-agents-md-cap

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Summary

Hosted spokes capped a managed repo's AGENTS.md at 8 KiB, so real files (one current example is 13 KB) silently lost whole sections. This raises and per-repo-ifies the cap.

  • Default 32 KiB (agentsmd.DefaultMaxInjectionBytes = 32 * 1024). A 13 KB AGENTS.md is now included in full with no warning.
  • Per-repo override repos.<repo>.agents_md_max_bytes (new top-level repos: map, keyed by bare name or owner/repo, case-insensitive) over project.agents_md_max_bytes.
  • Env default HIVE_AGENTS_MD_MAX_BYTES when no config key sets a cap.
  • Hard ceiling agentsmd.MaxInjectionBytesCeiling = 256 KiB, applied to every source; the 2048 floor is unchanged.
  • Truncation stays section-based and visible: the existing 🌱 tokens: AGENTS.md injection cap — whole-section drop with visible warning, never silent truncation (review A5) #12129 renderer drops whole sections and puts a warning line naming them in the prompt. The operator warning log is now emitted once per file content + cap (sha256 fingerprint per root) instead of on every kick.
  • Repo status API: no dashboard repo view shows AGENTS.md today, so each /api/status repos[] entry gains an agentsMd object (sourceBytes, capBytes, renderedBytes, truncated, wholeFile, omittedSections, omittedBytes, updatedAt) once a kick has read the file.
  • Docs: src/docs/agents-md.md, src/docs/operator-reference/README.md, src/docs/agent-knowledge-and-memory.md. Changelog fragment added. Settings parity allowlist entry for the new key.

Tests

  • crux/agentsmd: 13 KB file renders in full by default; env override, invalid env values, ceiling clamp; status registry round-trip and copy safety.
  • pkg/config: per-repo lookup (bare/qualified/case-folded/inherit) and YAML parsing.
  • pkg/scheduler: 13 KB in full end to end with recorded status; per-repo override applies to that repo only; warning logged once per content change.
  • pkg/dashboard: buildRepos carries the recorded status.

Fixes #18495

🤖 Generated with Claude Code

…status

Raise the default AGENTS.md injection cap from 8 KiB to 32 KiB so a
13 KB file reaches the kick in full. Add repos.<repo>.agents_md_max_bytes
as a per-repo override over project.agents_md_max_bytes, an env default
(HIVE_AGENTS_MD_MAX_BYTES) and a 256 KiB hard ceiling. Log the truncation
warning once per file content and cap instead of every kick, and expose
each repo's file size, effective cap and dropped sections in the
/api/status repos payload.

Fixes #18495

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 16, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • test (rest 2/4)

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#18505 ✨ Discover agents declared in a managed repo's .hive/agents/ behind owner approval same files src/internal/testutil/dashboard_import_allowlist.txt
src/pkg/dashboard/settings_parity_allowlist.txt
#18507 ✨ governor: release-feed watcher kicks agents when a tracked upstream dependency releases same files src/pkg/config/config.go
src/pkg/dashboard/settings_parity_allowlist.txt
src/pkg/scheduler/scheduler.go
src/pkg/scheduler/templates.go
#18499 ✨ prompt sources: owners can approve their own managed repos same files src/pkg/config/config.go
#18501 ✨ Durable one-PR-per-topic claims for long-lived agents same files src/pkg/scheduler/scheduler.go
src/pkg/scheduler/templates.go

@github-actions

Copy link
Copy Markdown
Contributor

Mutation testing

2 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/crux/agentsmd/agentsmd.go 355 ARITHMETIC_BASE
src/crux/agentsmd/agentsmd.go 359 ARITHMETIC_BASE

ℹ️ 2 mutant(s) on added lines were SKIPPED because gremlins v0.6.0 only honours the first lines added lines of each default-context hunk, so non-contiguous edits in one hunk are partly missed. This does not affect the verdict.

File Line Mutation
src/crux/agentsmd/agentsmd.go 500 CONDITIONALS_BOUNDARY
src/crux/agentsmd/agentsmd.go 500 CONDITIONALS_NEGATION

Verdict: uncovered (#17349).

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow
kubestellar-prow Bot merged commit 0cc7aab into v5 Nov 16, 2026
94 of 96 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/18495-agents-md-cap branch November 16, 2026 21:32
@clubanderson

Copy link
Copy Markdown
Member Author

cc @joerunde: this is part of the hive changes for the spyre-inference deps agent and sandboxed reviewer setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Raise and make per-repo the AGENTS.md size cap on hosted spokes

1 participant