Skip to content

1.42: credits at the wall, and relay cloud - #1

Merged
ridelink0 merged 6 commits into
mainfrom
claude/session-limits-usage-credits-dm3isz
Sep 29, 2026
Merged

ridelink0 merged 6 commits into
mainfrom
claude/session-limits-usage-credits-dm3isz

Conversation

@ridelink0

@ridelink0 ridelink0 commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

This PR plans against credits instead of only the 100% usage limit. It was tested in the real scenario: a cloud session running on the $250 cloud-session credit while the 5-hour window read "rejected".

What this account actually has (verified in ~/.claude.json):

  • Usage credits (extra usage) are org_level_disabled, so a local session stops dead at the wall.
  • What carries work past the wall is the $250 cloud-session credit. The CLI itself advertises it through the tengu_swift_lynx flag.

Changes:

  • The cloud-credit offer is read. The amount, the claim URL and the wall notice come from the flag, and the report shows a Cloud credit line. At the wall, with usage credits off, the report and brief name "carry on now in a cloud session" instead of only "resume after HH:MM".
  • Inside a cloud container the report no longer says "Run /usage once". It says the session is billed to the cloud credit and shows this session's spend at list prices.
  • relay cloud prints the claude --cloud "<continuation>" command, and --go launches it. It warns about a dirty tree or unpushed commits, because the cloud clones from GitHub.
  • Review fixes (945a6d3):
    • It names the branch.
    • It survives curly quotes in PowerShell.
    • It stops sending a batch shim to PowerShell.

Tests: 972 tests: 971 pass, 1 skipped (Task Scheduler is Windows-only). No test launches a real cloud session.

Not verified:

  • A real claude --cloud launch. That was skipped on purpose, because it would spend credit.
  • Windows quoting has only been tested at the string level.

Coming to this branch next: a relay mode that starts a genuinely fresh session. Today's wake runs claude --resume <same id> although defer.md says "fresh session".

🤖 Generated with Claude Code

https://claude.ai/code/session_01CPrhYxAHgTrw4QZVtWaHV8


Generated by Claude Code

https://claude.ai/code/session_01WtLiUzvgkpgL2BP6qJiQP5

…, and relay cloud hands the work to one

This account has usage credits switched off at the org level
(cachedExtraUsageDisabledReason "org_level_disabled"), so at 100 per cent of
the 5-hour window a local session stops dead and the report said so and
nothing else. The CLI itself offers a second way at that same wall: a dollar
credit for cloud sessions, on top of the plan (tengu_swift_lynx, read from
~/.claude.json in a cloud container on 2026-09-28), and a cloud session on it
was seen still working with its own record saying five_hour "rejected".

lowpri.cloudCredit reads the offer: the amount is parsed from the server's own
copy, never written here, and an absent, malformed or amount-less flag is no
offer. The report gets a Cloud credit line and, at the wall with usage
credits off or their spend limit reached, one line naming it as the way on
now; the resume-after line stays. The brief says it once a session near the
wall, in both styles, and not when usage credits are on or when it is already
running in a cloud session.

Inside a cloud container (detected from CLAUDE_CODE_CONTAINER_ID, injectable)
there is no usage snapshot, so the report no longer says "Run /usage once",
which cannot work there; it says what kind of session this is and what it has
cost so far at list prices, subagents included, against the offered amount.

relay cloud builds the prompt the wake would deliver, opened for a cloud
session, inline because a cloud session cannot read a file here, and prints
the claude --cloud command quoted for sh or PowerShell. It warns about
uncommitted changes, unpushed commits and a branch with no upstream, because
the cloud clones from GitHub. --go launches it detached with its output in a
run log, and is guarded like the scheduler: a dry run under node --test, with
USAGE_LIMITS_CLOUD=dry-run or a redirected home, and every test launch goes
to a fake spawner.

test/cloud-credit.test.js (16) and test/relay-cloud.test.js (13); all 29 fail
against the scripts before this change. Full suite 970/972, 2 skipped (Task
Scheduler is Windows only; vscode/lib not built), 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPrhYxAHgTrw4QZVtWaHV8
package.json, both plugin manifests and the VS Code package say 1.42.0, and
vscode/lib is rebuilt from the scripts at that version - 32 scripts. 971/972,
the one skip being Task Scheduler, which is Windows only; no usage-limits temp
folder left behind. Minor, because relay cloud is a new command.

A correction to the previous commit's body: the new files hold 15 and 13
tests, 28 in all, not 16 and 13. All 28 fail when run against the scripts at
1.41.1 (checked from a git archive of 7dadccc), and the suite there was
970/972 with 2 skipped, as it said.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPrhYxAHgTrw4QZVtWaHV8
…d stops sending a batch shim to PowerShell

Three things a review of 1.42.0 found in the cloud hand-off.

The hand-off told the cloud session it was a fresh clone with only what was
pushed, and the warnings told the user to push the branch, but nothing told the
cloud session which branch that was. Which branch a cloud clone starts on is
not ours to choose, so work pushed to a feature branch could read as missing,
and the prompt says to stop and say so when something is missing. The branch
is now named in the cloud opening (not for a detached HEAD, and never in the
wake's own prompt, which resumes in place).

PowerShell also closes a single-quoted string at a curly single quote
(U+2018-U+201B), and psQuote only doubled the straight one, so a continuation
with a typographic apostrophe in it broke the printed command on Windows.
They are doubled now, which is also right for the scheduler's uses of psQuote.

The --go refusal for a .cmd shim said to paste the command into PowerShell
instead, but PowerShell runs a .cmd through cmd.exe too, so that cut the
hand-off at the same line break. It now points at the native claude.exe.

The new assertions fail without the change (3 of 14 in relay-cloud). Suite
972/973, the skip being Task Scheduler, which is Windows only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPrhYxAHgTrw4QZVtWaHV8
package.json, both plugin manifests and the VS Code package say 1.42.1, and
vscode/lib is rebuilt from the scripts at that version - 32 scripts. 972/973,
the one skip being Task Scheduler, which is Windows only; no usage-limits temp
folder left behind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPrhYxAHgTrw4QZVtWaHV8
…fore a batch shim cuts the hand-off

defer.md said the wake "starts a fresh session in the original directory and
hands it the saved plan", but wake.js ran claude --resume <id>: the same
conversation. A long session is the one that runs out, and resuming carries
all of it into the next window.

relay fresh on|off (off by default, so nothing changes unless it is set)
picks which conversation mode resume continues in. On, the wake starts claude
in the project with the whole hand-off as its first prompt, inline, Remote
Control on as "usage-limits relay <project> (new session)", with the relay's
permission mode and model, and no transcript needed - so a deferral made
where no session id is known now has something that works. The prompt opens
by telling the new session it has none of the conversation (and, for a
deferral, that it is the deferred time rather than a reset). relay show off
makes it a headless claude -p with the hand-off on stdin. ONE TERMINAL is
unchanged: an old session open and working again makes the wake stand down;
open but quiet for three minutes, the wake opens its one window. Under mode
notify the note names the hand-off file to give a new session. Codex resumes
its thread either way.

On Windows the launcher is a .cmd and cmd.exe cannot carry a line break, so
the inline hand-off goes through node (wake.js --exec-spec) to the native
claude.exe; with only the npm claude.cmd shim, or a hand-off too long for one
argument, the first prompt points at the hand-off file instead, and the relay
log says why. UNVERIFIED on a real Windows console: the argument passing is
tested through node here, not a live claude.exe window.

defer's one-line reply now says what fires at the time (a notification, the
same conversation, or a new session), and marks its own record: it passed the
sessionId function to armedFor, which matched nothing, so with another relay
armed first the deferred label went on that one.

relay cloud on Windows now warns, before anything is pasted, when the claude
on PATH is a .cmd/.bat shim: PowerShell runs it through cmd.exe, which cuts
the hand-off at its first line break. It names a native claude.exe when one
is found, which --go already uses.

defer.md, relay.md, SKILL.md and the README say what happens in each mode.
test/relay-fresh.test.js (13) and one relay-cloud test; all 14 fail against
the scripts before this change. Suite 986/987, the skip being Task Scheduler,
which is Windows only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPrhYxAHgTrw4QZVtWaHV8
package.json, both plugin manifests and the VS Code package say 1.43.0, and
vscode/lib is rebuilt from the scripts at that version - 32 scripts. 986/987,
the one skip being Task Scheduler, which is Windows only; no usage-limits temp
folder left behind. Minor, because relay fresh is a new setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPrhYxAHgTrw4QZVtWaHV8
@ridelink0
ridelink0 merged commit 87ac644 into main Sep 29, 2026
9 checks passed
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.

2 participants