fix(bus): clean CLI error for kb-delete --scope private with no agent; add exec timeout - #165
Open
asachs01 wants to merge 1 commit into
Open
fix(bus): clean CLI error for kb-delete --scope private with no agent; add exec timeout#165asachs01 wants to merge 1 commit into
asachs01 wants to merge 1 commit into
Conversation
…; add exec timeout deleteFromKnowledgeBase already threw a plain Error when --scope private resolved with no agent (--agent/CTX_AGENT_NAME), but the kb-delete CLI action had no pre-check for it -- unlike the sibling --org guard in the same handler -- so it bubbled up as a raw Node stack trace instead of a clean ERROR/exit(1). Mirrors the --org guard's shape exactly. Also added a 30s execFileSync timeout to deleteFromKnowledgeBase's mmrag.py call, matching queryKnowledgeBase's flat local-only timeout (delete is disk I/O only, no outbound network like ingest's Gemini calls, so it doesn't need ingest's floor/default/env-override machinery -- the simpler sibling pattern is the right fit). Follow-ups from dev's PR #157 review (task_1787750905384_03501051).
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
Two optional follow-ups from dev's PR #157 review (task_1787750905384_03501051): (1)
kb-delete --scope privatewith no agent resolved now exits cleanly withERROR: --agent or CTX_AGENT_NAME required for --scope privateinstead of dumping a raw Node stack trace — mirrors the existing--orgguard in the same CLI action handler. (2)deleteFromKnowledgeBase'sexecFileSynccall now has a 30s timeout, matchingqueryKnowledgeBase's flat local-only timeout (delete is disk I/O only, no outbound network like ingest's Gemini calls, so it doesn't need ingest's minutes-scale floor/default/env-override machinery).Test plan
CTX_AGENT_NAME= node dist/cli.js bus kb-delete <path> --org wyre --scope private(run from a cwd whose basename is also empty, soagentNamegenuinely resolves empty) now prints the clean ERROR line and exits 1, no stack trace.tests/unit/bus/knowledge-base.test.tscoveringdeleteFromKnowledgeBase: missing-config graceful return, execFileSync called withtimeout: 30000, and the private-scope-no-agent throw stays a plain catchableError(the contract the new CLI guard depends on).npx tsc --noEmitclean.npm run buildclean.npm test: 2617/2623 passed, 4 skipped, 2 failures both indashboard/.../watcher-ingests-real-events.test.ts(unrelated file, real-chokidar filesystem timing) — confirmed pre-existing/environment-flaky, passes 4/4 clean in isolation, same class already documented in rootCLAUDE.mdand hit again independently during tonight's fix(bus): thread CTX_ROOT through resolvePaths() #164 work.Checklist
npm run buildpassesnpm testpasses (see test plan — 1 pre-existing unrelated flake, verified isolated-pass)dist/cli.js, not an agent-installed template/hook/settings fileNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.