Skip to content

fix: recover Claude sessions and unblock first GHE login - #64

Merged
wangcansunking merged 2 commits into
masterfrom
u/canwa/session-login-fixes
Oct 12, 2026
Merged

wangcansunking merged 2 commits into
masterfrom
u/canwa/session-login-fixes

Conversation

@wangcansunking

Copy link
Copy Markdown
Owner

Summary

  • Release the startup provider/hostname readline prompt before gh auth login inherits stdin, with exactly-once cleanup on success, cancellation and failure.
  • Stop a replayed tail of 12 connected successful numeric-only Edit replacements before another upstream call. Detection is stateless, tolerates automatic token reminders and does not block new user instructions, failed tools or ordinary different edits.
  • Preserve max_prompt_tokens separately from headline context windows for Claude setup and built-in assistant compaction; keep 1M model badges and existing model mappings.
  • Include prompt is too long in context-overflow guidance so Claude Code classifies Copilot's 400 as recoverable through compaction rather than an unknown API error.
  • Add a patch changeset and targeted regression coverage.

Evidence and verification

  • TypeScript build and git diff --check: passed.
  • 172/172 targeted tests across 16 files: passed, including real child-process stdin handoff and HTTP stream/non-stream loop rejection.
  • The stdin negative control with the previous prompt lifetime stalled at child input readiness and timed out; releasing readline passed.
  • Actual affected desktop Claude Code 2.1.284 and current 2.1.286, using a local provider fixture: both automatic compaction and reactive recovery from the exact Copilot context-window 400 produced compact_boundary and continued successfully. Restoring the old error wording reproduced exit 1 without recovery.
  • Original failed-session tail replayed locally: loop detected. No private transcript is included in this PR or sent upstream.
  • Actual desktop CLI against live GHE Copilot through isolated dev port 7991: 3-turn Read tool round-trip returned LIVE_SESSION_OK.
  • Added Docker HTTP matrix cases; syntax checked. Full E2E/Docker matrices were not run.

Limits and rollout

  • Windows console/ConPTY and a fresh-account browser OAuth authorization were not exercised; login verification uses real readline and a separate child inheriting stdin.
  • The affected desktop build caps a 1,050,000 compact override to 1,000,000; it does not ignore it. The override alone is not a demonstrated cause of the historical missing automatic compaction. The cross-request Edit loop and failure of reactive overflow recovery are reproduced.
  • The narrowly scoped guard detects connected numeric-only Edit loops, not arbitrary semantic tool repetition.
  • Production 7890/7891, installed package, global settings, credentials and original session histories were left unchanged. A confirmed polluted test line in the separate plan-harness worktree was backed up and repaired locally (8 targeted assertions passed); that unrelated repository change is not part of this PR.
  • Do not merge automatically. Run the required live CLI E2E gate before an explicitly authorized merge.

🤖 Generated with Claude Code

wangcansunking and others added 2 commits October 12, 2026 11:22
Close the provider prompt before GitHub CLI inherits stdin, stop connected numeric-only Edit loops, preserve prompt budgets, and expose overflow wording Claude can compact reactively.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@wangcansunking
wangcansunking merged commit 877dba0 into master Oct 12, 2026
1 check passed
@wangcansunking
wangcansunking deleted the u/canwa/session-login-fixes branch October 12, 2026 16:39
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.

1 participant