fix: surface swallowed failures on data-library indexing and publish botId lookup (OBS follow-up) @W-24016300 - #352
Merged
Conversation
nico-pappagianis
force-pushed
the
chore/logging-followup-obs-findings
branch
3 times, most recently
from
August 27, 2026 16:31
56ab7c7 to
7520eb0
Compare
nico-pappagianis
force-pushed
the
chore/logging-followup-obs-findings
branch
from
August 27, 2026 22:07
70c5597 to
b9e43ff
Compare
nico-pappagianis
marked this pull request as ready for review
August 27, 2026 22:13
setu4993
approved these changes
Aug 28, 2026
setu4993
left a comment
Collaborator
There was a problem hiding this comment.
Nice fixes. Let's make sure CI is all green before we merge.
Follow-up to the msg-ctx logging standardization (#351), addressing two rounds of observability/security review findings. Data-library KNOWLEDGE indexing (agentDataLibrary): - Check response.ok on the indexing fetch; native fetch resolves on 4xx/5xx, so HTTP errors (expired auth, 5xx, 429) were swallowed as success. HTTP and network failures now converge on one warn + agent_adl_indexing_trigger_failed telemetry event, statusCode distinguishing them. create() still resolves (indexing stays best-effort); the intentional 10s abort emits nothing. publish botId lookup (scriptAgentPublisher.getPublishedBotId): - Only SingleRecordQuery_NoRecords is treated as 'not yet published'; any other lookup error is surfaced (telemetry + rethrow) rather than swallowed, so we never POST a duplicate first version over an existing agent. - Log at debug (not warn) on the rethrow path per ai-docs/logging.md; the rethrown error is the durable signal. Add statusCode to the log and telemetry. SOQL hardening (CWE-89): - Escape single quotes in interpolated identifiers (developerName, botVersionId, defaultAgentUser) using the repo's agentEvalRunner idiom. Also standardizes the new-format retrieve log lines to msg-ctx and hardens the CtxLogger emit path (single merging object so @salesforce/core's Logger does not collapse fields under numeric keys). Adds tests for all of the above.
nico-pappagianis
force-pushed
the
chore/logging-followup-obs-findings
branch
from
August 28, 2026 16:49
2c444c5 to
98bdef3
Compare
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
Follow-up to #351 (logging standardization) that implements the three behavioral observability findings deferred out of that PR's review (OBS-1 / OBS-2 / OBS-5). #351 deliberately kept to a pure logging-format change; this PR makes the small behavior changes those findings actually require.
What changed
OBS-2 —
getPublishedBotIdno longer collapses every error into "not published"singleRecordQuerythrowsSingleRecordQuery_NoRecordswhen zero rows match — that is the genuine "agent not yet published" case (→debug, returnundefined, POST a first version). Any other error (auth, network, multiple matches) means the lookup itself failed and we cannot tell whether the agent exists. Previously all of these collapsed to "not published", risking a duplicate first version POSTed over an existing agent. They nowwarn, emitagent_publish_botid_lookup_failedtelemetry, and rethrow.OBS-5 — KNOWLEDGE indexing trigger no longer swallows real failures
The fire-and-forget indexing
fetchhad an emptycatch {}. An intentional 10sAbortErrorstaysdebug(the server processes indexing asynchronously on receipt, so a timeout is expected and harmless). A genuine failure — the request never reached the server — nowwarns, so a data library that silently never indexes is diagnosable.OBS-1 — sole-signal swallow paths promoted above the default WARN capture
Logger.DEFAULT_LEVELis WARN, sodebuglines don't persist in a default production capture. OBS-1 asked that any path which is the only signal of a problem and swallows-and-continues log above that threshold. After OBS-2 and OBS-5, those were the only two such paths, and both nowwarnon genuine failure. The log-and-rethrow catches (agentDataLibrary, apiCatalog) correctly stay atdebug— the throw plus its_failedtelemetry is the durable signal, so promoting them would be log-and-throw double-reporting.Tests
should return undefined when agent does not existnow simulates not-found with the realisticSingleRecordQuery_NoRecordsSfErrorinstead of a genericError.should rethrow when the lookup itself fails (not a genuine not-found).yarn tsc -bclean;yarn mocha→ 420 passing, 1 pending.Open question for review
OBS-2 changes a real lookup failure from swallow-and-continue to rethrow. That is the safer default (don't risk a duplicate publish when org state is unknown), but it does turn a previously-silent transient query blip into a hard publish failure. Flagging in case we'd rather
warn+ telemetry and still proceed. Draft pending that call.@W-24016300