Summary
Several agent tool schemas accept unbounded z.string() inputs. An LLM producing very long strings could bloat memory.jsonl or exceed GitHub API limits (65,535 chars for comments).
Problem / Context
Affected fields:
writeMemory content — no .max(), could bloat memory store
reflectOnWork whatWorked/whatFailed/lessonsLearned — no limit
commentOnIssue body — GitHub silently truncates at 65K chars
createTechDebtIssue body — same GitHub limit
Proposed Solution
Add .max() constraints to zod schemas:
- Memory content:
.max(4000)
- Reflection fields:
.max(2000)
- GitHub comment/issue body:
.max(60000)
Files to Modify
| File |
Changes |
src/agent/tools/memory.ts |
Add .max() to content and reflection fields |
src/agent/tools/reporting.ts |
Add .max() to body fields |
Acceptance Criteria
Summary
Several agent tool schemas accept unbounded
z.string()inputs. An LLM producing very long strings could bloatmemory.jsonlor exceed GitHub API limits (65,535 chars for comments).Problem / Context
Affected fields:
writeMemorycontent — no.max(), could bloat memory storereflectOnWorkwhatWorked/whatFailed/lessonsLearned — no limitcommentOnIssuebody — GitHub silently truncates at 65K charscreateTechDebtIssuebody — same GitHub limitProposed Solution
Add
.max()constraints to zod schemas:.max(4000).max(2000).max(60000)Files to Modify
src/agent/tools/memory.ts.max()to content and reflection fieldssrc/agent/tools/reporting.ts.max()to body fieldsAcceptance Criteria