fix(agents): address UX/docs issues from #293 (Bedrock, PATCH, unknown fields, trace_id) - #294
Merged
Merged
Conversation
- Fix #1: parseBedrockSecret now treats plain ABSK strings as { apiKey: value } instead of silently discarding them - Fix #2: buildBedrockModel now falls back to config.apiKey when no secret is linked, so api_key in the provider config object is honoured instead of being silently ignored - Fix #3: Add PATCH /agents/:agent_id as an alias for PUT, so both HTTP methods work for partial agent updates; update OpenAPI spec accordingly and regenerate SDK + CLI manifest - Fix #4: POST and PUT/PATCH /agents reject unknown request body fields with 400 "Unknown field(s): ..." to prevent silent data loss (e.g. sending prompt instead of instructions) - Fix #5: recordGenerationFailure now wraps non-DomainErrors in a new GENERATION_FAILED DomainError that carries generation_id and trace_id in meta, so 500 responses from /agents/:id/generate include a trace_id the caller can query for the root cause - Update ai-providers docs with JSON-format warning and config.api_key note Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JTwheo15iV5tcGGWjk8V1z
… threshold Add a test that passes a plain object (not an Error or DomainError) to recordGenerationFailure, covering the false branch of the instanceof Error ternary that was sitting below the 70% branch coverage threshold. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JTwheo15iV5tcGGWjk8V1z
Deploy Outputs
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all five issues documented in #293, encountered during a Bedrock AI provider setup session.
Fix Feat files #1 — Bedrock plain ABSK secret silently discarded:
parseBedrockSecretnow treats a rawABSK…string as{ apiKey: value }instead of falling back to{}and producing a confusing SigV4 error.Fix Feat files #2 —
config.api_keysilently ignored for Bedrock:buildBedrockModelnow usesconfig.apiKeyas a credential fallback when no secret is linked (or when the secret doesn't supply anapiKey). The docs are updated to mention this option.Fix Feat modules #3 — Agent update requires PUT, not PATCH: Added
PATCH /agents/:agent_idas a full alias forPUT. Both methods perform partial updates. OpenAPI spec updated; SDK and CLI manifest regenerated.Fix chore: change website name #4 — Unknown agent fields silently ignored:
POST /agentsandPUT/PATCH /agents/:idnow return400 Unknown field(s): <field>when the request body contains any key not in the allowed set. This catches typos likepromptinstead ofinstructionsat the boundary.Fix Chore package name #5 —
trace_idmissing from generation 500 errors:recordGenerationFailurenow wraps non-DomainErrorexceptions in aGENERATION_FAILEDDomainError(HTTP 500) that carriesgeneration_idandtrace_idinmeta. Callers hitting a 500 fromPOST /agents/:id/generatenow receive the trace ID they need to query for the root cause.Changes
src/lib/agentModel.tsconfig.apiKeysupportsrc/lib/generationLifecycle.tsGENERATION_FAILED+ trace_idsrc/errors/codes.tsGENERATION_FAILEDerror code (HTTP 500)src/rest/v1/agents.tssrc/rest/openapi/v1/agents.yamlPATCH /agents/{agent_id}(patchAgentoperation)packages/website/docs/modules/ai-providers.mdconfig.api_keyfallbacktests/unit/tests/lib/agentModel.test.tstests/unit/tests/lib/generationLifecycle.test.tstests/unit/tests/rest/agents.test.tsCloses #293
Generated by Claude Code