-
Notifications
You must be signed in to change notification settings - Fork 32
zammad_get_ticket returns "Unknown" for State, Priority, Group, Owner and Customer #319
Copy link
Copy link
Labels
area:infraInfrastructure, networking, and automationInfrastructure, networking, and automationarea:pythonPython development and toolingPython development and toolingarea:securitySecurity and policy workSecurity and policy workeffort:lowimpact:mediumstatus: pending-closeWork completed by Factory; awaiting maintainer closeWork completed by Factory; awaiting maintainer closetype:bugSomething is not working correctlySomething is not working correctlytype:securitySecurity-related workSecurity-related work
Description
Activity
Metadata
Metadata
Assignees
Labels
area:infraInfrastructure, networking, and automationInfrastructure, networking, and automationarea:pythonPython development and toolingPython development and toolingarea:securitySecurity and policy workSecurity and policy workeffort:lowimpact:mediumstatus: pending-closeWork completed by Factory; awaiting maintainer closeWork completed by Factory; awaiting maintainer closetype:bugSomething is not working correctlySomething is not working correctlytype:securitySecurity-related workSecurity-related work
Describe the bug
zammad_get_ticketrenders every human-readable field asUnknown, even though the ticket has them set. Thezammad://ticket/{id}resource is affected too, since both go throughZammadClient.get_ticket.Root cause
get_ticketfetches the ticket withself.api.ticket.find(ticket_id)(client.py#L196).zammad_py'sResource.find()takes only an id and accepts no filters, soexpand=trueis never sent. Zammad then returns just the*_idfields,Ticket.state/.priority/.group/.owner/.customerstayNone, and_brief_fieldfalls through to its"Unknown"default.search_ticketsdoes not have the problem because it passesfilters={..., "expand": "true"}. This looks like a spot that was missed when the expand handling was fixed —tests/test_expand_param_fix.pycoversticket.search,ticket.all,user.searchandorganization.search, but not the single-ticketfind.The models were already written for the expanded form (
group: GroupBrief | str | None, with the comment "can be either objects or strings when expand=true"), so only the request side is missing.To Reproduce
Against a Zammad 6.5 instance with a ticket that has a group, state, priority and customer:
Expected behavior
Actual behavior
zammad_search_ticketson the same ticket correctly reportsState: open/Priority: 2 normal, which is a quick way to confirm the data is there.Raw API for the same ticket:
Environment
8873b2e(main), run viauvx --from git+https://github.com/basher83/zammad-mcp.git mcp-zammadticket.agentAdditional context
Possibly related, and not covered by this report:
_brief_fieldonly checksisinstance(value, StateBrief | PriorityBrief | UserBrief), soGroupBriefandOrganizationBriefobjects would also fall through to"Unknown". It does not bite here because withexpand=trueZammad sends plain strings, but it looks unintended.PR incoming.