Skip to content

Normalize trigger_source in the harness, not the LLM #1466

@fullsend-ai-retro

Description

@fullsend-ai-retro

What happened

The fix agent failed schema validation in 5 of 8 runs (May 15-21) because it wrote the raw TRIGGER_SOURCE username into fix-result.json instead of the enum "bot" or "human". Issue #1300 identified this pattern. PR #1308 fixed it by adding explicit mapping instructions to agents/fix.md and skills/fix-review/SKILL.md, telling the LLM to check if the username ends in [bot] and map accordingly.

What could go better

The fix relies on the LLM consistently following normalization instructions — the same approach that failed in the first place (the agent definition already implied the mapping, just not explicitly enough). The harness scripts (pre-fix.sh, post-fix.sh) already contain is_bot_user() functions that perform this exact check. If the harness passed a pre-normalized TRIGGER_TYPE env var ("bot" or "human") alongside the raw TRIGGER_SOURCE username, the LLM would just copy the value — no interpretation needed. This eliminates the failure class rather than mitigating it with better instructions.

Confidence: High. The is_bot_user() function already exists in two harness scripts, and the workflow's reusable-dispatch.yml already validates the username format. Adding a derived env var is a small, safe change.

Proposed change

In internal/scaffold/fullsend-repo/harness/fix.yaml, add a new runner_env variable TRIGGER_TYPE that is pre-normalized. This requires a small change in the workflow (reusable-fix.yml or pre-fix.sh) to derive the value using the existing is_bot_user() logic before the agent starts. Then update agents/fix.md and skills/fix-review/SKILL.md to instruct the agent to use TRIGGER_TYPE directly as the trigger_source value in fix-result.json, rather than performing its own normalization of TRIGGER_SOURCE. Keep TRIGGER_SOURCE (the raw username) available for display/logging purposes.

Validation criteria

Schema validation failures on the trigger_source field should drop to zero. The next 10 fix agent runs should not fail due to trigger_source enum mismatch. Verify by checking gh run list --repo fullsend-ai/.fullsend --workflow=fix.yml --limit 10 after the change is deployed.


Generated by retro agent from #1308

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions