# Agent9 managed evidence artifact reference normalization

<!-- auto-oncall-optimization-record
{
  "schemaVersion": "auto-oncall-optimization-record-v1",
  "optimizationId": "agent9-artifact-ref-slug-2026-09-02",
  "problems": [
    {
      "problemId": "truncated-managed-query-id-invalid-artifact-ref",
      "summary": "A long valid Provider query ID could be truncated after a hyphen and then receive an ordinal suffix, producing a double hyphen that failed the diagnostic artifact reference contract after successful acquisition.",
      "status": "optimized_verified",
      "applicability": "Agent9 Managed Tool evidence materialization for any provider-backed scenario with a long semantic query ID.",
      "issueKeys": [
        "ST-2933"
      ],
      "sourceRefs": [
        "https://tidb.atlassian.net/browse/ST-2933#problem:diagnostic_artifactRefs_invalid"
      ],
      "signalTextIncludesAny": [
        "diagnostic_artifactRefs_invalid"
      ],
      "observedThrough": "2026-09-02",
      "effectiveAt": "2026-09-02T09:31:08Z",
      "verifiedAt": "2026-09-02T11:36:29.120Z",
      "attemptedAction": "Trim trailing separators after bounding the Provider query slug so the runner-owned ordinal suffix always produces a valid diagnostic query ID and artifact reference.",
      "evidenceUrl": "replay://ST-2933/run/5a0b8f29-7b0e-4155-aef2-f83b02b427fb"
    }
  ]
}
-->

- Owner: Agent9 Managed Tool result materialization
- Source: ST-2933 post-deployment `mode=read` replay
- Implementation status: merged, deployed, and verified by deterministic and live regression
- Effective status: `optimized_verified`

## Bounded problem

ST-2933 completed the selected Clinic operations, but one long semantic query
ID was truncated immediately after a hyphen. Appending the runner-owned ordinal
then produced a double hyphen in the evidence directory name. The child handoff
was written, but its artifact inventory failed the canonical evidence-reference
validator before Scenario Diagnostic finalization.

## Intended change

Normalize the bounded slug after truncation and before appending the ordinal.
Do not change the Provider request, result content, diagnostic interpretation,
artifact-reference grammar, or failure fallback.

## Verification

The regression test materializes the same long query-ID shape on a
`workload-hotspot` scenario and requires the resulting query ID and artifact
path to pass the existing child-handoff parser without a double hyphen.

## Live verification

Staging ran image `0af8d7461c527993a38f69ffb0ac4866e6d09f7a` with one Ready
Pod and zero restarts. One ST-2933 `mode=read` replay completed as run
`608a3a0f-41a5-4588-9ad5-d77ade3d9e96` with HTTP 200. Its
`workload-hotspot` handoff materialized twelve valid artifact references, had
no `diagnostic_artifactRefs_invalid` failure, and reached Scenario Diagnostic
finalization with `status=suspected` and `completion=complete`.

The separate `query-latency` refinement timed out in Scenario Diagnostic round
2, while Router reconciliation and Final Response completed. That timeout is
not an artifact-reference regression and does not change this optimization's
verified status. The read-only replay did not request Jira, database,
evaluation, or Feishu publication.

## Write replay and status refresh

Authorized `mode=write` replay
`5a0b8f29-7b0e-4155-aef2-f83b02b427fb` completed both `query-latency` and
`workload-hotspot` Scenario Diagnostics, Router reconciliation, and Final
Response generation. Provider acquisition was complete across 30 recorded
attempts with no terminal failure code, and the artifact-reference validator
did not reproduce `diagnostic_artifactRefs_invalid`.

The replay persisted DB run `150188`, updated existing Jira internal comment
`23773381` in place, and wrote the `analyze_write` evaluation. Direct Jira
readback confirmed the same comment ID, `public=false`, and both paired message
sections. Judge returned `ai_better`; the Feishu Base row read back with
`AI Acceptable Value=1` at `2026-09-02T19:36:29.120+08:00`. No
customer-visible comment was created.
