Menu

#300 fix(worklog): synth emits JSON not prose (PII post-hook + json_schema)

closed
nobody
released (243)
2026-06-17
2026-06-17
Anonymous
No

Originally created by: adityaharishch

What

Two coupled fixes to the pm-worklog synth agent (services/agents/pm_worklog_update/agents.py) that stop it returning reasoning prose instead of a parseable JiraUpdate.

1. PII guardrail crash → removed from post_hooks

PIIDetectionGuardrail is an input guardrail (check(self, run_input)). It was wired into post_hooks, which only ever receive the run output — so agno could never supply run_input and it threw on every run:

TypeError: PIIDetectionGuardrail.check() missing 1 required positional argument: 'run_input'

Removed it (import + post_hooks entry). Not needed for now.

2. use_json_mode=TrueFalse → schema-constrained output

With use_json_mode=True, agno sent a bare {"type":"json_object"} (no schema), so the model was free to ramble and the parse failed:

Failed to parse cleaned JSON: Expecting value: line 1 column 1 (char 0)
raw=The user wants me to verify that the session summaries belong to ticket KAN-239...

With False, agno serialises the full JiraUpdate schema into the request as response_format: {"type":"json_schema", ...}. The MLX /v1/chat/completions handler reads that schema and FSM-constrains decoding with outlines, so the reasoning model physically cannot emit chain-of-thought instead of the JSON object.

Dependency

The server-side /v1/chat/completions json_schema enforcement that this activates lives on #297 (feat/classifier-observability). This change is inert until [#297] lands — without the server half, agno sends the schema but the server ignores it. The PII removal (fix [#1]) is effective immediately regardless.

Test

  • python -m py_compile agents/pm_worklog_update/agents.py
  • Verified the JiraUpdate schema agno emits compiles to an outlines regex (build_regex_from_schema, 2720 chars, no errors) — the constraint is valid for the real nested schema (BulletWithEvidence, enums, additionalProperties:false).

Related

Tickets: #1
Tickets: #297

Discussion

  • Anonymous

    Anonymous - 2026-06-17

    Ticket changed by: adityaharishch

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2026-06-17

    Originally posted by: adityaharishch

    🎉 This PR is included in version 1.56.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

     

Log in to post a comment.