Skip to content

dashboard/app: centralized handling of missing default arguments for old AI jobs #7476

Description

@ramosian-glider

Problem Description: When new fields (like TargetArch or TargetOS) are added to AI workflow schemas, older jobs in the database (which were created before the new fields existed) do not have these fields in their Args JSON.

Because the dashboard UI (/ai_job?id=) directly iterates over the JSON stored in the database, these new fields are completely missing from the "Inputs:" section when viewing older jobs.

Why ad-hoc fixes aren't enough: Currently, we are dynamically injecting missing defaults in specific backend endpoints like buildAIJobPollArgs to ensure the syz-agent doesn't break when polling old jobs. However, trying to fix this by explicitly populating defaults every time an old job is touched (e.g., manual UI restarts, auto-restarts for patch iterations) complicates the backend code and turns into a game of whack-a-mole. If we miss a spot, the UI continues to hide the fields.

Instead of patching the Args map across various handlers and restart logic, we should implement a centralized, systematic way to merge schema defaults into the job arguments.

Some potential approaches:

At UI Render Time: Update formatUIJobArgs (or makeUIAIJob) to merge the job's stored Args with the defaults defined in manualAIWorkflows. This ensures the UI is always completely filled out, without needing to touch the database records or backend execution logic.
At DB Load Time: Have aidb.LoadJob and aidb.LoadNamespaceJobs automatically hydrate missing fields based on the workflow schema when fetching from Spanner.
Database Migration: Periodically run a job to explicitly populate missing fields in the database for older jobs, making the explicit schema the source of truth.

This will decouple the UI/Agent from schema evolution and keep the job creation/restart logic simple.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions