Skip to content

[Bug] Postgres client using .toCamel() causing JSON keys containing upper snake case to lose their underscores #367

@thomasjiangcy

Description

@thomasjiangcy

What happened

When using OpenWorkflow with the Postgres backend, JSON keys inside workflow run input are being mutated during persistence/readback.

Observed persisted payload snippet:

{
  "env": {
    "OPENAIMODEL": "gpt-5.3-codex",
    "OPENAIBASEURL": "http://127.0.0.1:8090/...",
    "OPENAIREASONINGEFFORT": "medium"
  }
}

Expected:

{
  "env": {
    "OPENAI_MODEL": "gpt-5.3-codex",
    "OPENAI_BASE_URL": "http://127.0.0.1:8090/...",
    "OPENAI_REASONING_EFFORT": "medium"
  }
}

Why this is a bug

Workflow input payloads should be stored and returned without rewriting user-provided JSON keys.

Reproduction

  1. Start OpenWorkflow with the Postgres backend.
  2. Enqueue a workflow run whose input includes JSON object keys with underscores (e.g. OPENAI_MODEL, OPENAI_BASE_URL).
  3. Let the run persist.
  4. Query the workflow run input from the workflow_runs table.
  5. Observe underscores are removed from JSON keys (e.g. OPENAI_MODEL becomes OPENAIMODEL).

Expected behavior

JSON input keys are preserved exactly as provided.

Actual behavior

JSON input keys are transformed during persistence/readback.

Suspected root cause

The Postgres backend applies postgres.toCamel transform globally. In postgres (postgres.js), this transform also applies to JSON value object keys, not only SQL column names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions