Skip to content

Move run.workerVersion into run.worker.version #855

Open

Description

Original author: Cedric Vidal (@cedricvidal)

Background

In #846 we are adding a run.worker = { instanceId, podName? } sub-document on the run state to identify which worker process is handling a run. The existing run.workerVersion field was a natural fit to fold into run.worker.version, but we deferred that to keep #846 small and avoid mixing schema migration with a behavioral fix.

Proposed change

  • Move run.workerVersion into run.worker.version on both RequestDocument.run (RunState) and RunHistoryDocument.
  • Single source of truth for worker identity on a run attempt.

Tasks

  • Add version to the worker sub-document type in packages/shared/src/types/types.ts.
  • Update Mongoose schemas in packages/shared/src/models/.
  • Update RUN_STATE_FIELD_NAMES (drop workerVersion, the worker entry already covers it).
  • Update all read sites to use run.worker.version instead of run.workerVersion (API, CLI, portal, judge, report-generator, model-scanners, etc.).
  • Update all write sites — primarily getVersionFields() in packages/shared/src/queue/queue-processor.ts and any code that stamps run.workerVersion directly.
  • db-migration in packages/db-migrations/src/migrations/ that:
    • Copies run.workerVersion → run.worker.version on requests documents.
    • Copies workerVersion → worker.version on runs documents (the RunHistoryDocument collection).
    • Unsets the legacy workerVersion field afterwards.
  • Brief back-compat read shim during the deploy window (or run the migration before the new code goes live — pick one).
  • Update docs/architecture/app-design.md (and any other doc that references run.workerVersion).

Out of scope

  • Changing how workerVersion is computed (<agentVersion>-<buildTime>-<gitCommit> stays).
  • Adding new fields beyond the move.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementNew functionality or improvements to existing behavior.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions