Skip to content

fix: gate agentcore run ingest behind ENABLE_GATED_FEATURES#1619

Merged
tejaskash merged 1 commit into
mainfrom
worktree-fmkb-ingest-feature-gate
Jun 23, 2026
Merged

fix: gate agentcore run ingest behind ENABLE_GATED_FEATURES#1619
tejaskash merged 1 commit into
mainfrom
worktree-fmkb-ingest-feature-gate

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Problem

Knowledge bases (FMKB) are gated behind the ENABLE_GATED_FEATURES flag, but agentcore run ingest — which operates exclusively on knowledge bases — was reachable regardless of the flag. This was inconsistent with add knowledge-base / remove knowledge-base, which are properly gated, and effectively leaked an unlaunched FMKB feature in both the CLI and TUI.

Fix

Match the existing FMKB gating pattern (KnowledgeBasePrimitive.registerCommands):

  • CLI (src/cli/commands/run/command.tsx): mark the ingest subcommand as hidden from --help when the gate is off, and reject invocation early with the same Knowledge bases are not yet available. message used elsewhere.
  • TUI (src/cli/tui/screens/run-eval/RunScreen.tsx): omit the "Ingest knowledge base" item from the Run menu when the gate is off.

Testing

Added src/cli/commands/run/__tests__/run-ingest-gating.test.ts (drives the built CLI, mirrors add-knowledge-base.test.ts):

  • run ingest exits 1 with "Knowledge bases are not yet available." when the gate is off
  • ingest hidden from run --help when off, visible when ENABLE_GATED_FEATURES=1
  • with the gate open, the command passes the gate and fails later on KB-name validation (proving the gate no longer blocks)

Verified locally:

  • npm run build ✅ (CLI bundle builds; unrelated optional @aws/agent-inspector asset-copy warning only)
  • New test suite: 4/4 passing ✅
  • npm run typecheck
  • eslint + prettier on changed files ✅

Knowledge bases (FMKB) are gated behind ENABLE_GATED_FEATURES, but
`agentcore run ingest` — which operates exclusively on knowledge bases —
was reachable regardless of the flag, both as a CLI command and as a TUI
Run-menu option.

Match the existing FMKB gating used by `add knowledge-base` /
`remove knowledge-base`:
- CLI: hide the `ingest` subcommand from help when the gate is off, and
  reject invocation early with "Knowledge bases are not yet available."
- TUI: omit the "Ingest knowledge base" item from the Run menu when the
  gate is off.

Adds an e2e gating test driving the built CLI.
@tejaskash tejaskash requested a review from a team June 23, 2026 17:05
@github-actions github-actions Bot added the size/s PR size: S label Jun 23, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 23, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1619-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.20.2.tgz

@agentcore-cli-automation agentcore-cli-automation left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tightening up the FMKB gating — the CLI and TUI changes match the existing KnowledgeBasePrimitive pattern cleanly. A few issues with the new test file and one UX consistency question before this is ready to merge.

Comment thread src/cli/commands/run/__tests__/run-ingest-gating.test.ts
const projectName = 'TestProj';
// Create the project with gated features enabled so the KB add path is
// available; the ingest gating is exercised separately below.
const result = await runCLI(['create', '--name', projectName, '--no-agent'], testDir);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment/code mismatch: the comment says "Create the project with gated features enabled so the KB add path is available", but no env: { ENABLE_GATED_FEATURES: '1' } is passed to this runCLI call, and the test never actually adds a KB to the project. Please either drop the comment or align it with what the test does (just creating a bare project for the ingest invocations).

Comment thread src/cli/tui/screens/run-eval/RunScreen.tsx
@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 37.03% 13550 / 36588
🔵 Statements 36.3% 14406 / 39681
🔵 Functions 31.68% 2326 / 7341
🔵 Branches 30.79% 8927 / 28987
Generated in workflow #3771 for commit 71144c3 by the Vitest Coverage Report Action

@notgitika notgitika left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for adding a test file for this but please ensure that there is a comment or an issue that ensures cleanup of this file.

Please address the automation findings too.

@tejaskash tejaskash merged commit 5d4719a into main Jun 23, 2026
37 checks passed
@tejaskash tejaskash deleted the worktree-fmkb-ingest-feature-gate branch June 23, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants