feat(cli): allow AGENTMEMORY_IMPORT_TIMEOUT_MS override for import-jsonl#607
feat(cli): allow AGENTMEMORY_IMPORT_TIMEOUT_MS override for import-jsonl#607sakaoka082 wants to merge 1 commit into
Conversation
Large ~/.claude/projects trees (>200 files / ~250MB) routinely take more than the previously-hardcoded 120s client-side AbortSignal.timeout, which surfaces a misleading 'import timed out after 2 minutes' to the user even though the server keeps ingesting in the background. Allow operators to extend the client-side timeout via AGENTMEMORY_IMPORT_TIMEOUT_MS without patching the binary. Default stays 120000 for backward compatibility. Non-positive / non-integer values fall back to the default with a visible warning. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@sakaoka082 is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe ChangesImport Timeout Configuration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/cli.ts (1)
2443-2443:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate the error message to reflect the actual timeout.
The error message is hardcoded to "2 minutes" but the timeout is now configurable. When users override
AGENTMEMORY_IMPORT_TIMEOUT_MS, this message will mislead them during troubleshooting.📝 Proposed fix
if (err instanceof Error && err.name === "TimeoutError") { - p.log.error("import timed out after 2 minutes"); + p.log.error(`import timed out after ${importTimeoutMs / 1000}s`); } else {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/cli.ts` at line 2443, The error message currently hardcodes "2 minutes" in the p.log.error call; update it to report the actual configured timeout by reading the AGENTMEMORY_IMPORT_TIMEOUT_MS value (or the variable that holds it) and formatting it into a human-readable duration (e.g., seconds or minutes) before logging — replace the static string in p.log.error with a message that includes the computed timeout string so overrides of AGENTMEMORY_IMPORT_TIMEOUT_MS are reflected.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/cli.ts`:
- Line 2443: The error message currently hardcodes "2 minutes" in the
p.log.error call; update it to report the actual configured timeout by reading
the AGENTMEMORY_IMPORT_TIMEOUT_MS value (or the variable that holds it) and
formatting it into a human-readable duration (e.g., seconds or minutes) before
logging — replace the static string in p.log.error with a message that includes
the computed timeout string so overrides of AGENTMEMORY_IMPORT_TIMEOUT_MS are
reflected.
Summary
Makes the
import-jsonlCLI command timeout configurable via theAGENTMEMORY_IMPORT_TIMEOUT_MSenvironment variable, replacing the hardcoded 120s ceiling.Why
The current 120s timeout in
import-jsonlis hardcoded and fails for large jsonl imports (real-world scenario: 100 files / 25→59 sessions in a single batch hits the wall at 120s and aborts mid-flight).Letting operators set their own ceiling — without touching source — enables larger batch imports on slower disks/networks while keeping the safe default.
Test plan
AGENTMEMORY_IMPORT_TIMEOUT_MSis unset, the original 120000ms ceiling appliesAGENTMEMORY_IMPORT_TIMEOUT_MS=300000raises the ceiling to 5 minutes🤖 Generated with Claude Code
Summary by CodeRabbit
import-jsonloperation timeout is now configurable via theAGENTMEMORY_IMPORT_TIMEOUT_MSenvironment variable, with a default of 120 seconds if not specified or invalid.