Skip to content

feat(fetch): support harness in fetch access (CLI + TUI) - #1611

Merged
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness
Jun 23, 2026
Merged

feat(fetch): support harness in fetch access (CLI + TUI)#1611
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Summary

Adds harness as a resource type for fetch access, so users can retrieve a CUSTOM_JWT bearer token for a deployed harness — both from the CLI (fetch access --type harness --name <name>) and the interactive TUI picker. Builds on the existing fetchHarnessToken operation (already used by invoke auto-fetch); this exposes it through the fetch command surface.

What changed

CLI

  • commands/fetch/types.tsFetchResourceType += 'harness'
  • commands/fetch/action.tshandleFetchHarnessAccess dispatch; the agent and harness handlers now share one fetchTokenAccess helper (they were near-identical)
  • commands/fetch/command.tsx--type / --name / description help text cover harness

TUI

  • operations/fetch-access/list-harnesses.tsnewlistHarnesses (project registry ∩ deployed-state, reads each harness.json for authorizerType); mirrors listAgents
  • operations/fetch-access/{types,index}.tsHarnessInfo type + exports
  • tui/screens/fetch-access/useFetchAccessFlow.ts — loads harnesses alongside gateways/agents; routes harness fetch through fetchHarnessToken
  • tui/screens/fetch-access/FetchAccessScreen.tsx — labels the harness resource type

Testing

Unit: 48 passing across fetch-access, including 6 new harness cases (3 CLI action, 3 TUI flow).

End-to-end against real AWS (account 346532552948 / us-west-2):

  1. Deployed a CUSTOM_JWT harness backed by a Cognito user pool, with the OAuth credential stored in Bedrock AgentCore Identity (create-oauth2-credential-provider).
  2. fetch access --type harness --name <name>success: true, returned a valid Cognito-issued JWT (verified claims: correct issuer, client_id, scope=agentcore/invoke, token_use=access).
  3. TUI fetch flow → harness appears in the picker as Harness [JWT], selecting it fetches and displays the same valid token.
  4. Verified for both a TUI-created harness and a CLI-created harness.

Notes

  • An AWS_IAM harness has no token to fetch — it surfaces the existing "use SigV4" guidance (same UX as the agent path). Token fetch applies only to CUSTOM_JWT harnesses with a managed OAuth credential.
  • listHarnesses reads each harness.json for authorizerType (the project registry entry only carries name/path).

Adds 'harness' as a resource type for fetch access, fetching a CUSTOM_JWT
bearer token for a deployed harness via the existing fetchHarnessToken
operation.
CLI:
- types: FetchResourceType += 'harness'
- action: handleFetchHarnessAccess dispatch; agent + harness share one
fetchTokenAccess helper
- command: help text covers harness
TUI:
- new listHarnesses operation (project registry ∩ deployed-state, reads each
harness.json for authorizerType)
- useFetchAccessFlow loads harnesses alongside gateways/agents and routes the
harness fetch through fetchHarnessToken
- FetchAccessScreen labels the harness resource type
Verified end-to-end against real AWS (us-west-2): deployed a CUSTOM_JWT harness
backed by Cognito with the OAuth credential stored in AgentCore Identity, then
fetched a valid bearer token via both 'fetch access --type harness' and the TUI
picker. Unit tests: 48 passing across fetch-access (incl. 6 new harness cases).
@tejaskash
tejaskash requested a review from a teamJune 22, 2026 21:24
@github-actionsgithub-actionsBot added the size/m PR size: M label Jun 22, 2026
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1611-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-automationagentcore-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.

Nice cleanup factoring fetchTokenAccess out of the agent and harness paths. A couple of real issues to address before merge — see inline comments. The main one: --identity-name is silently ignored for harnesses because fetchHarnessToken doesn't accept that option, even though the CLI advertises the flag for all token-bearing resources.


One additional note (not file in this PR, so flagging here):

Telemetry — ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']) and backs the fetch.accessresource_type attribute (see command-run.ts:173). Adding harness means that enum needs 'harness' for any future emission to be valid.

Separately, I couldn't find any actual cli.command_run emission for fetch.access — the schema entry exists but commands/fetch/command.tsx doesn't wrap the handler with withCommandRunTelemetry. That's a pre-existing gap, but per src/cli/telemetry/README.md adding telemetry to new features is expected. Worth wiring up while you're here so the new harness path doesn't go unobserved.

Comment threadsrc/cli/commands/fetch/action.ts
Comment threadsrc/cli/operations/fetch-access/list-harnesses.ts Outdated
Comment threadsrc/cli/operations/fetch-access/types.ts Outdated
@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@github-actions

github-actionsBot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

StatusCategoryPercentageCovered / Total
🔵Lines37.03%13550 / 36585
🔵Statements36.3%14406 / 39678
🔵Functions31.68%2326 / 7341
🔵Branches30.8%8927 / 28983
Generated in workflow #3765 for commit d0c3f75 by the Vitest Coverage Report Action

- fetchHarnessToken: accept identityName and forward as credentialName, so
'fetch access --type harness --identity-name X' is honored instead of
silently using the default <name>-oauth (mirrors fetchRuntimeToken).
- listHarnesses: drop the silent AWS_IAM fallback on readHarnessSpec failure;
let the error propagate so a corrupt/missing harness.json for a deployed
harness surfaces instead of masking a CUSTOM_JWT harness as AWS_IAM.
- HarnessInfo.authType: type as RuntimeAuthorizerType (was string) to match
AgentInfo and get the TUI auth-type branches type-checked.
- tests: replace the objectContaining({}) matcher with exact-options
assertions and add a case proving --identity-name/--target are forwarded.
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
tejaskash added a commit that referenced this pull request Jun 22, 2026
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-cli-automation

Copy link
Copy Markdown

Looks good to merge from my pass. The three inline issues from the previous review (--identity-name silently dropped for harnesses, the silent AWS_IAM fallback in listHarnesses, and the weak authType: string typing) all landed cleanly in e3be685 with tests to back the identityName forwarding.

The only outstanding item is the telemetry note from the previous review summary — it wasn't addressed and isn't a code-change blocker in this PR, but worth tracking:

  • ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']); if/when fetch.access actually emits, harness will fail schema validation.
  • commands/fetch/command.tsx doesn't wrap the action with withCommandRunTelemetry, so the new harness path (and the existing agent/gateway paths) go unobserved despite a FetchAccessAttrs schema entry already existing for it.

Both are pre-existing gaps that this PR widens rather than introduces. Happy to see them addressed in a follow-up if you'd rather keep this PR scoped.

@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@tejaskash

Copy link
Copy Markdown
ContributorAuthor

Addressed the telemetry note from the review body in 2ad7236:

  • ResourceType enum now includes 'harness' (src/cli/telemetry/schemas/common-shapes.ts) — so a fetch.access emission with resource_type=harness validates instead of being dropped.
  • Wired withCommandRunTelemetry into fetch access — the command previously emitted no cli.command_run at all. It now records resource_type. handleFetchAccess runs exactly once inside the wrapper; its string-error shape is adapted to the Result {success, error: Error} the telemetry layer expects (used only for exit_reason/error_name), while the original result drives output.

The three inline issues (--identity-name forwarding, AWS_IAM fallback, HarnessInfo.authType typing) were addressed earlier in e3be685. All review items are now resolved. 131 tests pass across telemetry + fetch + tui-fetch suites.

@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
Update docs/commands.md 'fetch access' section: --type now lists harness,
add a harness usage example, and note the CUSTOM_JWT token-fetch behavior
(managed OAuth credential, --identity-name override, AWS_IAM has no token).
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 23, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-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-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@tejaskash
tejaskash merged commit 12fd67a into mainJun 23, 2026
96 of 97 checks passed
@tejaskash
tejaskash deleted the feat/fetch-access-harness branch June 23, 2026 16:06
tejaskash added a commit that referenced this pull request Jun 23, 2026
…WT (#1609)
* test(e2e): add harness E2E coverage for lite_llm, attached tools, and CUSTOM_JWT
Extends the harness E2E surface with three real-AWS scenarios that the
provider matrix (bedrock/open_ai/gemini) doesn't cover:
- harness-litellm.test.ts — lite_llm provider routed at a Bedrock model
(no third-party key); deploy-only (skipInvoke) to prove the model config is
accepted by CloudFormation. Extends harness-e2e-helper with modelId/apiBase/
additionalParams support.
- harness-with-tool.test.ts — bedrock harness + agentcore_code_interpreter tool
via 'add tool'; proves tool wiring survives synth/deploy and the harness still
invokes.
- harness-custom-jwt.test.ts — harness with a CUSTOM_JWT authorizer backed by a
Cognito pool; asserts AuthorizerConfiguration in the CFN template, SigV4
rejection, and bearer-token invoke (mirrors byo-custom-jwt.test.ts).
All self-skip without AWS creds. The per-PR e2e workflow auto-runs changed
harness-*.test.ts files; the full suite shards everything.
* test(e2e): add fetch access --type harness step to custom-jwt e2e
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
aidandaly24 added a commit that referenced this pull request Jun 23, 2026
)
The harness-custom-jwt E2E (added in #1609) deployed the authorizer with
--allowed-audience, which validates the token's aud claim. But the test
authenticates via Cognito client_credentials (M2M), whose tokens carry a
client_id claim and no aud. Combined with the harness auto-fetch flow from
the main+preview merge (#1598, #1611) — where a registered managed OAuth
credential makes a default invoke auto-fetch a JWT instead of using SigV4 —
the service rejected every fetched token with 403 'missing required audience
claim', which didn't match the test's expected client-side rejection.
Switch the authorizer to --allowed-clients (the claim Cognito M2M tokens
actually carry), assert AllowedClients in the deploy template check, and
reframe the invoke tests to the real post-merge behavior: a default invoke
auto-fetches a JWT and is accepted, and the bearer-token invoke returns
exitCode 0. Test-only change; no shippable CLI behavior changes.
Closes#1623
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/mPR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tejaskash@agentcore-cli-automation@avi-alpert
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
feat(fetch): support harness in fetch access (CLI + TUI) by tejaskash · Pull Request #1611 · aws/agentcore-cli · GitHub
Skip to content

feat(fetch): support harness in fetch access (CLI + TUI) - #1611

Merged
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness
Jun 23, 2026
Merged

feat(fetch): support harness in fetch access (CLI + TUI)#1611
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Summary

Adds harness as a resource type for fetch access, so users can retrieve a CUSTOM_JWT bearer token for a deployed harness — both from the CLI (fetch access --type harness --name <name>) and the interactive TUI picker. Builds on the existing fetchHarnessToken operation (already used by invoke auto-fetch); this exposes it through the fetch command surface.

What changed

CLI

  • commands/fetch/types.tsFetchResourceType += 'harness'
  • commands/fetch/action.tshandleFetchHarnessAccess dispatch; the agent and harness handlers now share one fetchTokenAccess helper (they were near-identical)
  • commands/fetch/command.tsx--type / --name / description help text cover harness

TUI

  • operations/fetch-access/list-harnesses.tsnewlistHarnesses (project registry ∩ deployed-state, reads each harness.json for authorizerType); mirrors listAgents
  • operations/fetch-access/{types,index}.tsHarnessInfo type + exports
  • tui/screens/fetch-access/useFetchAccessFlow.ts — loads harnesses alongside gateways/agents; routes harness fetch through fetchHarnessToken
  • tui/screens/fetch-access/FetchAccessScreen.tsx — labels the harness resource type

Testing

Unit: 48 passing across fetch-access, including 6 new harness cases (3 CLI action, 3 TUI flow).

End-to-end against real AWS (account 346532552948 / us-west-2):

  1. Deployed a CUSTOM_JWT harness backed by a Cognito user pool, with the OAuth credential stored in Bedrock AgentCore Identity (create-oauth2-credential-provider).
  2. fetch access --type harness --name <name>success: true, returned a valid Cognito-issued JWT (verified claims: correct issuer, client_id, scope=agentcore/invoke, token_use=access).
  3. TUI fetch flow → harness appears in the picker as Harness [JWT], selecting it fetches and displays the same valid token.
  4. Verified for both a TUI-created harness and a CLI-created harness.

Notes

  • An AWS_IAM harness has no token to fetch — it surfaces the existing "use SigV4" guidance (same UX as the agent path). Token fetch applies only to CUSTOM_JWT harnesses with a managed OAuth credential.
  • listHarnesses reads each harness.json for authorizerType (the project registry entry only carries name/path).

Adds 'harness' as a resource type for fetch access, fetching a CUSTOM_JWT
bearer token for a deployed harness via the existing fetchHarnessToken
operation.
CLI:
- types: FetchResourceType += 'harness'
- action: handleFetchHarnessAccess dispatch; agent + harness share one
fetchTokenAccess helper
- command: help text covers harness
TUI:
- new listHarnesses operation (project registry ∩ deployed-state, reads each
harness.json for authorizerType)
- useFetchAccessFlow loads harnesses alongside gateways/agents and routes the
harness fetch through fetchHarnessToken
- FetchAccessScreen labels the harness resource type
Verified end-to-end against real AWS (us-west-2): deployed a CUSTOM_JWT harness
backed by Cognito with the OAuth credential stored in AgentCore Identity, then
fetched a valid bearer token via both 'fetch access --type harness' and the TUI
picker. Unit tests: 48 passing across fetch-access (incl. 6 new harness cases).
@tejaskash
tejaskash requested a review from a teamJune 22, 2026 21:24
@github-actionsgithub-actionsBot added the size/m PR size: M label Jun 22, 2026
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1611-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-automationagentcore-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.

Nice cleanup factoring fetchTokenAccess out of the agent and harness paths. A couple of real issues to address before merge — see inline comments. The main one: --identity-name is silently ignored for harnesses because fetchHarnessToken doesn't accept that option, even though the CLI advertises the flag for all token-bearing resources.


One additional note (not file in this PR, so flagging here):

Telemetry — ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']) and backs the fetch.accessresource_type attribute (see command-run.ts:173). Adding harness means that enum needs 'harness' for any future emission to be valid.

Separately, I couldn't find any actual cli.command_run emission for fetch.access — the schema entry exists but commands/fetch/command.tsx doesn't wrap the handler with withCommandRunTelemetry. That's a pre-existing gap, but per src/cli/telemetry/README.md adding telemetry to new features is expected. Worth wiring up while you're here so the new harness path doesn't go unobserved.

Comment threadsrc/cli/commands/fetch/action.ts
Comment threadsrc/cli/operations/fetch-access/list-harnesses.ts Outdated
Comment threadsrc/cli/operations/fetch-access/types.ts Outdated
@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@github-actions

github-actionsBot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

StatusCategoryPercentageCovered / Total
🔵Lines37.03%13550 / 36585
🔵Statements36.3%14406 / 39678
🔵Functions31.68%2326 / 7341
🔵Branches30.8%8927 / 28983
Generated in workflow #3765 for commit d0c3f75 by the Vitest Coverage Report Action

- fetchHarnessToken: accept identityName and forward as credentialName, so
'fetch access --type harness --identity-name X' is honored instead of
silently using the default <name>-oauth (mirrors fetchRuntimeToken).
- listHarnesses: drop the silent AWS_IAM fallback on readHarnessSpec failure;
let the error propagate so a corrupt/missing harness.json for a deployed
harness surfaces instead of masking a CUSTOM_JWT harness as AWS_IAM.
- HarnessInfo.authType: type as RuntimeAuthorizerType (was string) to match
AgentInfo and get the TUI auth-type branches type-checked.
- tests: replace the objectContaining({}) matcher with exact-options
assertions and add a case proving --identity-name/--target are forwarded.
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
tejaskash added a commit that referenced this pull request Jun 22, 2026
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-cli-automation

Copy link
Copy Markdown

Looks good to merge from my pass. The three inline issues from the previous review (--identity-name silently dropped for harnesses, the silent AWS_IAM fallback in listHarnesses, and the weak authType: string typing) all landed cleanly in e3be685 with tests to back the identityName forwarding.

The only outstanding item is the telemetry note from the previous review summary — it wasn't addressed and isn't a code-change blocker in this PR, but worth tracking:

  • ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']); if/when fetch.access actually emits, harness will fail schema validation.
  • commands/fetch/command.tsx doesn't wrap the action with withCommandRunTelemetry, so the new harness path (and the existing agent/gateway paths) go unobserved despite a FetchAccessAttrs schema entry already existing for it.

Both are pre-existing gaps that this PR widens rather than introduces. Happy to see them addressed in a follow-up if you'd rather keep this PR scoped.

@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@tejaskash

Copy link
Copy Markdown
ContributorAuthor

Addressed the telemetry note from the review body in 2ad7236:

  • ResourceType enum now includes 'harness' (src/cli/telemetry/schemas/common-shapes.ts) — so a fetch.access emission with resource_type=harness validates instead of being dropped.
  • Wired withCommandRunTelemetry into fetch access — the command previously emitted no cli.command_run at all. It now records resource_type. handleFetchAccess runs exactly once inside the wrapper; its string-error shape is adapted to the Result {success, error: Error} the telemetry layer expects (used only for exit_reason/error_name), while the original result drives output.

The three inline issues (--identity-name forwarding, AWS_IAM fallback, HarnessInfo.authType typing) were addressed earlier in e3be685. All review items are now resolved. 131 tests pass across telemetry + fetch + tui-fetch suites.

@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
Update docs/commands.md 'fetch access' section: --type now lists harness,
add a harness usage example, and note the CUSTOM_JWT token-fetch behavior
(managed OAuth credential, --identity-name override, AWS_IAM has no token).
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 23, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-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-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@tejaskash
tejaskash merged commit 12fd67a into mainJun 23, 2026
96 of 97 checks passed
@tejaskash
tejaskash deleted the feat/fetch-access-harness branch June 23, 2026 16:06
tejaskash added a commit that referenced this pull request Jun 23, 2026
…WT (#1609)
* test(e2e): add harness E2E coverage for lite_llm, attached tools, and CUSTOM_JWT
Extends the harness E2E surface with three real-AWS scenarios that the
provider matrix (bedrock/open_ai/gemini) doesn't cover:
- harness-litellm.test.ts — lite_llm provider routed at a Bedrock model
(no third-party key); deploy-only (skipInvoke) to prove the model config is
accepted by CloudFormation. Extends harness-e2e-helper with modelId/apiBase/
additionalParams support.
- harness-with-tool.test.ts — bedrock harness + agentcore_code_interpreter tool
via 'add tool'; proves tool wiring survives synth/deploy and the harness still
invokes.
- harness-custom-jwt.test.ts — harness with a CUSTOM_JWT authorizer backed by a
Cognito pool; asserts AuthorizerConfiguration in the CFN template, SigV4
rejection, and bearer-token invoke (mirrors byo-custom-jwt.test.ts).
All self-skip without AWS creds. The per-PR e2e workflow auto-runs changed
harness-*.test.ts files; the full suite shards everything.
* test(e2e): add fetch access --type harness step to custom-jwt e2e
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
aidandaly24 added a commit that referenced this pull request Jun 23, 2026
)
The harness-custom-jwt E2E (added in #1609) deployed the authorizer with
--allowed-audience, which validates the token's aud claim. But the test
authenticates via Cognito client_credentials (M2M), whose tokens carry a
client_id claim and no aud. Combined with the harness auto-fetch flow from
the main+preview merge (#1598, #1611) — where a registered managed OAuth
credential makes a default invoke auto-fetch a JWT instead of using SigV4 —
the service rejected every fetched token with 403 'missing required audience
claim', which didn't match the test's expected client-side rejection.
Switch the authorizer to --allowed-clients (the claim Cognito M2M tokens
actually carry), assert AllowedClients in the deploy template check, and
reframe the invoke tests to the real post-merge behavior: a default invoke
auto-fetches a JWT and is accepted, and the bearer-token invoke returns
exitCode 0. Test-only change; no shippable CLI behavior changes.
Closes#1623
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/mPR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tejaskash@agentcore-cli-automation@avi-alpert
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(fetch): support harness in fetch access (CLI + TUI) by tejaskash · Pull Request #1611 · aws/agentcore-cli · GitHub
Skip to content

feat(fetch): support harness in fetch access (CLI + TUI) - #1611

Merged
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness
Jun 23, 2026
Merged

feat(fetch): support harness in fetch access (CLI + TUI)#1611
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Summary

Adds harness as a resource type for fetch access, so users can retrieve a CUSTOM_JWT bearer token for a deployed harness — both from the CLI (fetch access --type harness --name <name>) and the interactive TUI picker. Builds on the existing fetchHarnessToken operation (already used by invoke auto-fetch); this exposes it through the fetch command surface.

What changed

CLI

  • commands/fetch/types.tsFetchResourceType += 'harness'
  • commands/fetch/action.tshandleFetchHarnessAccess dispatch; the agent and harness handlers now share one fetchTokenAccess helper (they were near-identical)
  • commands/fetch/command.tsx--type / --name / description help text cover harness

TUI

  • operations/fetch-access/list-harnesses.tsnewlistHarnesses (project registry ∩ deployed-state, reads each harness.json for authorizerType); mirrors listAgents
  • operations/fetch-access/{types,index}.tsHarnessInfo type + exports
  • tui/screens/fetch-access/useFetchAccessFlow.ts — loads harnesses alongside gateways/agents; routes harness fetch through fetchHarnessToken
  • tui/screens/fetch-access/FetchAccessScreen.tsx — labels the harness resource type

Testing

Unit: 48 passing across fetch-access, including 6 new harness cases (3 CLI action, 3 TUI flow).

End-to-end against real AWS (account 346532552948 / us-west-2):

  1. Deployed a CUSTOM_JWT harness backed by a Cognito user pool, with the OAuth credential stored in Bedrock AgentCore Identity (create-oauth2-credential-provider).
  2. fetch access --type harness --name <name>success: true, returned a valid Cognito-issued JWT (verified claims: correct issuer, client_id, scope=agentcore/invoke, token_use=access).
  3. TUI fetch flow → harness appears in the picker as Harness [JWT], selecting it fetches and displays the same valid token.
  4. Verified for both a TUI-created harness and a CLI-created harness.

Notes

  • An AWS_IAM harness has no token to fetch — it surfaces the existing "use SigV4" guidance (same UX as the agent path). Token fetch applies only to CUSTOM_JWT harnesses with a managed OAuth credential.
  • listHarnesses reads each harness.json for authorizerType (the project registry entry only carries name/path).

Adds 'harness' as a resource type for fetch access, fetching a CUSTOM_JWT
bearer token for a deployed harness via the existing fetchHarnessToken
operation.
CLI:
- types: FetchResourceType += 'harness'
- action: handleFetchHarnessAccess dispatch; agent + harness share one
fetchTokenAccess helper
- command: help text covers harness
TUI:
- new listHarnesses operation (project registry ∩ deployed-state, reads each
harness.json for authorizerType)
- useFetchAccessFlow loads harnesses alongside gateways/agents and routes the
harness fetch through fetchHarnessToken
- FetchAccessScreen labels the harness resource type
Verified end-to-end against real AWS (us-west-2): deployed a CUSTOM_JWT harness
backed by Cognito with the OAuth credential stored in AgentCore Identity, then
fetched a valid bearer token via both 'fetch access --type harness' and the TUI
picker. Unit tests: 48 passing across fetch-access (incl. 6 new harness cases).
@tejaskash
tejaskash requested a review from a teamJune 22, 2026 21:24
@github-actionsgithub-actionsBot added the size/m PR size: M label Jun 22, 2026
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1611-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-automationagentcore-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.

Nice cleanup factoring fetchTokenAccess out of the agent and harness paths. A couple of real issues to address before merge — see inline comments. The main one: --identity-name is silently ignored for harnesses because fetchHarnessToken doesn't accept that option, even though the CLI advertises the flag for all token-bearing resources.


One additional note (not file in this PR, so flagging here):

Telemetry — ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']) and backs the fetch.accessresource_type attribute (see command-run.ts:173). Adding harness means that enum needs 'harness' for any future emission to be valid.

Separately, I couldn't find any actual cli.command_run emission for fetch.access — the schema entry exists but commands/fetch/command.tsx doesn't wrap the handler with withCommandRunTelemetry. That's a pre-existing gap, but per src/cli/telemetry/README.md adding telemetry to new features is expected. Worth wiring up while you're here so the new harness path doesn't go unobserved.

Comment threadsrc/cli/commands/fetch/action.ts
Comment threadsrc/cli/operations/fetch-access/list-harnesses.ts Outdated
Comment threadsrc/cli/operations/fetch-access/types.ts Outdated
@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@github-actions

github-actionsBot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

StatusCategoryPercentageCovered / Total
🔵Lines37.03%13550 / 36585
🔵Statements36.3%14406 / 39678
🔵Functions31.68%2326 / 7341
🔵Branches30.8%8927 / 28983
Generated in workflow #3765 for commit d0c3f75 by the Vitest Coverage Report Action

- fetchHarnessToken: accept identityName and forward as credentialName, so
'fetch access --type harness --identity-name X' is honored instead of
silently using the default <name>-oauth (mirrors fetchRuntimeToken).
- listHarnesses: drop the silent AWS_IAM fallback on readHarnessSpec failure;
let the error propagate so a corrupt/missing harness.json for a deployed
harness surfaces instead of masking a CUSTOM_JWT harness as AWS_IAM.
- HarnessInfo.authType: type as RuntimeAuthorizerType (was string) to match
AgentInfo and get the TUI auth-type branches type-checked.
- tests: replace the objectContaining({}) matcher with exact-options
assertions and add a case proving --identity-name/--target are forwarded.
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
tejaskash added a commit that referenced this pull request Jun 22, 2026
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-cli-automation

Copy link
Copy Markdown

Looks good to merge from my pass. The three inline issues from the previous review (--identity-name silently dropped for harnesses, the silent AWS_IAM fallback in listHarnesses, and the weak authType: string typing) all landed cleanly in e3be685 with tests to back the identityName forwarding.

The only outstanding item is the telemetry note from the previous review summary — it wasn't addressed and isn't a code-change blocker in this PR, but worth tracking:

  • ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']); if/when fetch.access actually emits, harness will fail schema validation.
  • commands/fetch/command.tsx doesn't wrap the action with withCommandRunTelemetry, so the new harness path (and the existing agent/gateway paths) go unobserved despite a FetchAccessAttrs schema entry already existing for it.

Both are pre-existing gaps that this PR widens rather than introduces. Happy to see them addressed in a follow-up if you'd rather keep this PR scoped.

@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@tejaskash

Copy link
Copy Markdown
ContributorAuthor

Addressed the telemetry note from the review body in 2ad7236:

  • ResourceType enum now includes 'harness' (src/cli/telemetry/schemas/common-shapes.ts) — so a fetch.access emission with resource_type=harness validates instead of being dropped.
  • Wired withCommandRunTelemetry into fetch access — the command previously emitted no cli.command_run at all. It now records resource_type. handleFetchAccess runs exactly once inside the wrapper; its string-error shape is adapted to the Result {success, error: Error} the telemetry layer expects (used only for exit_reason/error_name), while the original result drives output.

The three inline issues (--identity-name forwarding, AWS_IAM fallback, HarnessInfo.authType typing) were addressed earlier in e3be685. All review items are now resolved. 131 tests pass across telemetry + fetch + tui-fetch suites.

@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
Update docs/commands.md 'fetch access' section: --type now lists harness,
add a harness usage example, and note the CUSTOM_JWT token-fetch behavior
(managed OAuth credential, --identity-name override, AWS_IAM has no token).
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 23, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-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-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@tejaskash
tejaskash merged commit 12fd67a into mainJun 23, 2026
96 of 97 checks passed
@tejaskash
tejaskash deleted the feat/fetch-access-harness branch June 23, 2026 16:06
tejaskash added a commit that referenced this pull request Jun 23, 2026
…WT (#1609)
* test(e2e): add harness E2E coverage for lite_llm, attached tools, and CUSTOM_JWT
Extends the harness E2E surface with three real-AWS scenarios that the
provider matrix (bedrock/open_ai/gemini) doesn't cover:
- harness-litellm.test.ts — lite_llm provider routed at a Bedrock model
(no third-party key); deploy-only (skipInvoke) to prove the model config is
accepted by CloudFormation. Extends harness-e2e-helper with modelId/apiBase/
additionalParams support.
- harness-with-tool.test.ts — bedrock harness + agentcore_code_interpreter tool
via 'add tool'; proves tool wiring survives synth/deploy and the harness still
invokes.
- harness-custom-jwt.test.ts — harness with a CUSTOM_JWT authorizer backed by a
Cognito pool; asserts AuthorizerConfiguration in the CFN template, SigV4
rejection, and bearer-token invoke (mirrors byo-custom-jwt.test.ts).
All self-skip without AWS creds. The per-PR e2e workflow auto-runs changed
harness-*.test.ts files; the full suite shards everything.
* test(e2e): add fetch access --type harness step to custom-jwt e2e
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
aidandaly24 added a commit that referenced this pull request Jun 23, 2026
)
The harness-custom-jwt E2E (added in #1609) deployed the authorizer with
--allowed-audience, which validates the token's aud claim. But the test
authenticates via Cognito client_credentials (M2M), whose tokens carry a
client_id claim and no aud. Combined with the harness auto-fetch flow from
the main+preview merge (#1598, #1611) — where a registered managed OAuth
credential makes a default invoke auto-fetch a JWT instead of using SigV4 —
the service rejected every fetched token with 403 'missing required audience
claim', which didn't match the test's expected client-side rejection.
Switch the authorizer to --allowed-clients (the claim Cognito M2M tokens
actually carry), assert AllowedClients in the deploy template check, and
reframe the invoke tests to the real post-merge behavior: a default invoke
auto-fetches a JWT and is accepted, and the bearer-token invoke returns
exitCode 0. Test-only change; no shippable CLI behavior changes.
Closes#1623
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/mPR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tejaskash@agentcore-cli-automation@avi-alpert
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(fetch): support harness in fetch access (CLI + TUI) by tejaskash · Pull Request #1611 · aws/agentcore-cli · GitHub
Skip to content

feat(fetch): support harness in fetch access (CLI + TUI) - #1611

Merged
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness
Jun 23, 2026
Merged

feat(fetch): support harness in fetch access (CLI + TUI)#1611
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Summary

Adds harness as a resource type for fetch access, so users can retrieve a CUSTOM_JWT bearer token for a deployed harness — both from the CLI (fetch access --type harness --name <name>) and the interactive TUI picker. Builds on the existing fetchHarnessToken operation (already used by invoke auto-fetch); this exposes it through the fetch command surface.

What changed

CLI

  • commands/fetch/types.tsFetchResourceType += 'harness'
  • commands/fetch/action.tshandleFetchHarnessAccess dispatch; the agent and harness handlers now share one fetchTokenAccess helper (they were near-identical)
  • commands/fetch/command.tsx--type / --name / description help text cover harness

TUI

  • operations/fetch-access/list-harnesses.tsnewlistHarnesses (project registry ∩ deployed-state, reads each harness.json for authorizerType); mirrors listAgents
  • operations/fetch-access/{types,index}.tsHarnessInfo type + exports
  • tui/screens/fetch-access/useFetchAccessFlow.ts — loads harnesses alongside gateways/agents; routes harness fetch through fetchHarnessToken
  • tui/screens/fetch-access/FetchAccessScreen.tsx — labels the harness resource type

Testing

Unit: 48 passing across fetch-access, including 6 new harness cases (3 CLI action, 3 TUI flow).

End-to-end against real AWS (account 346532552948 / us-west-2):

  1. Deployed a CUSTOM_JWT harness backed by a Cognito user pool, with the OAuth credential stored in Bedrock AgentCore Identity (create-oauth2-credential-provider).
  2. fetch access --type harness --name <name>success: true, returned a valid Cognito-issued JWT (verified claims: correct issuer, client_id, scope=agentcore/invoke, token_use=access).
  3. TUI fetch flow → harness appears in the picker as Harness [JWT], selecting it fetches and displays the same valid token.
  4. Verified for both a TUI-created harness and a CLI-created harness.

Notes

  • An AWS_IAM harness has no token to fetch — it surfaces the existing "use SigV4" guidance (same UX as the agent path). Token fetch applies only to CUSTOM_JWT harnesses with a managed OAuth credential.
  • listHarnesses reads each harness.json for authorizerType (the project registry entry only carries name/path).

Adds 'harness' as a resource type for fetch access, fetching a CUSTOM_JWT
bearer token for a deployed harness via the existing fetchHarnessToken
operation.
CLI:
- types: FetchResourceType += 'harness'
- action: handleFetchHarnessAccess dispatch; agent + harness share one
fetchTokenAccess helper
- command: help text covers harness
TUI:
- new listHarnesses operation (project registry ∩ deployed-state, reads each
harness.json for authorizerType)
- useFetchAccessFlow loads harnesses alongside gateways/agents and routes the
harness fetch through fetchHarnessToken
- FetchAccessScreen labels the harness resource type
Verified end-to-end against real AWS (us-west-2): deployed a CUSTOM_JWT harness
backed by Cognito with the OAuth credential stored in AgentCore Identity, then
fetched a valid bearer token via both 'fetch access --type harness' and the TUI
picker. Unit tests: 48 passing across fetch-access (incl. 6 new harness cases).
@tejaskash
tejaskash requested a review from a teamJune 22, 2026 21:24
@github-actionsgithub-actionsBot added the size/m PR size: M label Jun 22, 2026
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1611-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-automationagentcore-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.

Nice cleanup factoring fetchTokenAccess out of the agent and harness paths. A couple of real issues to address before merge — see inline comments. The main one: --identity-name is silently ignored for harnesses because fetchHarnessToken doesn't accept that option, even though the CLI advertises the flag for all token-bearing resources.


One additional note (not file in this PR, so flagging here):

Telemetry — ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']) and backs the fetch.accessresource_type attribute (see command-run.ts:173). Adding harness means that enum needs 'harness' for any future emission to be valid.

Separately, I couldn't find any actual cli.command_run emission for fetch.access — the schema entry exists but commands/fetch/command.tsx doesn't wrap the handler with withCommandRunTelemetry. That's a pre-existing gap, but per src/cli/telemetry/README.md adding telemetry to new features is expected. Worth wiring up while you're here so the new harness path doesn't go unobserved.

Comment threadsrc/cli/commands/fetch/action.ts
Comment threadsrc/cli/operations/fetch-access/list-harnesses.ts Outdated
Comment threadsrc/cli/operations/fetch-access/types.ts Outdated
@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@github-actions

github-actionsBot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

StatusCategoryPercentageCovered / Total
🔵Lines37.03%13550 / 36585
🔵Statements36.3%14406 / 39678
🔵Functions31.68%2326 / 7341
🔵Branches30.8%8927 / 28983
Generated in workflow #3765 for commit d0c3f75 by the Vitest Coverage Report Action

- fetchHarnessToken: accept identityName and forward as credentialName, so
'fetch access --type harness --identity-name X' is honored instead of
silently using the default <name>-oauth (mirrors fetchRuntimeToken).
- listHarnesses: drop the silent AWS_IAM fallback on readHarnessSpec failure;
let the error propagate so a corrupt/missing harness.json for a deployed
harness surfaces instead of masking a CUSTOM_JWT harness as AWS_IAM.
- HarnessInfo.authType: type as RuntimeAuthorizerType (was string) to match
AgentInfo and get the TUI auth-type branches type-checked.
- tests: replace the objectContaining({}) matcher with exact-options
assertions and add a case proving --identity-name/--target are forwarded.
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
tejaskash added a commit that referenced this pull request Jun 22, 2026
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-cli-automation

Copy link
Copy Markdown

Looks good to merge from my pass. The three inline issues from the previous review (--identity-name silently dropped for harnesses, the silent AWS_IAM fallback in listHarnesses, and the weak authType: string typing) all landed cleanly in e3be685 with tests to back the identityName forwarding.

The only outstanding item is the telemetry note from the previous review summary — it wasn't addressed and isn't a code-change blocker in this PR, but worth tracking:

  • ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']); if/when fetch.access actually emits, harness will fail schema validation.
  • commands/fetch/command.tsx doesn't wrap the action with withCommandRunTelemetry, so the new harness path (and the existing agent/gateway paths) go unobserved despite a FetchAccessAttrs schema entry already existing for it.

Both are pre-existing gaps that this PR widens rather than introduces. Happy to see them addressed in a follow-up if you'd rather keep this PR scoped.

@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@tejaskash

Copy link
Copy Markdown
ContributorAuthor

Addressed the telemetry note from the review body in 2ad7236:

  • ResourceType enum now includes 'harness' (src/cli/telemetry/schemas/common-shapes.ts) — so a fetch.access emission with resource_type=harness validates instead of being dropped.
  • Wired withCommandRunTelemetry into fetch access — the command previously emitted no cli.command_run at all. It now records resource_type. handleFetchAccess runs exactly once inside the wrapper; its string-error shape is adapted to the Result {success, error: Error} the telemetry layer expects (used only for exit_reason/error_name), while the original result drives output.

The three inline issues (--identity-name forwarding, AWS_IAM fallback, HarnessInfo.authType typing) were addressed earlier in e3be685. All review items are now resolved. 131 tests pass across telemetry + fetch + tui-fetch suites.

@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
Update docs/commands.md 'fetch access' section: --type now lists harness,
add a harness usage example, and note the CUSTOM_JWT token-fetch behavior
(managed OAuth credential, --identity-name override, AWS_IAM has no token).
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 23, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-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-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@tejaskash
tejaskash merged commit 12fd67a into mainJun 23, 2026
96 of 97 checks passed
@tejaskash
tejaskash deleted the feat/fetch-access-harness branch June 23, 2026 16:06
tejaskash added a commit that referenced this pull request Jun 23, 2026
…WT (#1609)
* test(e2e): add harness E2E coverage for lite_llm, attached tools, and CUSTOM_JWT
Extends the harness E2E surface with three real-AWS scenarios that the
provider matrix (bedrock/open_ai/gemini) doesn't cover:
- harness-litellm.test.ts — lite_llm provider routed at a Bedrock model
(no third-party key); deploy-only (skipInvoke) to prove the model config is
accepted by CloudFormation. Extends harness-e2e-helper with modelId/apiBase/
additionalParams support.
- harness-with-tool.test.ts — bedrock harness + agentcore_code_interpreter tool
via 'add tool'; proves tool wiring survives synth/deploy and the harness still
invokes.
- harness-custom-jwt.test.ts — harness with a CUSTOM_JWT authorizer backed by a
Cognito pool; asserts AuthorizerConfiguration in the CFN template, SigV4
rejection, and bearer-token invoke (mirrors byo-custom-jwt.test.ts).
All self-skip without AWS creds. The per-PR e2e workflow auto-runs changed
harness-*.test.ts files; the full suite shards everything.
* test(e2e): add fetch access --type harness step to custom-jwt e2e
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
aidandaly24 added a commit that referenced this pull request Jun 23, 2026
)
The harness-custom-jwt E2E (added in #1609) deployed the authorizer with
--allowed-audience, which validates the token's aud claim. But the test
authenticates via Cognito client_credentials (M2M), whose tokens carry a
client_id claim and no aud. Combined with the harness auto-fetch flow from
the main+preview merge (#1598, #1611) — where a registered managed OAuth
credential makes a default invoke auto-fetch a JWT instead of using SigV4 —
the service rejected every fetched token with 403 'missing required audience
claim', which didn't match the test's expected client-side rejection.
Switch the authorizer to --allowed-clients (the claim Cognito M2M tokens
actually carry), assert AllowedClients in the deploy template check, and
reframe the invoke tests to the real post-merge behavior: a default invoke
auto-fetches a JWT and is accepted, and the bearer-token invoke returns
exitCode 0. Test-only change; no shippable CLI behavior changes.
Closes#1623
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/mPR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tejaskash@agentcore-cli-automation@avi-alpert
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' feat(fetch): support harness in fetch access (CLI + TUI) by tejaskash · Pull Request #1611 · aws/agentcore-cli · GitHub
Skip to content

feat(fetch): support harness in fetch access (CLI + TUI) - #1611

Merged
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness
Jun 23, 2026
Merged

feat(fetch): support harness in fetch access (CLI + TUI)#1611
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Summary

Adds harness as a resource type for fetch access, so users can retrieve a CUSTOM_JWT bearer token for a deployed harness — both from the CLI (fetch access --type harness --name <name>) and the interactive TUI picker. Builds on the existing fetchHarnessToken operation (already used by invoke auto-fetch); this exposes it through the fetch command surface.

What changed

CLI

  • commands/fetch/types.tsFetchResourceType += 'harness'
  • commands/fetch/action.tshandleFetchHarnessAccess dispatch; the agent and harness handlers now share one fetchTokenAccess helper (they were near-identical)
  • commands/fetch/command.tsx--type / --name / description help text cover harness

TUI

  • operations/fetch-access/list-harnesses.tsnewlistHarnesses (project registry ∩ deployed-state, reads each harness.json for authorizerType); mirrors listAgents
  • operations/fetch-access/{types,index}.tsHarnessInfo type + exports
  • tui/screens/fetch-access/useFetchAccessFlow.ts — loads harnesses alongside gateways/agents; routes harness fetch through fetchHarnessToken
  • tui/screens/fetch-access/FetchAccessScreen.tsx — labels the harness resource type

Testing

Unit: 48 passing across fetch-access, including 6 new harness cases (3 CLI action, 3 TUI flow).

End-to-end against real AWS (account 346532552948 / us-west-2):

  1. Deployed a CUSTOM_JWT harness backed by a Cognito user pool, with the OAuth credential stored in Bedrock AgentCore Identity (create-oauth2-credential-provider).
  2. fetch access --type harness --name <name>success: true, returned a valid Cognito-issued JWT (verified claims: correct issuer, client_id, scope=agentcore/invoke, token_use=access).
  3. TUI fetch flow → harness appears in the picker as Harness [JWT], selecting it fetches and displays the same valid token.
  4. Verified for both a TUI-created harness and a CLI-created harness.

Notes

  • An AWS_IAM harness has no token to fetch — it surfaces the existing "use SigV4" guidance (same UX as the agent path). Token fetch applies only to CUSTOM_JWT harnesses with a managed OAuth credential.
  • listHarnesses reads each harness.json for authorizerType (the project registry entry only carries name/path).

Adds 'harness' as a resource type for fetch access, fetching a CUSTOM_JWT
bearer token for a deployed harness via the existing fetchHarnessToken
operation.
CLI:
- types: FetchResourceType += 'harness'
- action: handleFetchHarnessAccess dispatch; agent + harness share one
fetchTokenAccess helper
- command: help text covers harness
TUI:
- new listHarnesses operation (project registry ∩ deployed-state, reads each
harness.json for authorizerType)
- useFetchAccessFlow loads harnesses alongside gateways/agents and routes the
harness fetch through fetchHarnessToken
- FetchAccessScreen labels the harness resource type
Verified end-to-end against real AWS (us-west-2): deployed a CUSTOM_JWT harness
backed by Cognito with the OAuth credential stored in AgentCore Identity, then
fetched a valid bearer token via both 'fetch access --type harness' and the TUI
picker. Unit tests: 48 passing across fetch-access (incl. 6 new harness cases).
@tejaskash
tejaskash requested a review from a teamJune 22, 2026 21:24
@github-actionsgithub-actionsBot added the size/m PR size: M label Jun 22, 2026
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1611-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-automationagentcore-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.

Nice cleanup factoring fetchTokenAccess out of the agent and harness paths. A couple of real issues to address before merge — see inline comments. The main one: --identity-name is silently ignored for harnesses because fetchHarnessToken doesn't accept that option, even though the CLI advertises the flag for all token-bearing resources.


One additional note (not file in this PR, so flagging here):

Telemetry — ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']) and backs the fetch.accessresource_type attribute (see command-run.ts:173). Adding harness means that enum needs 'harness' for any future emission to be valid.

Separately, I couldn't find any actual cli.command_run emission for fetch.access — the schema entry exists but commands/fetch/command.tsx doesn't wrap the handler with withCommandRunTelemetry. That's a pre-existing gap, but per src/cli/telemetry/README.md adding telemetry to new features is expected. Worth wiring up while you're here so the new harness path doesn't go unobserved.

Comment threadsrc/cli/commands/fetch/action.ts
Comment threadsrc/cli/operations/fetch-access/list-harnesses.ts Outdated
Comment threadsrc/cli/operations/fetch-access/types.ts Outdated
@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@github-actions

github-actionsBot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

StatusCategoryPercentageCovered / Total
🔵Lines37.03%13550 / 36585
🔵Statements36.3%14406 / 39678
🔵Functions31.68%2326 / 7341
🔵Branches30.8%8927 / 28983
Generated in workflow #3765 for commit d0c3f75 by the Vitest Coverage Report Action

- fetchHarnessToken: accept identityName and forward as credentialName, so
'fetch access --type harness --identity-name X' is honored instead of
silently using the default <name>-oauth (mirrors fetchRuntimeToken).
- listHarnesses: drop the silent AWS_IAM fallback on readHarnessSpec failure;
let the error propagate so a corrupt/missing harness.json for a deployed
harness surfaces instead of masking a CUSTOM_JWT harness as AWS_IAM.
- HarnessInfo.authType: type as RuntimeAuthorizerType (was string) to match
AgentInfo and get the TUI auth-type branches type-checked.
- tests: replace the objectContaining({}) matcher with exact-options
assertions and add a case proving --identity-name/--target are forwarded.
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
tejaskash added a commit that referenced this pull request Jun 22, 2026
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-cli-automation

Copy link
Copy Markdown

Looks good to merge from my pass. The three inline issues from the previous review (--identity-name silently dropped for harnesses, the silent AWS_IAM fallback in listHarnesses, and the weak authType: string typing) all landed cleanly in e3be685 with tests to back the identityName forwarding.

The only outstanding item is the telemetry note from the previous review summary — it wasn't addressed and isn't a code-change blocker in this PR, but worth tracking:

  • ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']); if/when fetch.access actually emits, harness will fail schema validation.
  • commands/fetch/command.tsx doesn't wrap the action with withCommandRunTelemetry, so the new harness path (and the existing agent/gateway paths) go unobserved despite a FetchAccessAttrs schema entry already existing for it.

Both are pre-existing gaps that this PR widens rather than introduces. Happy to see them addressed in a follow-up if you'd rather keep this PR scoped.

@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@tejaskash

Copy link
Copy Markdown
ContributorAuthor

Addressed the telemetry note from the review body in 2ad7236:

  • ResourceType enum now includes 'harness' (src/cli/telemetry/schemas/common-shapes.ts) — so a fetch.access emission with resource_type=harness validates instead of being dropped.
  • Wired withCommandRunTelemetry into fetch access — the command previously emitted no cli.command_run at all. It now records resource_type. handleFetchAccess runs exactly once inside the wrapper; its string-error shape is adapted to the Result {success, error: Error} the telemetry layer expects (used only for exit_reason/error_name), while the original result drives output.

The three inline issues (--identity-name forwarding, AWS_IAM fallback, HarnessInfo.authType typing) were addressed earlier in e3be685. All review items are now resolved. 131 tests pass across telemetry + fetch + tui-fetch suites.

@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
Update docs/commands.md 'fetch access' section: --type now lists harness,
add a harness usage example, and note the CUSTOM_JWT token-fetch behavior
(managed OAuth credential, --identity-name override, AWS_IAM has no token).
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 23, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-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-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@tejaskash
tejaskash merged commit 12fd67a into mainJun 23, 2026
96 of 97 checks passed
@tejaskash
tejaskash deleted the feat/fetch-access-harness branch June 23, 2026 16:06
tejaskash added a commit that referenced this pull request Jun 23, 2026
…WT (#1609)
* test(e2e): add harness E2E coverage for lite_llm, attached tools, and CUSTOM_JWT
Extends the harness E2E surface with three real-AWS scenarios that the
provider matrix (bedrock/open_ai/gemini) doesn't cover:
- harness-litellm.test.ts — lite_llm provider routed at a Bedrock model
(no third-party key); deploy-only (skipInvoke) to prove the model config is
accepted by CloudFormation. Extends harness-e2e-helper with modelId/apiBase/
additionalParams support.
- harness-with-tool.test.ts — bedrock harness + agentcore_code_interpreter tool
via 'add tool'; proves tool wiring survives synth/deploy and the harness still
invokes.
- harness-custom-jwt.test.ts — harness with a CUSTOM_JWT authorizer backed by a
Cognito pool; asserts AuthorizerConfiguration in the CFN template, SigV4
rejection, and bearer-token invoke (mirrors byo-custom-jwt.test.ts).
All self-skip without AWS creds. The per-PR e2e workflow auto-runs changed
harness-*.test.ts files; the full suite shards everything.
* test(e2e): add fetch access --type harness step to custom-jwt e2e
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
aidandaly24 added a commit that referenced this pull request Jun 23, 2026
)
The harness-custom-jwt E2E (added in #1609) deployed the authorizer with
--allowed-audience, which validates the token's aud claim. But the test
authenticates via Cognito client_credentials (M2M), whose tokens carry a
client_id claim and no aud. Combined with the harness auto-fetch flow from
the main+preview merge (#1598, #1611) — where a registered managed OAuth
credential makes a default invoke auto-fetch a JWT instead of using SigV4 —
the service rejected every fetched token with 403 'missing required audience
claim', which didn't match the test's expected client-side rejection.
Switch the authorizer to --allowed-clients (the claim Cognito M2M tokens
actually carry), assert AllowedClients in the deploy template check, and
reframe the invoke tests to the real post-merge behavior: a default invoke
auto-fetches a JWT and is accepted, and the bearer-token invoke returns
exitCode 0. Test-only change; no shippable CLI behavior changes.
Closes#1623
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/mPR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tejaskash@agentcore-cli-automation@avi-alpert
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(fetch): support harness in fetch access (CLI + TUI) by tejaskash · Pull Request #1611 · aws/agentcore-cli · GitHub
Skip to content

feat(fetch): support harness in fetch access (CLI + TUI) - #1611

Merged
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness
Jun 23, 2026
Merged

feat(fetch): support harness in fetch access (CLI + TUI)#1611
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Summary

Adds harness as a resource type for fetch access, so users can retrieve a CUSTOM_JWT bearer token for a deployed harness — both from the CLI (fetch access --type harness --name <name>) and the interactive TUI picker. Builds on the existing fetchHarnessToken operation (already used by invoke auto-fetch); this exposes it through the fetch command surface.

What changed

CLI

  • commands/fetch/types.tsFetchResourceType += 'harness'
  • commands/fetch/action.tshandleFetchHarnessAccess dispatch; the agent and harness handlers now share one fetchTokenAccess helper (they were near-identical)
  • commands/fetch/command.tsx--type / --name / description help text cover harness

TUI

  • operations/fetch-access/list-harnesses.tsnewlistHarnesses (project registry ∩ deployed-state, reads each harness.json for authorizerType); mirrors listAgents
  • operations/fetch-access/{types,index}.tsHarnessInfo type + exports
  • tui/screens/fetch-access/useFetchAccessFlow.ts — loads harnesses alongside gateways/agents; routes harness fetch through fetchHarnessToken
  • tui/screens/fetch-access/FetchAccessScreen.tsx — labels the harness resource type

Testing

Unit: 48 passing across fetch-access, including 6 new harness cases (3 CLI action, 3 TUI flow).

End-to-end against real AWS (account 346532552948 / us-west-2):

  1. Deployed a CUSTOM_JWT harness backed by a Cognito user pool, with the OAuth credential stored in Bedrock AgentCore Identity (create-oauth2-credential-provider).
  2. fetch access --type harness --name <name>success: true, returned a valid Cognito-issued JWT (verified claims: correct issuer, client_id, scope=agentcore/invoke, token_use=access).
  3. TUI fetch flow → harness appears in the picker as Harness [JWT], selecting it fetches and displays the same valid token.
  4. Verified for both a TUI-created harness and a CLI-created harness.

Notes

  • An AWS_IAM harness has no token to fetch — it surfaces the existing "use SigV4" guidance (same UX as the agent path). Token fetch applies only to CUSTOM_JWT harnesses with a managed OAuth credential.
  • listHarnesses reads each harness.json for authorizerType (the project registry entry only carries name/path).

Adds 'harness' as a resource type for fetch access, fetching a CUSTOM_JWT
bearer token for a deployed harness via the existing fetchHarnessToken
operation.
CLI:
- types: FetchResourceType += 'harness'
- action: handleFetchHarnessAccess dispatch; agent + harness share one
fetchTokenAccess helper
- command: help text covers harness
TUI:
- new listHarnesses operation (project registry ∩ deployed-state, reads each
harness.json for authorizerType)
- useFetchAccessFlow loads harnesses alongside gateways/agents and routes the
harness fetch through fetchHarnessToken
- FetchAccessScreen labels the harness resource type
Verified end-to-end against real AWS (us-west-2): deployed a CUSTOM_JWT harness
backed by Cognito with the OAuth credential stored in AgentCore Identity, then
fetched a valid bearer token via both 'fetch access --type harness' and the TUI
picker. Unit tests: 48 passing across fetch-access (incl. 6 new harness cases).
@tejaskash
tejaskash requested a review from a teamJune 22, 2026 21:24
@github-actionsgithub-actionsBot added the size/m PR size: M label Jun 22, 2026
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1611-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-automationagentcore-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.

Nice cleanup factoring fetchTokenAccess out of the agent and harness paths. A couple of real issues to address before merge — see inline comments. The main one: --identity-name is silently ignored for harnesses because fetchHarnessToken doesn't accept that option, even though the CLI advertises the flag for all token-bearing resources.


One additional note (not file in this PR, so flagging here):

Telemetry — ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']) and backs the fetch.accessresource_type attribute (see command-run.ts:173). Adding harness means that enum needs 'harness' for any future emission to be valid.

Separately, I couldn't find any actual cli.command_run emission for fetch.access — the schema entry exists but commands/fetch/command.tsx doesn't wrap the handler with withCommandRunTelemetry. That's a pre-existing gap, but per src/cli/telemetry/README.md adding telemetry to new features is expected. Worth wiring up while you're here so the new harness path doesn't go unobserved.

Comment threadsrc/cli/commands/fetch/action.ts
Comment threadsrc/cli/operations/fetch-access/list-harnesses.ts Outdated
Comment threadsrc/cli/operations/fetch-access/types.ts Outdated
@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@github-actions

github-actionsBot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

StatusCategoryPercentageCovered / Total
🔵Lines37.03%13550 / 36585
🔵Statements36.3%14406 / 39678
🔵Functions31.68%2326 / 7341
🔵Branches30.8%8927 / 28983
Generated in workflow #3765 for commit d0c3f75 by the Vitest Coverage Report Action

- fetchHarnessToken: accept identityName and forward as credentialName, so
'fetch access --type harness --identity-name X' is honored instead of
silently using the default <name>-oauth (mirrors fetchRuntimeToken).
- listHarnesses: drop the silent AWS_IAM fallback on readHarnessSpec failure;
let the error propagate so a corrupt/missing harness.json for a deployed
harness surfaces instead of masking a CUSTOM_JWT harness as AWS_IAM.
- HarnessInfo.authType: type as RuntimeAuthorizerType (was string) to match
AgentInfo and get the TUI auth-type branches type-checked.
- tests: replace the objectContaining({}) matcher with exact-options
assertions and add a case proving --identity-name/--target are forwarded.
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
tejaskash added a commit that referenced this pull request Jun 22, 2026
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-cli-automation

Copy link
Copy Markdown

Looks good to merge from my pass. The three inline issues from the previous review (--identity-name silently dropped for harnesses, the silent AWS_IAM fallback in listHarnesses, and the weak authType: string typing) all landed cleanly in e3be685 with tests to back the identityName forwarding.

The only outstanding item is the telemetry note from the previous review summary — it wasn't addressed and isn't a code-change blocker in this PR, but worth tracking:

  • ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']); if/when fetch.access actually emits, harness will fail schema validation.
  • commands/fetch/command.tsx doesn't wrap the action with withCommandRunTelemetry, so the new harness path (and the existing agent/gateway paths) go unobserved despite a FetchAccessAttrs schema entry already existing for it.

Both are pre-existing gaps that this PR widens rather than introduces. Happy to see them addressed in a follow-up if you'd rather keep this PR scoped.

@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@tejaskash

Copy link
Copy Markdown
ContributorAuthor

Addressed the telemetry note from the review body in 2ad7236:

  • ResourceType enum now includes 'harness' (src/cli/telemetry/schemas/common-shapes.ts) — so a fetch.access emission with resource_type=harness validates instead of being dropped.
  • Wired withCommandRunTelemetry into fetch access — the command previously emitted no cli.command_run at all. It now records resource_type. handleFetchAccess runs exactly once inside the wrapper; its string-error shape is adapted to the Result {success, error: Error} the telemetry layer expects (used only for exit_reason/error_name), while the original result drives output.

The three inline issues (--identity-name forwarding, AWS_IAM fallback, HarnessInfo.authType typing) were addressed earlier in e3be685. All review items are now resolved. 131 tests pass across telemetry + fetch + tui-fetch suites.

@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
Update docs/commands.md 'fetch access' section: --type now lists harness,
add a harness usage example, and note the CUSTOM_JWT token-fetch behavior
(managed OAuth credential, --identity-name override, AWS_IAM has no token).
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 23, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-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-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@tejaskash
tejaskash merged commit 12fd67a into mainJun 23, 2026
96 of 97 checks passed
@tejaskash
tejaskash deleted the feat/fetch-access-harness branch June 23, 2026 16:06
tejaskash added a commit that referenced this pull request Jun 23, 2026
…WT (#1609)
* test(e2e): add harness E2E coverage for lite_llm, attached tools, and CUSTOM_JWT
Extends the harness E2E surface with three real-AWS scenarios that the
provider matrix (bedrock/open_ai/gemini) doesn't cover:
- harness-litellm.test.ts — lite_llm provider routed at a Bedrock model
(no third-party key); deploy-only (skipInvoke) to prove the model config is
accepted by CloudFormation. Extends harness-e2e-helper with modelId/apiBase/
additionalParams support.
- harness-with-tool.test.ts — bedrock harness + agentcore_code_interpreter tool
via 'add tool'; proves tool wiring survives synth/deploy and the harness still
invokes.
- harness-custom-jwt.test.ts — harness with a CUSTOM_JWT authorizer backed by a
Cognito pool; asserts AuthorizerConfiguration in the CFN template, SigV4
rejection, and bearer-token invoke (mirrors byo-custom-jwt.test.ts).
All self-skip without AWS creds. The per-PR e2e workflow auto-runs changed
harness-*.test.ts files; the full suite shards everything.
* test(e2e): add fetch access --type harness step to custom-jwt e2e
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
aidandaly24 added a commit that referenced this pull request Jun 23, 2026
)
The harness-custom-jwt E2E (added in #1609) deployed the authorizer with
--allowed-audience, which validates the token's aud claim. But the test
authenticates via Cognito client_credentials (M2M), whose tokens carry a
client_id claim and no aud. Combined with the harness auto-fetch flow from
the main+preview merge (#1598, #1611) — where a registered managed OAuth
credential makes a default invoke auto-fetch a JWT instead of using SigV4 —
the service rejected every fetched token with 403 'missing required audience
claim', which didn't match the test's expected client-side rejection.
Switch the authorizer to --allowed-clients (the claim Cognito M2M tokens
actually carry), assert AllowedClients in the deploy template check, and
reframe the invoke tests to the real post-merge behavior: a default invoke
auto-fetches a JWT and is accepted, and the bearer-token invoke returns
exitCode 0. Test-only change; no shippable CLI behavior changes.
Closes#1623
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/mPR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tejaskash@agentcore-cli-automation@avi-alpert
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(fetch): support harness in fetch access (CLI + TUI) by tejaskash · Pull Request #1611 · aws/agentcore-cli · GitHub
Skip to content

feat(fetch): support harness in fetch access (CLI + TUI) - #1611

Merged
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness
Jun 23, 2026
Merged

feat(fetch): support harness in fetch access (CLI + TUI)#1611
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Summary

Adds harness as a resource type for fetch access, so users can retrieve a CUSTOM_JWT bearer token for a deployed harness — both from the CLI (fetch access --type harness --name <name>) and the interactive TUI picker. Builds on the existing fetchHarnessToken operation (already used by invoke auto-fetch); this exposes it through the fetch command surface.

What changed

CLI

  • commands/fetch/types.tsFetchResourceType += 'harness'
  • commands/fetch/action.tshandleFetchHarnessAccess dispatch; the agent and harness handlers now share one fetchTokenAccess helper (they were near-identical)
  • commands/fetch/command.tsx--type / --name / description help text cover harness

TUI

  • operations/fetch-access/list-harnesses.tsnewlistHarnesses (project registry ∩ deployed-state, reads each harness.json for authorizerType); mirrors listAgents
  • operations/fetch-access/{types,index}.tsHarnessInfo type + exports
  • tui/screens/fetch-access/useFetchAccessFlow.ts — loads harnesses alongside gateways/agents; routes harness fetch through fetchHarnessToken
  • tui/screens/fetch-access/FetchAccessScreen.tsx — labels the harness resource type

Testing

Unit: 48 passing across fetch-access, including 6 new harness cases (3 CLI action, 3 TUI flow).

End-to-end against real AWS (account 346532552948 / us-west-2):

  1. Deployed a CUSTOM_JWT harness backed by a Cognito user pool, with the OAuth credential stored in Bedrock AgentCore Identity (create-oauth2-credential-provider).
  2. fetch access --type harness --name <name>success: true, returned a valid Cognito-issued JWT (verified claims: correct issuer, client_id, scope=agentcore/invoke, token_use=access).
  3. TUI fetch flow → harness appears in the picker as Harness [JWT], selecting it fetches and displays the same valid token.
  4. Verified for both a TUI-created harness and a CLI-created harness.

Notes

  • An AWS_IAM harness has no token to fetch — it surfaces the existing "use SigV4" guidance (same UX as the agent path). Token fetch applies only to CUSTOM_JWT harnesses with a managed OAuth credential.
  • listHarnesses reads each harness.json for authorizerType (the project registry entry only carries name/path).

Adds 'harness' as a resource type for fetch access, fetching a CUSTOM_JWT
bearer token for a deployed harness via the existing fetchHarnessToken
operation.
CLI:
- types: FetchResourceType += 'harness'
- action: handleFetchHarnessAccess dispatch; agent + harness share one
fetchTokenAccess helper
- command: help text covers harness
TUI:
- new listHarnesses operation (project registry ∩ deployed-state, reads each
harness.json for authorizerType)
- useFetchAccessFlow loads harnesses alongside gateways/agents and routes the
harness fetch through fetchHarnessToken
- FetchAccessScreen labels the harness resource type
Verified end-to-end against real AWS (us-west-2): deployed a CUSTOM_JWT harness
backed by Cognito with the OAuth credential stored in AgentCore Identity, then
fetched a valid bearer token via both 'fetch access --type harness' and the TUI
picker. Unit tests: 48 passing across fetch-access (incl. 6 new harness cases).
@tejaskash
tejaskash requested a review from a teamJune 22, 2026 21:24
@github-actionsgithub-actionsBot added the size/m PR size: M label Jun 22, 2026
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1611-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-automationagentcore-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.

Nice cleanup factoring fetchTokenAccess out of the agent and harness paths. A couple of real issues to address before merge — see inline comments. The main one: --identity-name is silently ignored for harnesses because fetchHarnessToken doesn't accept that option, even though the CLI advertises the flag for all token-bearing resources.


One additional note (not file in this PR, so flagging here):

Telemetry — ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']) and backs the fetch.accessresource_type attribute (see command-run.ts:173). Adding harness means that enum needs 'harness' for any future emission to be valid.

Separately, I couldn't find any actual cli.command_run emission for fetch.access — the schema entry exists but commands/fetch/command.tsx doesn't wrap the handler with withCommandRunTelemetry. That's a pre-existing gap, but per src/cli/telemetry/README.md adding telemetry to new features is expected. Worth wiring up while you're here so the new harness path doesn't go unobserved.

Comment threadsrc/cli/commands/fetch/action.ts
Comment threadsrc/cli/operations/fetch-access/list-harnesses.ts Outdated
Comment threadsrc/cli/operations/fetch-access/types.ts Outdated
@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@github-actions

github-actionsBot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

StatusCategoryPercentageCovered / Total
🔵Lines37.03%13550 / 36585
🔵Statements36.3%14406 / 39678
🔵Functions31.68%2326 / 7341
🔵Branches30.8%8927 / 28983
Generated in workflow #3765 for commit d0c3f75 by the Vitest Coverage Report Action

- fetchHarnessToken: accept identityName and forward as credentialName, so
'fetch access --type harness --identity-name X' is honored instead of
silently using the default <name>-oauth (mirrors fetchRuntimeToken).
- listHarnesses: drop the silent AWS_IAM fallback on readHarnessSpec failure;
let the error propagate so a corrupt/missing harness.json for a deployed
harness surfaces instead of masking a CUSTOM_JWT harness as AWS_IAM.
- HarnessInfo.authType: type as RuntimeAuthorizerType (was string) to match
AgentInfo and get the TUI auth-type branches type-checked.
- tests: replace the objectContaining({}) matcher with exact-options
assertions and add a case proving --identity-name/--target are forwarded.
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
tejaskash added a commit that referenced this pull request Jun 22, 2026
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-cli-automation

Copy link
Copy Markdown

Looks good to merge from my pass. The three inline issues from the previous review (--identity-name silently dropped for harnesses, the silent AWS_IAM fallback in listHarnesses, and the weak authType: string typing) all landed cleanly in e3be685 with tests to back the identityName forwarding.

The only outstanding item is the telemetry note from the previous review summary — it wasn't addressed and isn't a code-change blocker in this PR, but worth tracking:

  • ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']); if/when fetch.access actually emits, harness will fail schema validation.
  • commands/fetch/command.tsx doesn't wrap the action with withCommandRunTelemetry, so the new harness path (and the existing agent/gateway paths) go unobserved despite a FetchAccessAttrs schema entry already existing for it.

Both are pre-existing gaps that this PR widens rather than introduces. Happy to see them addressed in a follow-up if you'd rather keep this PR scoped.

@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@tejaskash

Copy link
Copy Markdown
ContributorAuthor

Addressed the telemetry note from the review body in 2ad7236:

  • ResourceType enum now includes 'harness' (src/cli/telemetry/schemas/common-shapes.ts) — so a fetch.access emission with resource_type=harness validates instead of being dropped.
  • Wired withCommandRunTelemetry into fetch access — the command previously emitted no cli.command_run at all. It now records resource_type. handleFetchAccess runs exactly once inside the wrapper; its string-error shape is adapted to the Result {success, error: Error} the telemetry layer expects (used only for exit_reason/error_name), while the original result drives output.

The three inline issues (--identity-name forwarding, AWS_IAM fallback, HarnessInfo.authType typing) were addressed earlier in e3be685. All review items are now resolved. 131 tests pass across telemetry + fetch + tui-fetch suites.

@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
Update docs/commands.md 'fetch access' section: --type now lists harness,
add a harness usage example, and note the CUSTOM_JWT token-fetch behavior
(managed OAuth credential, --identity-name override, AWS_IAM has no token).
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 23, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-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-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@tejaskash
tejaskash merged commit 12fd67a into mainJun 23, 2026
96 of 97 checks passed
@tejaskash
tejaskash deleted the feat/fetch-access-harness branch June 23, 2026 16:06
tejaskash added a commit that referenced this pull request Jun 23, 2026
…WT (#1609)
* test(e2e): add harness E2E coverage for lite_llm, attached tools, and CUSTOM_JWT
Extends the harness E2E surface with three real-AWS scenarios that the
provider matrix (bedrock/open_ai/gemini) doesn't cover:
- harness-litellm.test.ts — lite_llm provider routed at a Bedrock model
(no third-party key); deploy-only (skipInvoke) to prove the model config is
accepted by CloudFormation. Extends harness-e2e-helper with modelId/apiBase/
additionalParams support.
- harness-with-tool.test.ts — bedrock harness + agentcore_code_interpreter tool
via 'add tool'; proves tool wiring survives synth/deploy and the harness still
invokes.
- harness-custom-jwt.test.ts — harness with a CUSTOM_JWT authorizer backed by a
Cognito pool; asserts AuthorizerConfiguration in the CFN template, SigV4
rejection, and bearer-token invoke (mirrors byo-custom-jwt.test.ts).
All self-skip without AWS creds. The per-PR e2e workflow auto-runs changed
harness-*.test.ts files; the full suite shards everything.
* test(e2e): add fetch access --type harness step to custom-jwt e2e
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
aidandaly24 added a commit that referenced this pull request Jun 23, 2026
)
The harness-custom-jwt E2E (added in #1609) deployed the authorizer with
--allowed-audience, which validates the token's aud claim. But the test
authenticates via Cognito client_credentials (M2M), whose tokens carry a
client_id claim and no aud. Combined with the harness auto-fetch flow from
the main+preview merge (#1598, #1611) — where a registered managed OAuth
credential makes a default invoke auto-fetch a JWT instead of using SigV4 —
the service rejected every fetched token with 403 'missing required audience
claim', which didn't match the test's expected client-side rejection.
Switch the authorizer to --allowed-clients (the claim Cognito M2M tokens
actually carry), assert AllowedClients in the deploy template check, and
reframe the invoke tests to the real post-merge behavior: a default invoke
auto-fetches a JWT and is accepted, and the bearer-token invoke returns
exitCode 0. Test-only change; no shippable CLI behavior changes.
Closes#1623
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/mPR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tejaskash@agentcore-cli-automation@avi-alpert
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); feat(fetch): support harness in fetch access (CLI + TUI) by tejaskash · Pull Request #1611 · aws/agentcore-cli · GitHub
Skip to content

feat(fetch): support harness in fetch access (CLI + TUI) - #1611

Merged
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness
Jun 23, 2026
Merged

feat(fetch): support harness in fetch access (CLI + TUI)#1611
tejaskash merged 4 commits into
mainfrom
feat/fetch-access-harness

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Summary

Adds harness as a resource type for fetch access, so users can retrieve a CUSTOM_JWT bearer token for a deployed harness — both from the CLI (fetch access --type harness --name <name>) and the interactive TUI picker. Builds on the existing fetchHarnessToken operation (already used by invoke auto-fetch); this exposes it through the fetch command surface.

What changed

CLI

  • commands/fetch/types.tsFetchResourceType += 'harness'
  • commands/fetch/action.tshandleFetchHarnessAccess dispatch; the agent and harness handlers now share one fetchTokenAccess helper (they were near-identical)
  • commands/fetch/command.tsx--type / --name / description help text cover harness

TUI

  • operations/fetch-access/list-harnesses.tsnewlistHarnesses (project registry ∩ deployed-state, reads each harness.json for authorizerType); mirrors listAgents
  • operations/fetch-access/{types,index}.tsHarnessInfo type + exports
  • tui/screens/fetch-access/useFetchAccessFlow.ts — loads harnesses alongside gateways/agents; routes harness fetch through fetchHarnessToken
  • tui/screens/fetch-access/FetchAccessScreen.tsx — labels the harness resource type

Testing

Unit: 48 passing across fetch-access, including 6 new harness cases (3 CLI action, 3 TUI flow).

End-to-end against real AWS (account 346532552948 / us-west-2):

  1. Deployed a CUSTOM_JWT harness backed by a Cognito user pool, with the OAuth credential stored in Bedrock AgentCore Identity (create-oauth2-credential-provider).
  2. fetch access --type harness --name <name>success: true, returned a valid Cognito-issued JWT (verified claims: correct issuer, client_id, scope=agentcore/invoke, token_use=access).
  3. TUI fetch flow → harness appears in the picker as Harness [JWT], selecting it fetches and displays the same valid token.
  4. Verified for both a TUI-created harness and a CLI-created harness.

Notes

  • An AWS_IAM harness has no token to fetch — it surfaces the existing "use SigV4" guidance (same UX as the agent path). Token fetch applies only to CUSTOM_JWT harnesses with a managed OAuth credential.
  • listHarnesses reads each harness.json for authorizerType (the project registry entry only carries name/path).

Adds 'harness' as a resource type for fetch access, fetching a CUSTOM_JWT
bearer token for a deployed harness via the existing fetchHarnessToken
operation.
CLI:
- types: FetchResourceType += 'harness'
- action: handleFetchHarnessAccess dispatch; agent + harness share one
fetchTokenAccess helper
- command: help text covers harness
TUI:
- new listHarnesses operation (project registry ∩ deployed-state, reads each
harness.json for authorizerType)
- useFetchAccessFlow loads harnesses alongside gateways/agents and routes the
harness fetch through fetchHarnessToken
- FetchAccessScreen labels the harness resource type
Verified end-to-end against real AWS (us-west-2): deployed a CUSTOM_JWT harness
backed by Cognito with the OAuth credential stored in AgentCore Identity, then
fetched a valid bearer token via both 'fetch access --type harness' and the TUI
picker. Unit tests: 48 passing across fetch-access (incl. 6 new harness cases).
@tejaskash
tejaskash requested a review from a teamJune 22, 2026 21:24
@github-actionsgithub-actionsBot added the size/m PR size: M label Jun 22, 2026
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1611-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-automationagentcore-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.

Nice cleanup factoring fetchTokenAccess out of the agent and harness paths. A couple of real issues to address before merge — see inline comments. The main one: --identity-name is silently ignored for harnesses because fetchHarnessToken doesn't accept that option, even though the CLI advertises the flag for all token-bearing resources.


One additional note (not file in this PR, so flagging here):

Telemetry — ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']) and backs the fetch.accessresource_type attribute (see command-run.ts:173). Adding harness means that enum needs 'harness' for any future emission to be valid.

Separately, I couldn't find any actual cli.command_run emission for fetch.access — the schema entry exists but commands/fetch/command.tsx doesn't wrap the handler with withCommandRunTelemetry. That's a pre-existing gap, but per src/cli/telemetry/README.md adding telemetry to new features is expected. Worth wiring up while you're here so the new harness path doesn't go unobserved.

Comment threadsrc/cli/commands/fetch/action.ts
Comment threadsrc/cli/operations/fetch-access/list-harnesses.ts Outdated
Comment threadsrc/cli/operations/fetch-access/types.ts Outdated
@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@github-actions

github-actionsBot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

StatusCategoryPercentageCovered / Total
🔵Lines37.03%13550 / 36585
🔵Statements36.3%14406 / 39678
🔵Functions31.68%2326 / 7341
🔵Branches30.8%8927 / 28983
Generated in workflow #3765 for commit d0c3f75 by the Vitest Coverage Report Action

- fetchHarnessToken: accept identityName and forward as credentialName, so
'fetch access --type harness --identity-name X' is honored instead of
silently using the default <name>-oauth (mirrors fetchRuntimeToken).
- listHarnesses: drop the silent AWS_IAM fallback on readHarnessSpec failure;
let the error propagate so a corrupt/missing harness.json for a deployed
harness surfaces instead of masking a CUSTOM_JWT harness as AWS_IAM.
- HarnessInfo.authType: type as RuntimeAuthorizerType (was string) to match
AgentInfo and get the TUI auth-type branches type-checked.
- tests: replace the objectContaining({}) matcher with exact-options
assertions and add a case proving --identity-name/--target are forwarded.
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 22, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
tejaskash added a commit that referenced this pull request Jun 22, 2026
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
@github-actionsgithub-actionsBot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@agentcore-cli-automation

Copy link
Copy Markdown

Looks good to merge from my pass. The three inline issues from the previous review (--identity-name silently dropped for harnesses, the silent AWS_IAM fallback in listHarnesses, and the weak authType: string typing) all landed cleanly in e3be685 with tests to back the identityName forwarding.

The only outstanding item is the telemetry note from the previous review summary — it wasn't addressed and isn't a code-change blocker in this PR, but worth tracking:

  • ResourceType in src/cli/telemetry/schemas/common-shapes.ts:93 is z.enum(['gateway', 'agent']); if/when fetch.access actually emits, harness will fail schema validation.
  • commands/fetch/command.tsx doesn't wrap the action with withCommandRunTelemetry, so the new harness path (and the existing agent/gateway paths) go unobserved despite a FetchAccessAttrs schema entry already existing for it.

Both are pre-existing gaps that this PR widens rather than introduces. Happy to see them addressed in a follow-up if you'd rather keep this PR scoped.

@github-actionsgithub-actionsBot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@tejaskash

Copy link
Copy Markdown
ContributorAuthor

Addressed the telemetry note from the review body in 2ad7236:

  • ResourceType enum now includes 'harness' (src/cli/telemetry/schemas/common-shapes.ts) — so a fetch.access emission with resource_type=harness validates instead of being dropped.
  • Wired withCommandRunTelemetry into fetch access — the command previously emitted no cli.command_run at all. It now records resource_type. handleFetchAccess runs exactly once inside the wrapper; its string-error shape is adapted to the Result {success, error: Error} the telemetry layer expects (used only for exit_reason/error_name), while the original result drives output.

The three inline issues (--identity-name forwarding, AWS_IAM fallback, HarnessInfo.authType typing) were addressed earlier in e3be685. All review items are now resolved. 131 tests pass across telemetry + fetch + tui-fetch suites.

@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

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

@agentcore-devx-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
Update docs/commands.md 'fetch access' section: --type now lists harness,
add a harness usage example, and note the CUSTOM_JWT token-fetch behavior
(managed OAuth credential, --identity-name override, AWS_IAM has no token).
@github-actionsgithub-actionsBot added size/m PR size: M and removed size/m PR size: M labels Jun 23, 2026
@agentcore-devx-automationagentcore-devx-automationBot added the claude-security-reviewing Claude Code /security-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-automationagentcore-devx-automationBot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 23, 2026
@tejaskash
tejaskash merged commit 12fd67a into mainJun 23, 2026
96 of 97 checks passed
@tejaskash
tejaskash deleted the feat/fetch-access-harness branch June 23, 2026 16:06
tejaskash added a commit that referenced this pull request Jun 23, 2026
…WT (#1609)
* test(e2e): add harness E2E coverage for lite_llm, attached tools, and CUSTOM_JWT
Extends the harness E2E surface with three real-AWS scenarios that the
provider matrix (bedrock/open_ai/gemini) doesn't cover:
- harness-litellm.test.ts — lite_llm provider routed at a Bedrock model
(no third-party key); deploy-only (skipInvoke) to prove the model config is
accepted by CloudFormation. Extends harness-e2e-helper with modelId/apiBase/
additionalParams support.
- harness-with-tool.test.ts — bedrock harness + agentcore_code_interpreter tool
via 'add tool'; proves tool wiring survives synth/deploy and the harness still
invokes.
- harness-custom-jwt.test.ts — harness with a CUSTOM_JWT authorizer backed by a
Cognito pool; asserts AuthorizerConfiguration in the CFN template, SigV4
rejection, and bearer-token invoke (mirrors byo-custom-jwt.test.ts).
All self-skip without AWS creds. The per-PR e2e workflow auto-runs changed
harness-*.test.ts files; the full suite shards everything.
* test(e2e): add fetch access --type harness step to custom-jwt e2e
Set the CUSTOM_JWT harness up via 'add harness' with the JWT + OAuth-credential
flags (--authorizer-type/--discovery-url/--allowed-audience/--client-id/
--client-secret) instead of patching harness.json directly. This registers the
managed OAuth credential and .env.local secret — the real user flow — which are
the prerequisites for fetch access to mint a token.
Adds a step asserting 'fetch access --type harness' returns a CUSTOM_JWT bearer
token and that the JWT's issuer/client_id claims match the Cognito pool.
Depends on the fetch-access-harness feature (PR #1611); until that merges, this
step exercises a command not yet on main. The e2e suite is manual/full-suite
only, so this does not gate per-PR CI.
aidandaly24 added a commit that referenced this pull request Jun 23, 2026
)
The harness-custom-jwt E2E (added in #1609) deployed the authorizer with
--allowed-audience, which validates the token's aud claim. But the test
authenticates via Cognito client_credentials (M2M), whose tokens carry a
client_id claim and no aud. Combined with the harness auto-fetch flow from
the main+preview merge (#1598, #1611) — where a registered managed OAuth
credential makes a default invoke auto-fetch a JWT instead of using SigV4 —
the service rejected every fetched token with 403 'missing required audience
claim', which didn't match the test's expected client-side rejection.
Switch the authorizer to --allowed-clients (the claim Cognito M2M tokens
actually carry), assert AllowedClients in the deploy template check, and
reframe the invoke tests to the real post-merge behavior: a default invoke
auto-fetches a JWT and is accepted, and the bearer-token invoke returns
exitCode 0. Test-only change; no shippable CLI behavior changes.
Closes#1623
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/mPR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tejaskash@agentcore-cli-automation@avi-alpert