Skip to content

Persist and surface Human-in-the-Loop (HITL) responses + write to task/audit logs #53683

@cmarteepants

Description

@cmarteepants

Description

Follow up to PR #53035 (initial HITL UI)

UI currently collects a user's response but does not persist it, surface it on reopen, or record it in logs. This limits audibility and user feedback.

Problem Statement

  • Approving users can't see what they (or someone else) selected after the fact
  • Airflow Admins and Users do not have no immutable record of who responded, when, and with which option
  • Debugging HITL-related failures is harder because the chosen value is absent from task logs

Proposal / Requirements

1. Persist response:

  • Store things like user_id, option_value, option_label and responded_at in the database when a HITL trigger is resolved
  • API: Extend API to return the saved payload

2. Surface response in UI payloads: Endpoints should include the stored response under a key like hitl_response

3. Log for audibility:

  • After successful save, write a structure line to task logs like [HITL] user=alice option="Approve" at 2025-07-23T14:02:11Z
  • Emit the same data to the Airflow audit log if enabled

4. UI fallback:

  • If hitl_response exists, display a read-only banner: Responded “Approve” by Alice at 14:02
  • Disable further edits unless the operator explicitly allows overrides.

Acceptance Criteria

  • Response data is persisted on backend and returned via API
  • Re-Opening the Action Required dialog shows the stored response
  • Task log contains the [HITL] entry with user, option, timestamp

Out of Scope

  • UI changes beyond showing stored value
  • Restrictions on who can edit an existing response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

area:APIAirflow's REST/HTTP APIarea:UIRelated to UI/UX. For Frontend Developers.area:loggingkind:featureFeature Requests

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions