Repository navigation
log requests the provider fails as failed, with what went wrong - #143
Merged
Merged
Conversation
An allowed request was logged only once the connector answered, so one the provider failed (rate limits, outages, a rejected sign-in) left no trace in the activity log or the database. Such a request is now logged with the outcome failed and an error column: the api's kind of error, with the provider's HTTP status where it answered with one, such as `provider_unreachable 429`. The activity log shows it as "Failed to …", filters by it, and says what went wrong in the entry's dialog.
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.
Why
A request an agent was allowed to make was logged only after the connector answered successfully. If the provider failed it (a 429, a 5xx, a timeout, a revoked sign-in), the request left no
AuditEntry. Only internal and database errors reached the server log, so most of these failures were not recorded anywhere. For an agent calling us thousands of times an hour, we couldn't tell how many of its calls actually worked.What
AuditOutcomegainsfailed, andAuditEntrygainserror, a nullable column. It holds the api's error kind, plus the provider's HTTP status when there was one, e.g.provider_unreachable 429,provider_unreachable,credentials_rejected,not_found. The provider's error text is never stored, because it can contain the person's data. Migrationv025_add_failed_requests.agent-side/tools.ts): every connector call (list, get, create, update, delete, commands) and every custom MCP tool call now goes throughlogFailure. A failure is logged asfailed, with the record title and search an allowed request would have had, and the original error is then passed on unchanged. As before, a request that can't be logged fails instead of going unrecorded. Unchanged: bad params, a missing task, and a command on a record it doesn't apply to are still refused and not logged.error, and?outcome=failedfilters to failed entries.Testing
bun run typecheck,bun run test(all packages pass) andbun run lint(no errors, one existing warning inagent-collection-page.tsx).prisma migrate difffrom the migrations toschema.prismais empty./activity?outcome=failedand an entry's dialog.Rollout
The internal admin reads this database directly and expects
outcometo beallowedordenied(its zod schema and its Prisma client, which is generated from this schema). Once this is deployed and the firstfailedrow is written, its activity lists may fail to parse untilproxy/is moved past this change there and the admin handlesfailed. Merge the two close together.