Retry zrok token setup after stale-environment cleanup - #838
Conversation
qayshp
left a comment
There was a problem hiding this comment.
Self-review found one focused follow-up for the newly introduced recovery path.
Validation updateValidated the mocked command paths on SIP-enabled arm64 macOS 26.5.2 with Node 20.11.1 and npm 10.2.4.
That failure case was not added to the committed test suite, so the review follow-up remains open. Live recovery is deferred because this machine has no enabled zrok environment. Reproducing it requires a disposable zrok token/environment and will change both local and external zrok state; SIP is not the blocker. No messages were sent or received during validation. No screenshot is needed because the command sequence and resulting state are the relevant evidence. |
|
Superseding the earlier validation note: current head No test used a real disposable zrok token/environment, so this remains mocked command-boundary validation and is not an end-to-end live recovery claim. |
Summary
you already have an enabled environmentfailure when setting an auth tokenzrok enable <token>exactly onceProcessSpawner.executeCommandtests for the bounded recovery pathsRoot cause
ZrokManager.setToken()recognized the stale-environment error but returned its output as though token setup had succeeded. The stale environment remained enabled, so later share creation could continue failing. The issue's manual workaround—runningzrok disablebefore enabling through BlueBubbles—showed the required recovery sequence.Behavior and safety
Only output containing the existing exact zrok condition triggers recovery. The sequence is bounded to:
zrok enable <token>zrok disableif the stale-environment condition is returnedzrok enable <token>attemptThere is no recursion or unbounded retry. If
disablefails, recovery stops before a second enable and preservesFailed to disable Zrok tunnel!. Invalid tokens remainInvalid Zrok token!; unrelated failures retain the existing generic error.Validation
Validated on current head
0cd1cb84:npm run test:zrok --workspace packages/server— 7/7 tests passedenable → disable, performs no second enable, and preserves the exact existing disable errorgit diff --checkpassedLimitation
No recovery was run against a real disposable zrok token/environment. The command sequence and errors are validated at the mocked
ProcessSpawnerboundary; this PR does not claim an end-to-end live zrok recovery pass.The broader server type-check still reaches the pre-existing unrelated
ScheduledService.ts:39NodeJS.Timer/clearIntervalerror.Fixes #678