Skip to content

fix(workflows): link the ai task in the step's wait log - #126479

Merged
trunk-io[bot] merged 1 commit into
masterfrom
posthog/workflow-ai-task-view-link
Nov 2, 2026
Merged

trunk-io[bot] merged 1 commit into
masterfrom
posthog/workflow-ai-task-view-link

Conversation

@mayteio

@mayteio mayteio commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

  • Workflow authors who map one field of an AI task result, such as result.final_message, see no "View task" link in the step's logs. Raised in https://posthog.slack.com/archives/C06GG249PR6/p1793374784759689.
  • The logs UI draws the link from the "Stored action result" line, which holds the task token only for a whole-result variable.

Changes

  • The "Waiting for the task to finish" log line now ends with the task token, so "View task" shows for every AI task step.
  • Mechanical: the token builder moves to aiTaskLogToken in hogflow-utils.ts.
  • The log viewer is unchanged.

How did you test this code?

Test rationale: a new case in the awaited-templates block of hog_function.test.ts fails if the wait log loses the token. The existing executor test still covers the stored-variable link.

Release status

  • No feature flag controls this change

Docs update

  • None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, Opus 5.5 (claude-opus-5-5)

Skills: /writing-tests, /writing-code-comments, /writing-pr-descriptions

More context for AI agents
  • Decisions: the test serves the per-team template under the real template id through a spy, because test files share the template table.
  • Read closely: nodejs/src/cdp/services/hogflows/actions/hog_function.ts

🤖 Generated with Claude Code


Created with PostHog Desktop from a PostHog Desktop task

The "View task" link only rendered when the step's output variable stored the whole task result. A step that maps one field, such as result.final_message, showed no link. The wait log now carries the task token whatever the step stores.

Generated-By: PostHog Desktop
Task-Id: 3b5f6117-59f1-4344-a15a-e1b97ef4effe
@mayteio mayteio self-assigned this Oct 30, 2026
@trunk-io

trunk-io Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane

This PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes.

✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

@posthog

posthog Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

PostHog Review · Deep · reviewed 21465b7

Nothing to post.

Step Status Result
Prepare the diff done 3 files, 1 chunk
Pick perspectives done 2 perspectives
Run review passes done 0 issues
Merge overlapping findings done 0 → 0
Validate findings done
Publish done Nothing to post

@hosthog

hosthog Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

HostHog preview — posthog-desktop-web

The previews for this PR have been torn down and no longer serve.

@mayteio
mayteio marked this pull request as ready for review October 30, 2026 16:26
@parameterai

parameterai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Risk: No findings

This PR appends the [Task:id|run_id] link token to the "Waiting for the task to finish" workflow log line and extracts the token builder into a shared aiTaskLogToken helper, replacing identical inline logic in the executor. The refactor preserves the original guards exactly, and the token values originate from PostHog's own task-creation API response rather than user input, so the only real risk — log/link injection — is ruled out by the frontend's character-class regex and React escaping.

Sentinel reviewed 21465b7 · Review settings

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team October 30, 2026 16:27

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Contained logging fix with regression coverage; no substantive review concerns or refusal grounds. The partial automated review does not count as independent assurance, but this change does not enter risky territory.

  • Author wrote 94% of the modified lines and has 7 merged PRs in these paths (familiarity STRONG).
  • PostHog Review (Deep) reviewed the current head (no findings) but skipped 1 changed file, so it does not count as assurance.
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 38L, 3F substantive, 56L/4F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1b-small (56L, 4F, single-area, fix)
stamphog 2.6.1 .stamphog/policy.yml @ 21465b7 · reviewed head 21465b7

@mayteio

mayteio commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

/trunk merge

@trunk-io
trunk-io Bot merged commit 894acd6 into master Nov 2, 2026
326 of 333 checks passed
@trunk-io
trunk-io Bot deleted the posthog/workflow-ai-task-view-link branch November 2, 2026 12:49
@deployment-status-posthog

deployment-status-posthog Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-11-02 13:17 UTC Run
prod-us ✅ Deployed 2026-11-02 13:43 UTC Run
prod-eu ✅ Deployed 2026-11-02 13:36 UTC Run

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant