Repository navigation
fix: read wrapped token refresh replies and report rejected refreshes - #30
Merged
Merged
Conversation
Other gateway calls reply with a {code, message, data} envelope, and
beeper/line#260 decodes a wrapped token refresh reply. The CLI parsed the
refresh reply only as a bare token, so a wrapped success had no access
token: nothing was saved after LINE may already have rotated the refresh
token, and every later refresh was rejected (HTTP 400, gateway code
10201) until line login. Accept both shapes, and label an unreadable
success with the response_envelope diagnostic.
Treat HTTP 400/401/403 and HTTP 200 error envelopes from tokenRefresh as
a refresh rejection: an authentication error that asks for line login
(JSON authentication_failed) instead of "check your connection". It is
not retried and does not invalidate the session; forced-logout codes
still do. line doctor reports it, and line watch stops instead of
retrying the rejected token forever.
Stop documenting a seven-day refresh interval in the CLI guides.
Refs #29
kongesque
marked this pull request as ready for review
November 16, 2026 04:29
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #29: sessions stopped working 3–4 days after QR login. Every later refresh got HTTP 400 with gateway code 10201 until
line login, and the CLI said "check your connection" (remote_failed).RefreshAccessTokenContextparsed/api/auth/tokenRefreshonly as a bareTokenV3IssueResult. Every other gateway call here unwraps{code, message, data}, and Beeper decodes a wrapped refresh reply (beeper/line#260, 2026-10-07). Read as bare, a wrapped success has no access token, so the CLI saved nothing after LINE may already have rotated the refresh token. That matches every later refresh being rejected. Both shapes are now accepted, and an unreadable success gets the existingresponse_envelopediagnostic instead of an unlabelled error.tokenRefreshare now a refresh rejection (line.IsRefreshRejected), which counts as an authentication error:authentication_failedcode and keeps the gateway diagnostic (HTTP status, gateway code).line doctorfailsline_authwith "Run line login."line watchstops instead of retrying the rejected token forever.Refs #29.
Proven and inferred
Validation
./build.sh,./bin/line help,go test -race ./internal/... ./cmd/line ./pkg/line/... ./pkg/e2ee,goimports,gofmt,go vet,staticcheck,./scripts/check-toolchain.sh, andgit diff --check.whoami(human and JSON),doctor, andwatch. The newpkg/lineandsessiontests fail on the previousclient.go../pkgand./pkg/ltsmsuites (untouched),./scripts/security-check.sh, and the Linux Secret Service and Windows DPAPI suites (CI).line whoamiroughly every 6 hours that logged only the outcome. As of 2026-11-16 04:13 UTC (162 hours, about 6.8 days): 31 checks, 0 failures, all on this build. v0.6.0 failed around day 3–4; the checks at 84, 91 and 98 hours passed. The log records command success, not individual refreshes, so no refresh reply was captured.