Skip to content

feat(cli): repeatable --env KEY=VALUE overlay for orient and usage probes - #657

Closed
creativebastard wants to merge 1 commit into
botiverse:mainfrom
creativebastard:cli-env-option
Closed

creativebastard wants to merge 1 commit into
botiverse:mainfrom
creativebastard:cli-env-option

Conversation

@creativebastard

Copy link
Copy Markdown

Closes #655.

What

Adds a repeatable --env KEY=VALUE option to oar orient and oar usage, parsed into the same overlay shape SessionOptions["env"] takes (strings override) and passed through to orient() / runtime.accountUsage().

Why

orient(registry, { env }) already threads an environment overlay into the usage/auth/models readers, but the CLI exposed no way to pass one — both commands always probed the default credential slot. On a host where several agents run one runtime under different accounts (one KIMI_CODE_HOME each), a cap on the default-home account surfaced as rate_limited for the whole runtime and stalled every agent, however much quota their own accounts still had. With --env KIMI_CODE_HOME=/path/to/home a supervisor can now probe each account's own home and key its stall decision per account instead of per runtime.

Evidence

  • oar usage kimi --env KIMI_CODE_HOME=/tmp/oar-empty-home → unsupported / auth_configuration_unavailable (the empty home resolves no managed provider), while the same probe without --env returns the default home's live account snapshot — the overlay demonstrably redirects credential resolution.
  • oar usage kimi --env BROKEN → --env expects KEY=VALUE with a non-empty KEY, got "BROKEN", exit 1.
  • New tests in tests/cli-orient.test.ts: --env pairs are threaded into the account-usage probe, and malformed pairs (no-equals, =value) are rejected before any probing.
  • vitest run over the CLI and environment test files: 118 tests pass; pnpm run lint and pnpm --filter @botiverse/oar-cli typecheck clean.

…obes

orient({ env }) already threads a session-style environment overlay into
the usage/auth/models readers, but the CLI exposed no way to pass one, so
oar usage and oar orient always probed the default credential slot. On a
host where several agents run one runtime under different accounts (one
KIMI_CODE_HOME each), a cap on the default-home account surfaced as
rate_limited for the whole runtime and stalled every agent, however much
quota their own accounts had.

--env KEY=VALUE (repeatable) on oar orient and oar usage parses into the
same overlay shape sessions take and is passed through to orient() and
runtime.accountUsage(), so a supervisor can probe each account's own home.

Closes botiverse#655
@creativebastard

Copy link
Copy Markdown
Author

Duplicate of #656, which was opened first with the same fix (repeatable --env KEY=VALUE on oar usage/oar orient threaded into the existing env plumbing). Closing this one; #656 stands.

stamp-build Bot added a commit that referenced this pull request Nov 6, 2026
…658)

<!-- stamp:review:v1 -->
<sup><img
src="https://cdn.slock.ai/avatars/6aabf32c-20bc-4cba-b55a-2aa72b60999b/8ba4452ceb890f1930886ef4286fdb99.webp"
width="16" height="16" align="absmiddle" alt=""> <b>Otter</b> from
open-agent-runtime opened this pull request through
Stamp</sup><br><sup><a
href="https://stamp.build/review?receipt=prc_a4567485b0e7894036f51db66c7a17e4"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img
src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg"
width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp
→</a></sup>

---
<!-- /stamp:review:v1 -->

The existing CLI already selects another Kimi account through its
inherited process environment. Document this for usage and account-depth
orientation, including PowerShell, and clarify that a rate-limit verdict
applies to the selected account/configuration rather than every account
on that runtime. No environment flag or product behavior changes.

A real Kimi 2.4.1 regression logs into two isolated synthetic accounts
against a local server. Switching A → B → A changes both usage
identity/quota and orientation JSON/table consistently; no login occurs
during reads. The test joins the existing native login CI suite. The
reproducible built-CLI probe and selected results are under
`experiments/orientation/kimi-accounts.md`.

Validation: full check (3,585 unit tests and 18 mock cases), build, and
five native Kimi login/account cases passed on Linux. PowerShell syntax
is documented from Microsoft; Windows execution remains for CI. No real
account or inference was used.

Related: #655, #656, #657.

Co-authored-by: Otter <[email protected]>
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.

CLI usage/orient probe only the default credential slot — one capped account stalls every agent on the runtime

2 participants