[enhancement] Programmatic ticket closure for CC agent (Resolved + Won't Do + Duplicate) #10
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Extend the app so the Contact Center AI agent can programmatically close SS tickets end-to-end — the natural next step after ticket creation lands. Design informed by direct Jira workflow probing.
Workflow reality check
The
Resolvedtransition (id 161) in project SS has:resolution(8 valid values:Done,Won't Do,Duplicate,Fixed,Cannot Reproduce,Blocked,Invalid,Declined)components— Jira native, 63 fixed optionscustomfield_10224Business Service — Assets CMDB, objectTypeId 100 in schema 68 (e.g. "Store Technology")customfield_10225System — Assets CMDB, objectTypeId 103 in schema 68 (e.g. "UKG Pro WFM")customfield_10233Cause — Assets CMDB, objectTypeId 107 "Cause Code" in schema 68 (e.g. "Unknown")Verified via real closed tickets (SS-20272, SS-20022, SS-19863). Notably, all three sample tickets used
Cause: "Unknown"(objectId 83132) — meaning the workflow accepts "Unknown" as a legitimate value. AI agent never needs to guess a root cause; a safe fallback exists.There is no dedicated Cancel transition. Cancel is expressed via
resolution: Won't Doon the Resolved transition. Duplicate isresolution: Duplicate+ an issue link.Design
Cache infrastructure (all 3 new CMDB fields live in schema 68, same permission profile as Stores):
services/jira/storesCache.jsinto aservices/jira/assetsObjectCache.jsfactory. Same in-memory Map + on-disk JSON + startAt/maxResults pagination + PAT auth. Store cache becomes one instance; three new caches for Business Service / System / Cause.GET /api/wxccai/admin/storesCache/status->GET /admin/cachesStatusreturning all four;POST /admin/cachesRefresh?name=businessServices|...for on-demand refresh.Config-driven defaults in
src/config/ssCloseDefaults.js:Enhanced close endpoint (backward-compatible with existing
/close):Under the hood:
PUT /issue/{key}to set the 4 fields (using Cloud CMDB shape[{id: <ws>:<obj>}])POST /issue/{key}/transitionswith{ transition: { id: '161' }, fields: { resolution: { name: '…' } } }POST /issue/{key}/commentfor the audit trailresolutionwhen target statusCategory isdone).Convenience wrappers for common CC-agent intents:
What the AI needs from the caller
Acceptance
POST /ticket/SS-20948/confirmFixedtransitions toResolvedwith all 4 validator fields populated automatically from defaults +resolution=Done. Verified via direct REST GET.POST /ticket/:key/duplicatealso creates a formalDuplicateissueLink to the primary./closeendpoint continues to work with its old body shape.Non-goals
Landed on branch
cursor/close-ticketsas commit034e657.What shipped
storesCacheinto a reusableassetsObjectCachefactory. Store cache is now one instance; three new caches join it for the CMDB validator fields on close (Business Services / Systems / Cause Codes)./admin/caches(plural). Old/admin/storesCache/*kept as aliases.caches.*/CACHES_*env vars.src/config/ssCloseDefaults.jsseeds every supported SS subType with a{component, businessService, system, cause}tuple. All values verified against live caches. Falls back to the tenant's designed catch-all values (Help Desk/Store Technology/I can't find my option - Misc/Unknown) for unmapped subTypes.issues.js closeTicketreworked:setSSValidatorFieldshelper reads current ticket state, resolves each field via caller > existing-on-ticket > default, PUTs the four fields using the Cloud CMDB shape[{id: "<ws>:<objectId>"}].preserveExistingClassification=true).resolutionon done-category transitions).closeHelpers.jsadds three CC-agent intent wrappers:confirmFixed,customerCancelled,markDuplicate(last one creates a formalDuplicateissueLink to the primary).POST /ticket/:key/{confirmFixed,customerCancelled,duplicate}+ expanded body on the existing/closeroute.Verified end-to-end
Direct Jira REST GET confirms every field persisted on the ticket. Status now
Resolved(categorydone) with resolutionDone.CC-agent surface at rest
POST /ticket/:key/confirmFixed{ subType }POST /ticket/:key/customerCancelled{ subType, reason? }POST /ticket/:key/duplicate{ primaryKey }POST /ticket/:key/close