Repository navigation
Conversation
…r a memory stop A restarted connector now hands off requests made up to four hours before it started, instead of one minute, so a mention made while it was down is still answered. The skill tells the session to start the connector, and the request watcher, again at once when Claude Code stops them for low memory.
…rent watcher A request an earlier run admitted keeps the one-minute grace, so a restart never hands off a decision made under trust that may have changed while the connector was down. The run's start is taken before intake and admission begin, so nothing this run admits is stamped before it. A memory-stop notice for a watcher whose connector was also stopped no longer restarts a watcher on the old output file.
Contributor
There was a problem hiding this comment.
🟢 Approved
Source review identified no blocking issues in the recovery logic or guidance; tests were not executed here.
No open issues 🎉
What changed in this PR
Improves connector recovery after downtime, building on #902’s watcher and persistent deduplication.
Changes:
- Allows four-hour catch-up for requests admitted by the current run, preserving the one-minute grace for earlier admissions.
- Records startup time before intake and admission begin.
- Updates memory-stop recovery guidance and adds boundary and skill-consistency tests.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
| File | Description |
|---|---|
| skills/basecamp-connect/SKILL.md | Documents automatic recovery and catch-up limits. |
| internal/connector/skill_layout_test.go | Checks recovery guidance and catch-up wording. |
| internal/connector/handoff.go | Selects catch-up cutoff by admission time. |
| internal/connector/handoff_test.go | Tests current-run and earlier-run cutoff boundaries. |
| internal/commands/connect_run.go | Captures startup time before admission begins. |
Review effort: Balanced
Collaborator
Author
|
🤖 Review status on 2f62103 Which commit each reviewer read:
Pi, first pass (35a423e)
Pi, second pass (5030403)
Open threads: none. This needs #902 merged first, and then a human merge. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When Claude Code stops
basecamp connectbecause memory is low, the agent stops answering. Mentions made while it's down are also lost when it starts again. This PR makes two changes:Stacked on #902 (
connect-one-shot-watcher). The skill text changes #902's watcher steps, and #902's handled-ids file is what stops a request from being handled twice across restarts. Merge #902 first.Card: Claude Code kills the connector for low memory, and the agent stops answering. These are options 2 and 3 of the proposal on the card.
Why
Claude Code 2.1.303 stops an idle session's background Bash tasks under critical memory pressure. All of these have to hold:
Its notice says "stopped because the system is running low on memory … Do not start it again on your own". The session then waits for a person, and the agent stays deaf. Claude Code ends the task's process group and descendants, and it doesn't look at the task's own memory, so a small connector gets stopped too. A task started again within 30 minutes of such a stop isn't stopped again until someone types in the session.
On restart,
handOffclosed every admitted request made more thanHandoffGrace(one minute) before the run started asbefore_this_run. The feed resumes from its checkpoint, so intake does see the mentions made during the outage. Handoff then dropped them.Change
internal/connector/handoff.gohandoffCutoff. If this run wrote a record's admission decision (Decision.DecidedAtat or afterStarted), the record may have been made up tohandoffCatchUp(4 hours) before the run.HandoffGrace(one minute). An earlier run's decision was made under whatever trust held then. Replaying it hours later could hand off a request from someone who was removed from--allowwhile the connector was down. Requests made during an outage are admitted by the new run, under current trust.before_this_runlog line now carries the cutoff.internal/commands/connect_run.go: the run's start is taken before intake and admission start, not after. Otherwise something this run admits could be stamped beforeStartedand get the one-minute rule.skills/basecamp-connect/SKILL.mdTests
handoff_test.go:before_this_runat 4 hours and 1 second.skill_layout_test.go: the memory-stop steps exist, including the watcher rule. The skill states the catch-up in the same number of hours ashandoffCatchUp, so changing one without the other fails.startedearlier inrunConnect. It removes an ordering race between the handoff's start time and admission's first decision. I found no seam to test that without a real run.bin/ciis green locally (MISE_BATS_VERSION=1.13.0, as in Watch for connector requests with a one-shot background watcher, not Monitor #902).Trade-offs
HandoffOptions.Graceand changes the samehandOfflines. It keepsHandoffGraceas the earlier-run rule, which this PR leaves alone, so its e2e test's expectation still holds. A textual conflict is likely, and it's easy to resolve.connect releasehelp says a restart doesn't replay older requests. That stays true for an earlier run's records, but would read better if it mentioned the catch-up.Summary by cubic
A restarted Basecamp connector now answers requests made while it was down (up to 4 hours before the run), instead of dropping anything older than a minute. The skill also tells the agent to restart the connector at once after Claude Code stops it for low memory.
Written for commit 2f62103. Summary will update on new commits.