Skip to content

Workflow task document picker never loads and workspace documents are not per-task #1282

Description

@paullizer

Issue

Two related problems in the workflow builder (personal and group workspaces), on the Tasks step of the Create/Edit Workflow modal.

1. The workspace document picker never loads (bug)

Selecting a Document action of Search, Analyze, or Compare reveals the picker, but it never initializes:

  • Tags stays disabled showing Loading tags... forever, even when the workspace has no tags.
  • Document dropdown stays empty, even when the workspace has documents.
  • No browser console errors appear.

Clicking Refresh selected documents then warns Select one or more <workspace|group> documents in the picker first., which is confusing because the picker is empty and nothing can be selected.

2. Workspace documents are workflow-level, not per-task (enhancement)

The Workspace documents card lives inside the Tasks step but is bound to the workflow, not the selected task. Adding or switching tasks does not reset or restore the document configuration, and at runtime only the first task ever receives the document action.

Steps to Reproduce

  1. Open a workspace (personal or group) and go to the Workflows tab.
  2. Click New Workflow, fill in General and Trigger, and advance to Tasks.
  3. Under Workspace documents, set Document action to Search (or Analyze / Compare).
  4. Observe the Tags dropdown and the Document dropdown.
  5. Click Refresh selected documents.
  6. Click Add Task, then switch back and forth between tasks and observe the Workspace documents fields.

Expected Behavior

  1. Choosing a document action loads the picker: documents populate, and Tags resolves to either the available tags or No tags available for this scope.
  2. Refresh reloads the picker document list and re-applies the current selection.
  3. Each task owns its own workspace document configuration. Adding a task resets the fields; re-selecting a previously configured task restores that task's configuration; each task can target different documents.

Actual Behavior

  1. Tags is stuck on Loading tags... and the document list is empty. No console error.
  2. Refresh always warns that no documents are selected, because the picker never populated.
  3. The document configuration is shared across all tasks in the modal, and only task 1 actually uses it at run time.

Impact

Document-backed workflows cannot be created or edited through the UI at all — there is no workaround, since the picker is the only way to choose documents. Multi-task workflows also cannot use different documents per task, which limits sequenced document work (for example, analyze one document set in task 1 and compare a different set in task 2).

Notes

Suspected areas:

  • application/single_app/static/js/workspace/workspace_workflows.js
    • initializeWorkflowDocumentPicker() is the only caller of setEffectiveScopes() / ensureDocumentPickerReady(), it runs only on modal open, and it early-returns when the resolved action type is none — which is always the case for a new workflow.
    • The change handler on #workflow-document-action-type is updateDocumentActionFields(), which only toggles visibility and never loads the picker. Nothing throws, which is why there are no console errors.
    • applySelectedWorkspaceDocumentsToWorkflow() only applies the picker selection; it does not refresh the picker.
  • application/single_app/functions_workflow_runner.py
    • _execute_workflow_task_sequence() passes include_document_action=task_index == 0, so tasks 2..N always run with {'type': 'none'}.
  • application/single_app/functions_personal_workflows.py / functions_group_workflows.py
    • document_action is normalized at the workflow level only; _normalize_workflow_tasks() has no per-task document action.
  • Markup is mirrored in application/single_app/templates/workspace.html and templates/group_workspaces.html.

Backward compatibility: existing saved workflows should hydrate their workflow-level document_action onto task 1 only, matching how they actually executed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    Status
    Released

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions