Block overlapping lcm_expand_query delegations per origin session#222
Merged
Conversation
Agent-Logs-Url: https://github.com/Martian-Engineering/lossless-claw/sessions/46499c08-a52b-4640-9235-d4505936b758 Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Martian-Engineering/lossless-claw/sessions/46499c08-a52b-4640-9235-d4505936b758 Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Martian-Engineering/lossless-claw/sessions/46499c08-a52b-4640-9235-d4505936b758 Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix deadlock issue caused by concurrent lcm_expand_query calls
Block overlapping Mar 31, 2026
lcm_expand_query delegations per origin session
Delay origin-session concurrency slot acquisition until lcm_expand_query has resolved scope and found summary IDs to delegate. This preserves the concurrency block for real delegated sub-agent work without blocking overlapping no-op or no-match requests that never touch the shared lane. Add a regression test covering concurrent query calls that return no matches so harmless probes remain unblocked. Regeneration-Prompt: | Address the PR review finding that the new lcm_expand_query concurrency slot was acquired too early. Preserve the intended deadlock prevention for real delegated sub-agent runs, but do not serialize requests that exit before any delegation happens, such as missing-scope or no-match query paths. Keep the existing concurrency-block behavior for actual delegated expansions and add a regression test proving concurrent no-match requests both complete normally without any gateway agent calls.
Merged
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.
Concurrent
lcm_expand_querycalls from the same origin session could both pass the existing recursion guard, spawn delegated sub-agents, and deadlock on the shared session lane. This change adds a per-origin-session in-flight gate so overlapping expansions fail fast instead of wedging the gateway pipeline.What changed
lcm_expand_query.errorCode: "EXPANSION_CONCURRENCY_BLOCKED"reason: "origin_session_in_flight"Guard behavior
Error surface
lcm_greporlcm_describewhen another expansion is already running.blockevent for these fast-fail cases.Release note