Repository navigation
feat(environments): show package policy and Anaconda sign-in failures in the chat - #165
Draft
romulorosa wants to merge 8 commits into
Draft
romulorosa wants to merge 8 commits into
romulorosa wants to merge 8 commits into
Conversation
A kilo.chat/tool-renderer implementation may answer isStandalone(call) to keep only some of a tool's calls (a failure the person can act on) out of the activity groups and the settled turn's fold, as the static standalone metadata does for every call. The tool's first renderer is asked; a question that throws leaves the call where it would be. toolResultText (a string, or an MCP result's text content) moves to the contracts so renderers read tool output the way the sign-in card does.
kilo.environments contributes a kilo.chat/tool-renderer for the conda tools that resolve packages (envs.create/clone, packages.install/update/remove, repodata.find). A failed call whose message is a package-policy block, a solve failure with a policy note, or an Anaconda sign-in refusal (NOT_SIGNED_IN / CHANNEL_ACCESS_DENIED) becomes a card: its title, the message, PolicyErrorDetails (blocked packages verbatim, the policy note, Sign in to Anaconda) and, after sign-in, a prompt to ask the agent to try again; the default row and solver text stay under Details. Only those calls stand alone outside the activity groups and the turn's fold; every other call renders as before.
The card now reads what is blocked, why, by whom, and what to do next, each once: a headline naming the package (or the count), a subline with the org and policy, the platform's reason in its own block, then the next step with a quiet Details toggle. Several blocks list one row each, naming an org or policy only when the subline does not. Sign-in refusals lead with the channel and a Sign in to Anaconda button that turns into "Signed in. Ask the agent to try again." PolicyErrorDetails exports its sign-in as useAnacondaSignIn so the card draws its own button; Settings renders as before.
Kilo's chats get an instruction through the conda chat config: the card already shows the blocked packages, policy, org, reason and sign-in, so the agent replies with one short sentence and the next step. The tool descriptions, which also reach external MCP clients without the card, keep the verbatim report unless the instructions say the chat shows it.
…ror-handling-and-n' into kilo/policy-chat-card # Conflicts: # plugins/environments/src/main/tools.test.ts # plugins/environments/src/main/tools.ts
…ror-handling-and-n' into kilo/policy-chat-card
…ror-handling-and-n' into kilo/policy-chat-card
This branch has not been deployed
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.
Stacked on #163 (error codes, agent guidance,
PolicyErrorDetails, payload 0.1.23). Review only the last four commits.What
kilo.chat (generic, no conda knowledge): a
kilo.chat/tool-rendererimplementation can now answerisStandalone(call). The calls it picks stay out of the activity groups and the settled turn's fold, the same way the staticstandalonemetadata keeps every call of a tool out. kilo.chat asks the tool's highest-priority renderer. If the predicate throws, the call is grouped as usual, so one plugin's bug can't break the transcript's grouping.toolResultText(result)(a string, or an MCP result's text content) is now exported from the chat contracts, and the sign-in card uses it too.kilo.environments: contributes the
conda-policytool renderer forconda.envs.create,conda.envs.clone,conda.packages.install,conda.packages.update,conda.packages.removeandconda.repodata.find. When a call fails with one of these, it renders as a card (environments-chat-policy-card):POLICY_BLOCKED;SOLVE_FAILEDwithpolicyNote;NOT_SIGNED_IN/CHANNEL_ACCESS_DENIED.The card reads what is blocked, why, by whom, then what to do, each once. A blocked install shows
pillow 8.4.0 is blocked, thenby acme's package policy · organization_policy, then the platform's reason verbatim in its own block, then the next step ("Ask your organization's administrator for an exception…"). Several blocks show "3 packages are blocked" and one row per package (name and version, reason), and a row names its org or policy only when the subline doesn't. A policy-note solve failure shows "Couldn't resolve the packages". Sign-in refusals lead with the channel ("Sign in to Anaconda to use acme/main", "Your Anaconda account can't use …"), with a "Sign in to Anaconda" button that turns into "Signed in. Ask the agent to try again." The default row and the solver text sit under a quiet "Details" toggle.PolicyErrorDetailsexports its sign-in asuseAnacondaSignInso the card can draw its own button. Settings renders as before. Only these calls stand alone. Every other call, and every success, renders exactly as before.Agent text: the conda
kilo.core/chat-configcontribution adds an instruction for Kilo's chats: the card already shows these details, so the agent replies in one short sentence with the next step and doesn't repeat the package, channel, org, policy or reason.POLICY_GUIDANCEin the tool descriptions, which external MCP clients without the card also read, keeps the verbatim report "unless your instructions say the chat already shows these details". Never routing around a block and never asking for a token are unchanged.Docs:
docs/plugins/chat-and-tools.mddocumentsisStandaloneandtoolResultText, andpnpm docs:schemawas regenerated.Why
With #163 the agent gets structured policy and sign-in errors. In the transcript, though, those failures were still a one-line row folded into "Worked for …". People couldn't see which package was blocked, which policy blocked it or why, and they had no way to sign in to Anaconda from there. The card keeps these failures in sight and actionable, and the change to kilo.chat stays generic.
Tests
pnpm lint,pnpm format:check,pnpm check: pass.@kilo-desktop/plugin-chatcoverage (unit + browser): 118 files / 1005 tests pass. Statements 94.3%, branches 83%, functions 92%, lines 96.3%.toolResultText(helpers.test.ts), the toolkit publishing per-call standalone questions (toolkit.test.ts), grouping and fold, including a throwing predicate (activity-grouping.test.ts), and a contributed renderer whose failed call stays out of the fold while its successful call folds (tools.browser.test.tsx).@kilo-desktop/plugin-environmentscoverage (unit + integration + browser): 48 files / 998 tests pass. Statements 96.1%, branches 87.4%, functions 92.7%, lines 97.1%.condaPolicyFailureunit tests, andpolicyCardContentunit tests (headlines, shared vs per-row org/policy, null fields, the summary fallback, channel shortening). Browser tests for the card cover a single block with nothing said twice, three blocks with mixed policies and null fields, a policy note, sign-in success and failure, no button without kilo.anaconda, and the fallback for other errors and successes. Entry and tools tests check the chat instruction and the conditional guidance.Live test (payload 0.1.23,
pnpm dev,environments-featureon, an API key scoped to a policy org)pillow=8.4.0ondefaults: the transcript shows the policy card with the package, policy, org and reason, outside the fold after the turn settles.conda.repodata.findon that channel while signed out shows the sign-in card naming the refused channel.holoviewson the org's policy channel shows the "Couldn't resolve the packages" card.