fix(jsonl): map lifecycle guard errors to invalid_request#449
Open
dalledajay-coder wants to merge 1 commit into
Open
fix(jsonl): map lifecycle guard errors to invalid_request#449dalledajay-coder wants to merge 1 commit into
dalledajay-coder wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
handle_request caught ValueError, ProposalError and ArtifactNotFoundError as caller-visible conditions, but LifecycleError (a RuntimeError subclass like ProposalError) fell through to the generic branch: kb.supersede of a claim onto itself came back as internal_error and logged a full server-side traceback for what is a bad request. the http /rpc transport shares the same envelope, so both wire surfaces misreported it while the cli already mapped the identical error to a clean one-liner via _cli_errors. add LifecycleError to the domain-error tuple so lifecycle guards surface as invalid_request on every transport, and cover it with a regression test that fails on the previous code.
2ca2f62 to
66ad6e8
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.
What changed
handle_requestin the JSONL server now includesLifecycleErrorin the caller-visible domain-error tuple, next toProposalError, so lifecycle guard failures map to{"code": "invalid_request"}instead of falling through to the genericinternal_errorbranch. one import, one tuple entry, a regression test, and a changelog line.Why
the envelope treated
ValueError/ProposalError/ArtifactNotFoundErroras bad requests, butLifecycleError— aRuntimeErrorsubclass exactly likeProposalError— fell through to the catch-all. on currenttest:plus
_log.exceptiondumping a full server-side traceback for what is a caller mistake. the http/rpctransport routes through the samehandle_request, so both wire surfaces misreported it — while the cli already translated the identical error into a clean one-liner via_cli_errors(which listsLifecycleErrorexplicitly for this exact reason). an agent retrying oninternal_error(a server fault, plausibly transient) will loop on a request that can never succeed;invalid_requesttells it the request itself is wrong.any future lifecycle guard raising
LifecycleErrorgets the correct mapping for free.Testing
tests/test_jsonl_server.py::test_jsonl_lifecycle_guard_maps_to_invalid_request— fails on currenttest(envelope carriesinternal_error), passes with the fix; also asserts the guard fired before any write, leaving the claim untouched.ran locally: