Skip to content

fix(status): give the right advice for dead letters refused by the session cap - #1504

Merged
rohitg00 merged 1 commit into
rohitg00:mainfrom
Rex57:fix/1485-cap-dead-letter-advice
Oct 10, 2026
Merged

rohitg00 merged 1 commit into
rohitg00:mainfrom
Rex57:fix/1485-cap-dead-letter-advice

Conversation

@Rex57

@Rex57 Rex57 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #1485.

When a session reaches MAX_OBS_PER_SESSION, mem::observe returns Session observation limit reached (N). Capture treats a returned error as permanent and dead-letters the record on its first attempt. The capture-dead-letters status problem then:

  • said the observations "could not be stored after 5 attempts" (the configured retry budget, not what happened), and
  • told the operator to retry, which the cap refuses again until the setting changes.

Now:

  • The message reads "N captured observations could not be stored and are parked as dead letters: ", without an attempt count. Status only has the inbox summary, so it cannot know per-record attempts.
  • When the last error is the session cap, the fix starts with: "The session reached its MAX_OBS_PER_SESSION cap, so a retry is refused again until the cap is raised. Raise MAX_OBS_PER_SESSION in ~/.agentmemory/.env (0 = no cap) and restart agentmemory." followed by the existing list and retry commands.
  • Other dead letters keep the existing fix text.

PR #1174 proposes evicting at the cap instead of refusing writes; this change only fixes what status says while the cap refuses writes.

Checks

  • test/capture-review-fixes.test.ts: cap error → exact message and cap-specific fix with both authenticated commands; other errors → no attempt claim and no cap advice
  • Existing capture status tests (capture-durable, recovery commands with the secret) unchanged and passing
  • npm run build, npm run skills:gen, npm run docs:sync (no changes), npm run skills:check
  • npm test: 2596 passed, 4 skipped

Summary by CodeRabbit

  • Bug Fixes
    • Corrected dead-letter status messages to explain that observations could not be stored, rather than incorrectly attributing the issue to exhausted retries.
    • Added specific guidance for session observation limits, including how to resolve the limit and retry observations.

…ssion cap

Once a session reaches MAX_OBS_PER_SESSION, mem::observe returns an error,
and capture dead-letters that record on its first attempt. Status then said
the observations "could not be stored after 5 attempts" and told the operator
to retry, which the cap refuses again. The message no longer claims a number
of attempts, and when the last error is the session cap, the fix names
MAX_OBS_PER_SESSION (0 = no cap) and the restart before the retry command.

Signed-off-by: Rex57 <203883624+Rex57@users.noreply.github.com>
@vercel

vercel Bot commented Oct 8, 2026

Copy link
Copy Markdown

@Rex57 is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 23884dd0-7730-4c39-bcfa-920b0c91d281
📥 Commits

Reviewing files that changed from the base of the PR and between 007a1a7 and 29e15a6.

📒 Files selected for processing (2)
  • src/functions/status.ts
  • test/capture-review-fixes.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Dead-letter status messages no longer claim that observations failed after the configured attempt count. The fix guidance now names MAX_OBS_PER_SESSION when the last error indicates the session cap, and tests cover cap and non-cap errors.

Changes

Dead-letter status guidance

Layer / File(s) Summary
Dead-letter diagnostics and tests
src/functions/status.ts, test/capture-review-fixes.test.ts
The status message says observations could not be stored and are parked as dead letters. If the last error starts with Session observation limit reached, the fix explains that retries remain refused until MAX_OBS_PER_SESSION is raised and the server is restarted. Other errors receive list-and-retry instructions. Tests check both cases, including the 0 = no cap guidance.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: rohitg00

Merge Risk: ⚪ Minimal · up to 29e15

Operators receive cap-specific instructions to raise or disable the limit, restart, and retry; other errors retain generic guidance. The retry path supports that recovery, so the change is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: correcting status advice for dead letters refused by the session observation cap.
Linked Issues check ✅ Passed Issue #1485 requires status to avoid an unsupported attempt count and to give cap-specific advice. src/functions/status.ts removes the attempt-count claim, detects `Session observation limit reached…
Out of Scope Changes check ✅ Passed The diff changes only the capture-dead-letters status message and fix text and adds focused tests for those changes. These changes directly implement Issue #1485. No unrelated implementation or test…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rohitg00
rohitg00 merged commit aa840d7 into rohitg00:main Oct 10, 2026
11 of 12 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.

Status advises retrying dead letters that the session observation cap will reject again

2 participants