Repository navigation
fix(debugger): let REA exit when a debugger could not be stopped #8652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1f317ff
fix(debugger): let REA exit when a debugger could not be stopped
kaoru0822-kitauji 091733a
fix(debugger): name retained debuggers when an MCP server shuts down
kaoru0822-kitauji 236d226
Merge remote-tracking branch 'origin/main' into fix/8642b-cli-debugge…
kaoru0822-kitauji eeb3394
Merge origin/main into fix/8642b-cli-debugger-one-shot-exit
kaoru0822-kitauji 2458609
test(debugger): compare retained-debugger guidance with its formatter
kaoru0822-kitauji File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /** Closing all sessions could not confirm that these debuggers stopped. */ | ||
| export class OwnedDebuggerCleanupError extends AggregateError { | ||
| /** Process IDs when cleanup gave up. Observations, not lasting proof of identity. */ | ||
| readonly retainedProcessIds: readonly number[]; | ||
|
|
||
| constructor( | ||
| failures: readonly Error[], | ||
| message: string, | ||
| retainedProcessIds: readonly number[], | ||
| ) { | ||
| super(failures, message); | ||
| this.retainedProcessIds = retainedProcessIds; | ||
| } | ||
| } | ||
|
|
||
| /** Retained debugger process IDs anywhere in a composed cleanup failure. */ | ||
| export const retainedDebuggerProcessIds = ( | ||
| cause: unknown, | ||
| ): readonly number[] => { | ||
| const found = new Set<number>(); | ||
| const visited = new WeakSet<object>(); | ||
| const visit = (node: unknown): void => { | ||
| if (typeof node !== "object" || node === null || visited.has(node)) return; | ||
| visited.add(node); | ||
| if (node instanceof OwnedDebuggerCleanupError) | ||
| for (const pid of node.retainedProcessIds) found.add(pid); | ||
| if (node instanceof AggregateError) | ||
| for (const error of node.errors) visit(error); | ||
| if (node instanceof Error) visit(node.cause); | ||
| }; | ||
| visit(cause); | ||
| return [...found]; | ||
| }; | ||
|
|
||
| /** Log or diagnostic fields naming those processes; empty when none are known. */ | ||
| export const retainedDebuggerDiagnostics = ( | ||
| cause: unknown, | ||
| ): { readonly retained_debugger_pids?: number[] } => { | ||
| const pids = retainedDebuggerProcessIds(cause); | ||
| return pids.length === 0 ? {} : { retained_debugger_pids: [...pids] }; | ||
| }; | ||
|
|
||
| /** What a caller must do once REA ends with these debuggers unconfirmed. */ | ||
| export const retainedDebuggerRemediation = (pids: readonly number[]): string => | ||
| `REA exits without confirming that the debugger stopped, and no later REA command can retry this cleanup. Check process ${pids.join(", ")} and its target, and stop them if they are still running.`; |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.