fix: skip stale check for ad-hoc instances#14
Closed
bloodcarter wants to merge 1 commit intoaannoo:mainfrom
Closed
fix: skip stale check for ad-hoc instances#14bloodcarter wants to merge 1 commit intoaannoo:mainfrom
bloodcarter wants to merge 1 commit intoaannoo:mainfrom
Conversation
Ad-hoc instances created via `hcom start --as <name>` have no PTY process or TCP endpoint sending heartbeats. The 10-second HEARTBEAT_THRESHOLD_NO_TCP causes them to be marked stale:listening and cleaned up almost immediately, breaking script-controlled workflows that use ad-hoc identities for event polling. Fix: skip the heartbeat-based stale check entirely for tool="adhoc" instances, same as remote instances. They stay alive until explicitly stopped via `hcom stop`.
Contributor
Author
|
Closing — the root cause is deeper than the stale check. Ad-hoc identities created from within Claude Code tool calls are killed by the hooks lifecycle, not the stale checker. The instances.rs fix only helps for pure adhoc (outside Claude), which is a rarer case. Will investigate the hooks lifecycle separately. |
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
hcom start --as <name>get falsely marked as stale and cleaned up after ~10 secondsHEARTBEAT_THRESHOLD_NO_TCP(10s) applies to ad-hoc instances which have no heartbeat mechanism (no PTY thread, no TCP endpoint)tool="adhoc"instances, same as remote instancesThe problem
When a script creates an ad-hoc identity for event polling:
hcom start --as controller # ... poll events with hcom events --from agent --last 1 ...The identity is killed by stale cleanup within seconds because:
tcp_mode=0and no notify endpoint →has_tcp=falseHEARTBEAT_THRESHOLD_NO_TCP(10 seconds)inactive:stale:listeningThe fix
3-line change in
get_instance_status(): checkdata.tool == "adhoc"and skip the heartbeat timeout, same asis_remoteinstances.Test plan
hcom start --as test && sleep 200 && hcom list test— survives 200s (was dying at 10s)🤖 Generated with Claude Code