Skip to content

fix: filter subdirectories before inbox cap check in evictInboxOverflow (PILOT-183)#4

Closed
matthew-pilot wants to merge 1 commit into
mainfrom
openclaw/pilot-183-20260528-052000
Closed

fix: filter subdirectories before inbox cap check in evictInboxOverflow (PILOT-183)#4
matthew-pilot wants to merge 1 commit into
mainfrom
openclaw/pilot-183-20260528-052000

Conversation

@matthew-pilot
Copy link
Copy Markdown
Collaborator

Problem

evictInboxOverflow in service.go counted subdirectory entries in the initial len(entries) <= cap short-circuit. If a mailbox had exactly cap real files plus one subdirectory, the guard allowed execution to proceed — but after filtering IsDir() in the collection pass, len(files) == cap and the second check returned silently, evicting nothing. Subdirectories poisoned the eviction trigger, allowing the inbox to grow unbounded.

Fix

Filter only !e.IsDir() entries for the initial capacity guard at line 307, so subdirectories never inflate the file count.

Changes

  • service.go: +10 / -1 lines in evictInboxOverflow

Verification

go build ./...   ✅
go vet ./...     ✅
go test ./...    ✅ (all tests pass)

Jira

🔗 https://vulturelabs.atlassian.net/browse/PILOT-183

…ow (PILOT-183)

evictInboxOverflow counted subdirectory entries in the initial
len(entries) <= cap short-circuit at line 307. If a mailbox had
cap real files plus one subdir, the guard let us through — but
after filtering IsDir() in the collection pass, len(files) == cap
and the second check returned silently. Subdirs poisoned the
eviction trigger, causing mailbox to grow unbounded.

Fix: count only !e.IsDir() entries for the initial capacity guard,
so subdirectories never inflate the file count.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TeoSlayer
Copy link
Copy Markdown
Contributor

Superseded — main already filters subdirectories via 'if e.IsDir()' in evictInboxOverflow. The fix for PILOT-183 landed via the broader subdir-filter changes in PR #2/#3 merge sequence.

@TeoSlayer TeoSlayer closed this May 28, 2026
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.

2 participants