Skip to content

Remove autoRestart feature across all SDKs#803

Merged
SteveSandersonMS merged 8 commits intomainfrom
stevesa/remove-autorestart
Mar 12, 2026
Merged

Remove autoRestart feature across all SDKs#803
SteveSandersonMS merged 8 commits intomainfrom
stevesa/remove-autorestart

Conversation

@SteveSandersonMS
Copy link
Contributor

@SteveSandersonMS SteveSandersonMS commented Mar 12, 2026

The autoRestart option never worked correctly. This removes the partial implementation and marks the public APIs as obsolete. We'll remove the public APIs entirely in a week or so.

Additionally I noticed that we were not tracking disconnected state across all the SDKs consistently. So this PR also now makes sure the state updates to "disconnected" consistently if the child process dies or the TCP connection is unexpectedly closed.

The autoRestart option never worked correctly. This removes it from:
- Node.js: types, client options, reconnect logic
- Python: types, client options
- Go: types, client options, struct field
- .NET: types, clone copy, tests
- Docs: setup, troubleshooting, READMEs
- Agent config: docs-maintenance validation lists

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SteveSandersonMS SteveSandersonMS requested a review from a team as a code owner March 12, 2026 15:09
Copilot AI review requested due to automatic review settings March 12, 2026 15:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the non-functional autoRestart / auto_restart / AutoRestart option across the Node.js, Python, Go, and .NET SDKs, and cleans up all related documentation and docs-maintenance validation to reflect the simplified client lifecycle behavior.

Changes:

  • Removed the autoRestart option from all SDK option types/APIs and their initialization/default handling.
  • Removed Node.js reconnect-on-exit/on-close logic and the private reconnect() helper tied to autoRestart.
  • Updated SDK READMEs and troubleshooting/setup docs plus docs-maintenance option lists to no longer mention auto-restart.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
python/copilot/types.py Removes auto_restart from CopilotClientOptions TypedDict.
python/copilot/client.py Removes auto_restart from normalized options initialization.
python/README.md Removes auto_restart from examples and option documentation.
nodejs/src/types.ts Removes autoRestart from CopilotClientOptions interface docs/type.
nodejs/src/client.ts Removes autoRestart default, reconnect-on-exit/on-close behavior, and reconnect() implementation.
nodejs/README.md Removes autoRestart from documented constructor options.
go/types.go Removes AutoRestart from ClientOptions and updates related helper comment.
go/client.go Removes autoRestart resolved option field and option plumbing.
go/README.md Removes AutoRestart from option docs and helper function description.
dotnet/test/CloneTests.cs Removes AutoRestart from clone test setup and assertions.
dotnet/src/Types.cs Removes AutoRestart property and clone-copy behavior.
dotnet/README.md Removes AutoRestart from documented options.
docs/troubleshooting/debugging.md Removes auto-restart troubleshooting step.
docs/setup/local-cli.md Removes autoRestart from local CLI setup snippet.
.github/agents/docs-maintenance.agent.md Removes auto-restart mentions from “must match”/core-features lists.
Comments suppressed due to low confidence (1)

docs/troubleshooting/debugging.md:305

  • The numbered list under the "Connection refused" solution now skips from step 1 to step 3 after removing the auto-restart step. Renumber the remaining items so the sequence is continuous.
1. Check if the CLI runs correctly standalone:
   ```bash
   copilot --server --stdio
  1. Check for port conflicts if using TCP mode:
    const client = new CopilotClient({
      useStdio: false,
      port: 0,  // Use random available port
    });
</details>

@github-actions
Copy link
Contributor

✅ Cross-SDK Consistency Review: APPROVED

This PR demonstrates exemplary cross-language consistency in removing the autoRestart feature. All four SDK implementations have been updated uniformly:

Changes Verified Across All SDKs:

Node.js/TypeScript (nodejs/)

  • ✅ Removed autoRestart from CopilotClientOptions interface
  • ✅ Removed default value assignment in client constructor
  • ✅ Removed reconnect logic in onClose() and onError() handlers
  • ✅ Removed entire reconnect() private method
  • ✅ Updated README to remove documentation

Python (python/)

  • ✅ Removed auto_restart from CopilotClientOptions TypedDict
  • ✅ Removed from client options initialization
  • ✅ Updated README to remove documentation

Go (go/)

  • ✅ Removed AutoRestart field from ClientOptions struct
  • ✅ Removed autoRestart field from Client struct
  • ✅ Removed default initialization and option handling
  • ✅ Updated Bool() helper function documentation
  • ✅ Updated README to remove documentation

.NET (dotnet/)

  • ✅ Removed AutoRestart property from CopilotClientOptions
  • ✅ Removed from copy constructor
  • ✅ Updated clone tests to remove assertions
  • ✅ Updated README to remove documentation

Documentation Updates:

  • ✅ Removed from setup guide (docs/setup/local-cli.md)
  • ✅ Removed from troubleshooting guide (docs/troubleshooting/debugging.md)
  • ✅ Updated docs-maintenance agent validation lists for all four SDKs

Consistency Verification:

I verified that no references to autoRestart/auto_restart/AutoRestart remain in the codebase, confirming complete removal across all SDKs.

API Naming Conventions:

The removal follows proper language-specific conventions:

  • TypeScript: autoRestart (camelCase) ✅
  • Python: auto_restart (snake_case) ✅
  • Go: AutoRestart (PascalCase for exported) ✅
  • .NET: AutoRestart (PascalCase) ✅

Verdict: This PR maintains perfect feature parity across all SDK implementations. No additional changes needed. 🎉

Generated by SDK Consistency Review Agent for issue #803 ·

@SteveSandersonMS SteveSandersonMS self-assigned this Mar 12, 2026
SteveSandersonMS and others added 3 commits March 12, 2026 20:19
Instead of leaving onClose/onError as no-ops (which would leave the
client in a stale 'connected' state), transition to 'disconnected'
so callers fail fast or can re-start cleanly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
All SDKs now properly transition their connection state to 'disconnected'
when the child process exits unexpectedly or the TCP connection drops:

- Node.js: onClose/onError handlers in attachConnectionHandlers()
- Go: onClose callback fired from readLoop() on unexpected exit
- Python: on_close callback fired from _read_loop() on unexpected exit
- .NET: rpc.Completion continuation sets _disconnected flag

Includes unit tests for all four SDKs verifying the state transition.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

✅ Cross-SDK Consistency Review: PASSED

This PR successfully removes the autoRestart feature consistently across all four SDK implementations (Node.js, Python, Go, and .NET).

Changes Verified:

All SDKs removed:

  • autoRestart/AutoRestart/auto_restart from client options (respecting language conventions)
  • Default value initialization
  • Automatic reconnection logic

All SDKs added:

  • Proper state transition to disconnected when the underlying connection/process exits unexpectedly
  • Appropriate callback mechanisms (onClose, on_close, SetOnClose, _disconnected flag)

Documentation:

  • All 4 SDK READMEs updated
  • Setup and troubleshooting guides updated
  • Agent validation lists updated

API Naming Consistency:

The removal follows proper language conventions:

  • TypeScript: autoRestart (camelCase)
  • Python: auto_restart (snake_case)
  • Go: AutoRestart (PascalCase for exported field)
  • .NET: AutoRestart (PascalCase for property)

No consistency issues found. The feature has been cleanly removed from all SDKs with equivalent behavior changes.

Generated by SDK Consistency Review Agent for issue #803 ·

SteveSandersonMS and others added 2 commits March 12, 2026 21:52
Mark the option as obsolete/deprecated in Go, .NET, and TypeScript so
existing consumers continue to compile without changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

✅ Cross-SDK Consistency Review

This PR demonstrates excellent cross-SDK consistency. The autoRestart feature is being removed uniformly across all four SDK implementations:

Summary by SDK

SDK Deprecation State Management Tests Docs
Node.js @deprecated in TSDoc ✅ Sets disconnected on close/error ✅ New test added ✅ Updated
Python ✅ Removed from TypedDict on_close callback ✅ New tests added ✅ Updated
Go Deprecated: comment SetOnClose callback ✅ New tests added ✅ Updated
.NET [Obsolete] attribute _disconnected flag + continuation ✅ Test assertions removed ✅ Updated

Consistent Changes Across All SDKs

  1. Option removal/deprecation: Each SDK appropriately marks or removes the autoRestart/auto_restart/AutoRestart option using language-appropriate mechanisms
  2. State transition: All SDKs now properly transition to "disconnected" state when the underlying connection drops
  3. No automatic reconnection: Reconnect logic removed from all implementations
  4. Documentation: READMEs, setup guides, and troubleshooting docs updated consistently
  5. Testing: Each SDK adds appropriate tests for the new disconnection behavior

Language-Specific Appropriateness

The implementation differences are justified by language conventions:

  • .NET uses [Obsolete] attribute (idiomatic C#) and keeps the property for backward compatibility
  • Node.js uses @deprecated JSDoc tag
  • Go uses Deprecated: comment convention and keeps the field for compatibility
  • Python completely removes from TypedDict since it's runtime duck-typing

No consistency issues found. This PR maintains excellent feature parity while respecting language-specific idioms. 🎉

Generated by SDK Consistency Review Agent for issue #803 ·

The onClose callback acquires startStopMux, but Stop/ForceStop already
hold that lock while waiting for readLoop to finish via wg.Wait().
Running the state update in a goroutine allows readLoop to complete,
breaking the circular wait.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

✅ SDK Consistency Review — PASSED

I've reviewed this PR for cross-SDK consistency. The removal of the autoRestart feature is consistently implemented across all four SDKs (Node.js, Python, Go, and .NET).

What Was Checked

✅ Option Deprecation (All Consistent)

  • Node.js: @deprecated JSDoc comment on autoRestart option
  • Python: Field completely removed from CopilotClientOptions
  • Go: // Deprecated: comment on AutoRestart field
  • .NET: [Obsolete] attribute on AutoRestart property

All approaches are idiomatic for their respective languages.

✅ Behavior Removal (All Removed)

  • All four SDKs have completely removed reconnection logic
  • No SDK attempts to use the autoRestart setting
  • Node.js hard-codes it to false; other SDKs ignore the field entirely

✅ State Management (All Implemented)

All SDKs properly transition to "disconnected" state when the connection drops:

  • Node.js: this.state = "disconnected" on connection close/error
  • Python: self._state = "disconnected" via on_close callback
  • Go: c.state = StateDisconnected via SetOnClose callback
  • .NET: Returns ConnectionState.Disconnected via _disconnected flag

✅ Testing Coverage (Good)

  • Node.js: Added test verifying state transitions to "disconnected" on process kill
  • Python: Added comprehensive TestOnClose test suite
  • Go: Added jsonrpc2_test.go with OnClose callback tests
  • .NET: Updated CloneTests to remove AutoRestart assertions

.NET doesn't add a new disconnection test in this PR, but that's acceptable since the existing test suite likely covers connection state transitions, and this PR is focused on removing a feature rather than adding new behavior.

Summary

No consistency issues found. This PR maintains excellent parity across all SDK implementations. The feature removal is clean, properly documented, and the state management changes are uniformly applied. Great work! 🎉

Generated by SDK Consistency Review Agent for issue #803 ·

@SteveSandersonMS SteveSandersonMS merged commit 5a41532 into main Mar 12, 2026
35 checks passed
@SteveSandersonMS SteveSandersonMS deleted the stevesa/remove-autorestart branch March 12, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants