fix(terminal): use context.WithoutCancel for detached commands#195
Open
manusjs wants to merge 1 commit intovxcontrol:masterfrom
Open
fix(terminal): use context.WithoutCancel for detached commands#195manusjs wants to merge 1 commit intovxcontrol:masterfrom
manusjs wants to merge 1 commit intovxcontrol:masterfrom
Conversation
…vent parent cancellation When detach=true, the goroutine that waits for exec results now uses context.WithoutCancel(ctx) so it is no longer killed when the parent context is canceled (~2.5 min). Also adds a 10-minute default agent execution timeout in performAgentChain so agents have a sensible deadline instead of inheriting an arbitrary parent timeout. Fixes vxcontrol#176 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 tasks
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.
What
Detached terminal commands (
detach=true) now run with an independent context so they are not killed when the parent context is canceled. Also adds a sensible default agent execution timeout to specialist performers.Fixes #176
Root Cause
In
terminal.go,ExecCommandwithdetach=truepassed the parent context to the goroutine'sgetExecResultcall. When the parent context was canceled (~2.5 min via Cloudflare tunnel / upstream proxy), the "detached" background command was killed too — makingdetach=trueeffectively a no-op.Changes
terminal.go: Whendetach=true, wraps withcontext.WithoutCancel(ctx)(Go 1.21+) so the goroutine's context is never canceled by the parent.performers.go: Adds a configurable default agent execution timeout (10 min) toperformPentesterand other specialist performers viacontext.WithTimeout, giving each agent its own deadline.terminal_detach_test.go(new): Two tests — verifies goroutine context survives parent cancellation; verifies timeout still fires correctly.