Skip to content

fix(platform): open the waiting run from a project agent's question - #5090

Closed
tale-code-bot wants to merge 3 commits into
mainfrom
fix/project-agent-question-notification-target
Closed

tale-code-bot wants to merge 3 commits into
mainfrom
fix/project-agent-question-notification-target

Conversation

@tale-code-bot

@tale-code-bot tale-code-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

An agent's question on a project run that works no task now opens the run in the bell, matching the email. Before, the bell opened the project's task board, which has no answer card. Task TALE-26, issue #3632.

Cause. The question's row names the project, the run, the ask and the automation (notifyAgentQuestionAsked, taskless arm).

  • In-app: personalNotificationTarget (lib/shared/notifications/target.ts) checked the projectId fallback before the run branch, so the bell and the REST export /notifications/sync?stream=personal opened /dashboard/<org>/projects/<projectId>/tasks.
  • Email: buildPersonalNotificationUrl already opened /dashboard/<org>/automations/<slug>/runs/<runId> for the same row.
  • The parity table only held the org-scoped question, which has no project, so the two builders disagreed without a failing test.

Fix. The run branch (runId + name) now runs before the project fallback, in the same order as the email builder.

  • Only notifyAgentQuestionAsked writes that pair, so no other notification type changes destination.
  • A question on a run that works a task still opens the task. A project row with no run still opens the board.
  • The email builder's logic is unchanged; its comment now says both cases.

Who receives it. For a taskless run, recipients are owners, admins and developers who can see the project (askAudienceUserIds), and they can all open the run detail. docs/en/platform/automations/approvals-in-workflows.md already says "Owners, Admins, and Developers answer on the run detail".

Commits

  1. fix(platform): the reorder and comments, the parity row in notification_link_cases.ts, and regression tests for the bell, the email and the REST export. Spec rule NOTIF-R3 now reads "a run with no task, in a project or not → the run".
  2. docs(manual): box NOTIF-F13a (click-through to the answer card) and its automation-register row.
  3. test(platform): runs the real emitter for a project's run with no task and gives the row it writes to both link builders. A key renamed on either side now fails a test.

Closes #3632

Checklist

  • bun run check: not run in full in my sandbox. This worker has a 4 GiB memory limit, and the full tsc needs the 6 GiB heap CI gives it.
    • CI on this head: Format, Lint, Knip, Type check and Unit (platform 1/2, platform 2/2, workspaces) pass (Checks run 40920535220).
    • The UI test shards were skipped in this PR run. The touched UI specs passed in my sandbox instead (151 passed, Test plan).
    • Also passed in my sandbox on this head:
      • oxlint --type-aware --type-check on the six touched files outside lib/shared (the platform's .oxlintrc.json ignores lib/shared);
      • tsc over a program rooted at all seven touched TypeScript files, 0 errors;
      • lint:manual;
      • oxfmt --check.
  • bun run lint:sast: not run in my sandbox. The pinned Opengrep binary isn't cached there, so the pre-commit scan skipped it. CI's Opengrep job (run 40920535049) was still pending when I checked.
  • Translations: N/A. No message key is added or changed; only the link of an existing notification changes.
  • Docs: N/A. docs/{en,de,fr}/platform/automations/approvals-in-workflows.md already describe answering on the run detail; the bell now matches them.
  • README: N/A. Nothing at README level changes.

Test plan

All commands run from services/platform, on head 1121f090598261ba7eefb869a066f3566102f9e0.

Fail before the fix (tests only; target.ts as on main 9be5cadacb5f):

Command Result
bunx vitest --run --config vitest.ui.config.ts app/features/notifications/lib/notification-target.test.ts app/features/notifications/lib/notification-target.parity.test.ts 2 failed / 99 passed: opens the run for a question on a project run with no task [NOTIF-R3] and the agent_escalation parity row. The bell returned /dashboard/org_case/projects/proj_1/tasks.
bunx vitest --run --project server backend/core/notifications/personal_notification_url.test.ts backend/rest/v1-notifications.test.ts 1 failed / 29 passed: the export's path was /dashboard/org/projects/project%2Fone/tasks. The email test already passed: the email was right all along.
bunx vitest --run --project server backend/domains/collab/service.test.ts -t "links a question on a project run with no task" Failed: for the emitted row the bell returned /dashboard/org-1/projects/proj-1/tasks.

Pass on this head:

Command Result
The UI command above, plus app/features/notifications/components/notification-list-panel.test.tsx and app/features/notifications/components/notification-bell.test.tsx 4 files, 151 passed
bunx vitest --run --project server backend/core/notifications/personal_notification_url.test.ts backend/rest/v1-notifications.test.ts backend/domains/collab/service.test.ts backend/core/collab/coalesce.test.ts backend/domains/automations/store.terminal-asks.test.ts tests/guards/domain-specs.guard.test.ts 6 files, 105 passed
bunx oxlint --type-aware --type-check on the six touched files outside lib/shared 0 warnings, 0 errors. A deliberate type error in a scratch file (deleted afterwards) was reported as TS2322.
tsc with the platform's config, over a program rooted at the seven touched TypeScript files 0 errors (2,546 files)
bun run lint:manual ok
oxfmt --check on the changed files clean

Not run:

  • A live stack: no API readback against a running server, and no rendered-UI click. The REST export test drives the real /notifications/sync handler with the store mocked.
  • The manual click-through is box NOTIF-F13a in tests/manual/suites/notifications.md:
    1. Park a project's automation run on ask_human with no task subject.
    2. As an owner, admin or developer who can see the project, click the bell row. Expected: the run detail with The agent needs your answer to continue.
    3. The email's link should open the same run.

An agent that asks a question on a project's run that works no task
writes a row naming the project, the run and the automation. The bell
and the REST export opened the project's task board, which has no answer
card, while the email already opened the run: the in-app target tried
the project fallback before the run.

The run now comes before the project fallback, as in the email link.
Only an agent's question carries both the run and the automation name,
so no other row changes where it leads.
NOTIF-F13a clicks through from the bell to the answer card; the unit
specs that hold the link's three paths are listed in the suite's
automation coverage.
The link tests for a question on a project run with no task build the
row by hand. This one runs the real emitter, notifyAgentQuestionAsked,
and gives the row it writes to the bell's target and the email's link:
both open the run. A key renamed on either side now fails a test
instead of sending people to the project's board.

The automation register lists the spec for NOTIF-F13a.

@tale-review-bot tale-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved at 1121f090598261ba7eefb869a066f3566102f9e0.

Checked

  • Diff: read in full, all 10 files.
    • In personalNotificationTarget, the runId + name branch now comes after the task branch and before the project-only fallback, the same precedence as buildPersonalNotificationUrl.
    • Only notifyAgentQuestionAsked (agent_escalation) writes runId together with name. notifyAutomationMessage writes automation/runId and no name, so no other row type changes target.
    • Task-bound asks still open the task.
  • Access: a taskless project ask goes only to owners, admins and developers who can see the project (askAudienceUserIds). /dashboard/$id/automations/* admits exactly those roles (AutomationsAccessGate), so every recipient can open the run.
  • Tests run locally, credentials unset:
    • vitest.ui.config.ts (notification-target, parity): 101 passed.
    • --project server (personal_notification_url, v1-notifications, collab service, domain-specs guard): 93 passed.
  • Regression proof: with lib/shared/notifications/target.ts reverted to base 9be5cada, 4 of the new tests fail. They are the bell, the agent_escalation parity row, the REST export and the real-emitter test, each getting /projects/<id>/tasks instead of the run. The controls and the email test pass.
  • Contract:
    • branch fix/…, commitlint-shaped commits and title, Closes #3632;
    • the NOTIF-R3 card has an example and its tests name it;
    • box NOTIF-F13a and its register row are in.
  • CI on this head: all seven CI ready checks pass (Checks run 40920535220, SAST 40920535049, Commitlint 40920535095).

Not run: the merge-queue tiers (UI, E2E, Build), the rendered click-through (NOTIF-F13a), and a live API readback.

@tale-review-bot
tale-review-bot added this pull request to the merge queue Oct 29, 2026
@yannickmonney
yannickmonney removed this pull request from the merge queue due to a manual request Oct 29, 2026
@yannickmonney yannickmonney reopened this Oct 29, 2026
@tale-review-bot

Copy link
Copy Markdown
Collaborator

Not landing yet. The green CI ready checks on the approved head 1121f090598261ba7eefb869a066f3566102f9e0 came from the pre-0da08205 workflows. (tale-review-bot, Reviewer run b123c4de, read at 22:32 UTC)

  • The newest runs: they were created by the 20:13–20:15 UTC close/reopen. They checked out the merge into the old base: Checks run 40947333208, job 123706037065, logged HEAD is now at 08006ba Merge 1121f090598261ba7eefb869a066f3566102f9e0 into 9be5cadac.
  • What they skipped: in that run, UI (platform n/4) and UI read skipped. So the heavy suites that .github/CI.md ("Landing on main") now requires on the pull request never ran on this head.
  • My approval of 1121f090598261ba7eefb869a066f3566102f9e0 stands. The head needs a fresh pull_request run first, from a close/reopen or a draft→ready, which now merges into 0da08205. Once every required check finishes green on that run, the Reviewer lands it with --match-head-commit 1121f090598261ba7eefb869a066f3566102f9e0.

@yannickmonney

yannickmonney commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Reopened so the checks run again. The 20:13–20:15 UTC reopen started its runs from a test merge into 9be5cada (before 0da08205), because GitHub had not refreshed it yet. This reopen's runs start from the test merge 5eeb62b05e, into 0da08205. The head is unchanged (no new commit).

@yannickmonney

Copy link
Copy Markdown
Contributor

Landed on train as 181cc9f: squashed at the approved head after the fast gate (formatting, typecheck, build). It reaches main with the merge train's pull request, so this pull request closes without merging.

yannickmonney pushed a commit that referenced this pull request Oct 30, 2026
Reviewed and approved in pull request #5090 at 1121f09.

Closes #3632
Task: TALE-26
@yannickmonney
yannickmonney deleted the fix/project-agent-question-notification-target branch October 30, 2026 10:32
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.

Bug: Project-scoped agent questions open the task board instead of the waiting run

3 participants