Repository navigation
fix(cli): send, tools and inbox act as the home's agent only; printed next commands carry --home - #12
Merged
Merged
Conversation
… next commands carry --home - send, tools call, tools list and inbox follow the listener's rule: an exported AGENTCHAT_API_KEY that is not the home's key (or one exported while the home holds none) stops them in one line before anything reaches the server; the key they send is always the one in `credentials`. - invocationFor(home) adds `--home <dir>` (quoted for the platform's shell when needed) unless the home is ~/.agentchat and a bare command reaches it; every printed next step uses it, so a printed `logout` can no longer act on another home. - The refusal's way out puts no key on a command line (`printenv AGENTCHAT_API_KEY | agentchat --home <dir> login --api-key -`); status and doctor probes use the home's key only. - --help, README and SECURITY.md: login by prompt or stdin only; what an exported key does to every command.
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.
What changes
Testing found two things:
agentchat sendwent out as that agent with onlyok: trueon screen, andtools callanswered as it. The listener refuses the same state.--home <dir>, every command the CLI printed next left--homeout. Run as printed, they acted on~/.agentchat, and the printedlogoutcould delete the default home's only key.What this PR does:
send,tools call,tools listandinboxrefuse in one line whenAGENTCHAT_API_KEYis exported and is not the home's key, or is exported while the home holds none. They refuse before anything reaches the server, and the key they send is always the one incredentials.printenv AGENTCHAT_API_KEY | agentchat --home <dir> login --api-key -.doctor'slistener-identitycheck names every command it stops.invocationFor(home)adds--home <dir>unless the home is~/.agentchatand a bare command reaches it, that is, noAGENTCHAT_HOMEpoints elsewhere. The path is quoted for the platform's shell when it has to be.register --code,status,logout,login) and for the listener's,watch's anddoctor's hints.--help:loginis shown with a prompt or stdin only, never--api-key <key>orAGENTCHAT_API_KEY. README andSECURITY.mdsay what an exported key does to every command.The answer / work / full profiles are not touched. Preset runs keep the identity store unreadable to answer runs exactly as before.
--with-keyis unchanged: the owner's explicit opt-in.Merge order: after the agent-core PR (agentchatme/agentchat-agent-core#21). This PR does not depend on it: it builds and passes against the bundled agent-core 0.5.2. The engine's refusals for
status,doctorandlogincome with that release when the pin moves at the release step. No version number is set here.Verification
Tests:
pnpm type-check,pnpm build,pnpm testandscripts/release-smoke.shon Node 22 (macOS): 8 files, 86 passed, 1 skipped (87); smoke ok.tests/cli.test.ts(6) cover:invocationForand its quoting;statusand the register gate print--home <dir>;origin/main. The one that passes on main, the same key exported, guards behaviour that already worked.loginandstatusrefusals. It is skipped until the agent-core pin moves, and passes with the new engine linked in.Review: independent review by a separate agent with fresh context. It was given the code and the requirements, and it ran the suites. Its blocker was the new tests expecting an unquoted
--home, which would fail on Windows CI; expectations are now built withshellArg. Should-fix items, fixed:--homewas dropped whenAGENTCHAT_HOMEpointed elsewhere. Now it is left out only when the home is~/.agentchatand a bare command reaches it.statusanddoctoruse the home's key only.listener-identity, so the engine'senv-keycheck does not duplicate it after the pin moves.Its point 'decide: env-only for the hands' is decided as refuse, matching the listener and SECURITY.md's one-identity promise (see Risk).
Live check: n/a before release. After release, the check is
sendwith a foreign key exported, and following the printed commands after--home.Risk and rollback
AGENTCHAT_API_KEY=… agentchat send …against a home with no key is now refused. It runsagentchat loginonce first (it takes the exported key into an empty home), thensend. The README never documented the env-only form for these commands.status(the engine's) still shows an env-only identity whilesendrefuses it.statusis informational, and its refusal of a split, where both keys exist and differ, comes with the engine.