Repository navigation
fix-forward #3942 (tsk-bnohyn): agent reply route returns 202 when the trace_id message lookup raises (CodeRabbit Major, pre-existing) #3943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ff337a9
Fix agent chat session reply: channel membership and slug collision
jaylfc 17a3a0c
address in-house review findings for tsk-wfkhb2
jaylfc 42256ac
Merge origin/dev into exec/tsk-wfkhb2 (resolve test import conflict, …
jaylfc c77da1d
tsk-bnohyn [OPEN] fix-forward #3940 (tsk-wfkhb2): fail closed on re…
jaylfc 03b6724
fix: return 503 when trace_id lookup fails on self chat reply (tsk-4w…
jaylfc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ### Fixed | ||
| - Agent chat reply trace_id lookup failures now return 503 instead of falling back to self-DM (tsk-4wadcj) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ### Fixed | ||
| - fail closed on registry errors and unknown channels in the agent reply route |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| ### Fixed | ||
|
|
||
| - Agent chat session reply endpoint now enforces channel membership: a registry agent can only reply in channels where its slug is listed as a member. Requests targeting a foreign channel (via `channel_id` or `trace_id`) return 403 `{"error": "not a member of this channel"}`. | ||
| - Registry agent slug collision prevention: when two active registry agents have canonical IDs that strip to the same slug, only the first-registered agent may use the session; subsequent agents receive 403 `{"error": "handle collides with another registry agent"}`. |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Guard the
get_channellookup and validatechannel_idtype. An unguarded exception returns 500.The trace lookup in
_resolve_target_channelreturns a controlled 503 on store errors. Thechat_channels.get_channel(...)call here has no such guard. If the channel store raises, the route returns an unhandled 500. This is inconsistent with the fail-closed 503 contract used for the registry and trace lookups.channel_idcomes straight from the request body, and_resolve_target_channelreturns it without a type check. A non-string value, such as a list or dict, reaches the SQLite parameter binding. It raises an exception, which also becomes a 500. A reply is not recorded in either case. The error response is still wrong.Reject a non-string
channel_idwith 400. Map store failures to the same 503 payload used elsewhere.🛡️ Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents