Conversation
SummaryThis PR improves the reliability of long-running Colab CLI sessions, particularly around expired runtime- Runtime-proxy token refresh (#106)
Console reliability (#89)
Testing
|
The tunnel frontend returns an empty 401/404 for an expired runtime proxy token, while a genuine Contents API 'not found' carries a JSON error body. Mapping every 404 to FileNotFoundError let `colab edit` treat proxy failures as 'start empty' and overwrite the remote file on save. Now empty-body 401/404 raises RuntimeProxyError (mirrors the approach of upstream googlecolab#109), which propagates and aborts the edit before the editor opens; only a JSON-body 404 stays FileNotFoundError. Tests: empty-404/401 -> RuntimeProxyError, JSON-404 -> FileNotFoundError, edit aborts on RuntimeProxyError without opening the editor or uploading.
|
Thanks for the contribution! We submitted the token-refresh change separately as #149. We can take a look at the console changes still if you remove any of the refresh-token based changes you added |
Ok, I will do it later. |
`colab console` previously died on the first proxy hiccup or on a long output burst. Keep the raw /colab/tty session usable: - Reconnect an abnormally closed interactive socket with 1/2/5/10/30s backoff (then every 30s) until the user cancels. Connection loss, every retry, and successful reconnection are reported on stderr instead of leaving the terminal apparently frozen. - Refresh runtime-proxy credentials before each reconnect, bounded to 10s, and never switch to a same-name replacement. A binding removed by a concurrent `colab stop` is treated as conclusive before any HTTP lookup. - Honour /colab/tty application-level flow control: write and flush output marked with `"ack": true` before replying on the same socket, so the remote PTY stops pausing after six unacknowledged chunks (~100 KB each). - Keep one stdin-forwarding thread across attempts and never replay piped input; normal close codes and a recent shell-exit request end the session. Session-binding writes on the Console path go through endpoint-guarded `StateStore.update_fields` / `remove_if_endpoint`, so a stale writer cannot resurrect a removed binding or clobber a token refreshed by another invocation. `State.resolve_session` stays offline: refreshing remains the job of `State.get_session` (also bounded to 10s), which avoids pruning a just-created binding when the assignments snapshot lags. Adds CPU-only live regressions for reconnection, >600 KB output flow control, and runtime-proxy token expiry, plus unit coverage for the endpoint-guarded store primitives. Verified: 384 unit tests, ruff on src/tests/integration, and the CPU-only live integration scenarios (no assignments left behind).
5c3c786 to
d7160eb
Compare
Done. I’ve removed the duplicate changes, resolved the conflicts, squashed the remaining commits into one, and retested the changes. |
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)
/tun/m/assignmentsduring session resolution.revive deleted sessions, or modify same-name replacement sessions.
run,restart- kernel, Console, and SSH.endpoint.
Console reliability (#89)
credentials.
accumulation.
frozen.
/colab/ttyapplication-level flow-control protocol: Console now acknowledges markedoutput after flushing it locally, preventing the remote PTY from pausing permanently after approximately 600
KB of output.
Testing
396 passed.ls,exec, and pipedconsole;session removal handling;
sentinel.
and verify that pre-existing assignments remain unchanged.