Skip to content

fix(company-os): legacy POST /llc/workflows/{company_id} must delegate to the Company OS workflow service and be admin-gated (#14409) #21239

Closed

Description

@mrveiss

Parent: #14409

Problem

Two create implementations write one table. Legacy POST /llc/workflows/{company_id} (autobot-backend/llc/api/workflows.py:134) is not admin-gated and cannot carry kind / owner_role_id; the Company OS create (autobot-backend/llc/api/company_os.py:164) is admin-gated. A non-admin can create company workflows through the legacy route.

Scope

Maintainer decision 2026-11-09: the legacy path-scoped route delegates to CompanyOsWorkflowService.create, becomes admin-gated, and accepts/returns kind and owner_role_id. The UI keeps using the path-scoped route (company comes from the path, not the session tenant).

Files: autobot-backend/llc/api/workflows.py, autobot-backend/llc/api/company_os.py, autobot-backend/llc/models/company_os.py, regenerated autobot-frontend/src/types/generated/api.ts (generated OpenAPI types).

Acceptance criteria

  • Legacy create calls CompanyOsWorkflowService.create; no second insert path remains
  • Non-admin gets 403; admin gets 201
  • kind and owner_role_id are accepted on create and present in the response
  • Rows created through either route are identical for the same input
  • api.ts regenerated and the codegen check passes

Tests

Backend: non-admin 403, admin 201, identical rows from both routes, 409 on duplicate id preserved.

Activity

  1. added
    bugSomething isn't working
    area: company-osWave 4 · cluster A — Company OS & LLC canvas
    phase:M3.7Company OS, Automation and BI screens
    on Nov 9, 2026
  2. added
    needs-ac-evidenceClosed by a merge keyword; awaits an AC evidence table comment (#19520)
    on Nov 9, 2026
  3. github-actions commented on Nov 9, 2026

    @github-actions
    Contributor

    Landed via the merge train (#21263, merge 4b5a1299da) via #21246

  4. mrveiss commented on Nov 9, 2026

    @mrveiss
    OwnerAuthor

    Closure check against main @ 4b5a1299da (train #21263, carrying #21246). All 5 ACs verified and ticked:

    • Single insert path: autobot-backend/llc/api/workflows.py create_workflow calls _company_os().create(...) (CompanyOsWorkflowService); the module docstring records "one insert path". The base WorkflowService.create is only reached through the Company OS service (llc/services/company_os/workflows.py:38).
    • 403/201: llc/tests/test_workflows_legacy_create.py::test_non_admin_is_refused_and_admin_creates (403 then 201, 409 on duplicate id); also test_platform_admin_without_membership_is_refused.
    • kind / owner_role_id: WorkflowCreate carries both, WorkflowResponse returns them; test asserts kind == "workflow" and owner_role_id in the response. Meta skills are refused on this route (test_legacy_create_rejects_meta_skill).
    • Identical rows: test_both_routes_write_identical_rows compares name, status, source, kind, owner_role_id, trigger_type, trigger_config, definition.
    • api.ts: WorkflowCreate has status: WorkflowStatus, kind: WorkflowKind, owner_role_id (autobot-frontend/src/types/generated/api.ts ~L108279-108297); verify-generated-types and verify-generated-types-slm are success on the train head.

    Unblocks #21240 under #14409.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: company-osWave 4 · cluster A — Company OS & LLC canvasbackendbugSomething isn't workingneeds-ac-evidenceClosed by a merge keyword; awaits an AC evidence table comment (#19520)phase:M3.7Company OS, Automation and BI screens

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions