Skip to content

fix: refresh runtime credentials and stabilize console sessions - #109

Open
Dts0 wants to merge 6 commits into
googlecolab:mainfrom
Dts0:fix-issue-106-runtime-token-refresh
Open

fix: refresh runtime credentials and stabilize console sessions#109
Dts0 wants to merge 6 commits into
googlecolab:mainfrom
Dts0:fix-issue-106-runtime-token-refresh

Conversation

@Dts0

@Dts0 Dts0 commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Fixes #89.
Fixes #106.

This PR improves the reliability of long-running Colab CLI sessions, particularly around expired runtime-
proxy credentials and interactive Console connections.

Runtime-proxy token refresh (#106)

  • Refreshes runtime-proxy tokens and URLs from /tun/m/assignments during session resolution.
  • Retries runtime-proxy authentication failures once with refreshed credentials.
  • Preserves local session bindings when credential refresh is inconclusive.
  • Removes a local session only after confirming that its exact server-side endpoint is gone.
  • Uses endpoint-guarded, field-level state updates so stale commands cannot overwrite refreshed credentials,
    revive deleted sessions, or modify same-name replacement sessions.
  • Applies credential recovery consistently across execution, file operations, automation, run, restart- kernel, Console, and SSH.
  • Distinguishes tunnel-level authentication failures from normal Contents API “file not found” responses.
  • Keeps SSH 404 behavior unchanged because it normally indicates that the runtime does not expose the SSH
    endpoint.

Console reliability (#89)

  • Adds WebSocket ping/pong liveness checks and visible reconnect status messages.
  • Automatically reconnects dropped interactive Console connections with bounded backoff and refreshed
    credentials.
  • Reuses a single stoppable stdin-forwarding thread across reconnects, preventing thread and object
    accumulation.
  • Preserves normal shell-exit, piped-input, local-stop, and same-name replacement semantics.
  • Bounds control-plane refresh calls so a failed proxy or stopped session cannot leave Console appearing
    frozen.
  • Implements the /colab/tty application-level flow-control protocol: Console now acknowledges marked
    output after flushing it locally, preventing the remote PTY from pausing permanently after approximately 600
    KB of output.

Testing

  • Full unit test suite: 396 passed.
  • Ruff passed for all changed Python files.
  • Added CPU-only end-to-end regressions that:
  • corrupt saved runtime-proxy credentials and verify automatic recovery for ls, exec, and piped
    console;
  • force Console transport failures and verify visible reconnection, credential-refresh fallback, and local
    session removal handling;
  • stream beyond the previous 600 KB PTY pause threshold and verify that output continues to a trailing
    sentinel.
  • All live tests use isolated session state without GPU or TPU flags, clean up their exact test endpoints,
    and verify that pre-existing assignments remain unchanged.

@Dts0
Dts0 marked this pull request as draft August 13, 2026 15:27
@Dts0
Dts0 marked this pull request as ready for review August 15, 2026 01:31
@Dts0 Dts0 changed the title fix: refresh expired runtime proxy tokens fix: refresh runtime credentials and stabilize console sessions Aug 15, 2026
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.

[Bug]: Live sessions are pruned locally after 60 minutes — proxy token expiry is misclassified as "session lost" console hangs

1 participant