Skip to content

feat(ai-project-generator): activity logs for AI task creation & estimate updates#204

Merged
parth0025 merged 1 commit into
stagingfrom
feat/ai-activity-logs
Jun 1, 2026
Merged

feat(ai-project-generator): activity logs for AI task creation & estimate updates#204
parth0025 merged 1 commit into
stagingfrom
feat/ai-activity-logs

Conversation

@parth0025
Copy link
Copy Markdown
Collaborator

Summary

Adds task-level activity-log entries to the AI Project Creation flow so AI-created tasks and AI-generated estimates show up in each task's Activity tab β€” just like manual task actions β€” and attributes every entry to the current user (no more generic "AlianHub AI" label).

Closes the gaps from the screenshots: AI tasks had no "created" row, AI estimates had no "updated estimate" row, and the manual magic-wand trigger logged nothing.

What changed

orchestrator.js β€” activity log on AI task creation

  • Logs one Task_Created history row per AI-created task (message matches the manual create format).
  • Task-level only β€” the project Activity keeps its single "created project with N sprints and M tasks" summary instead of one row per task.
  • Threads userData through createTasksForSprint β†’ background estimator.

aiTaskEstimator.js β€” activity log on estimate update

  • persistEstimate writes a task_total_estimate history row whenever the AI sets/updates an estimate β€” covering all three callers: AI bulk background, manual sidebar trigger, manual-create auto-estimate.
  • "from X to Y" on a re-estimate, "set to Y" on a first estimate (shared convertToDisplayFormat).
  • Guard: HISTORY.UserId is a required String β€” an empty actor id would fail Mongoose validation and be silently swallowed, so the log is skipped rather than attempted with a blank id.

EstimatedTime/controller.js + TaskDetailRightSide.vue β€” manual trigger attribution

  • The magic-wand button now sends the logged-in user (userName + userId); the controller forwards it as userData, so the entry is attributed to the clicker and UserId is never blank. This is what fixes the "manual trigger not logging" bug.

AIProjectGenerator/controller.js β€” current-user name everywhere

  • Resolves the current user's display name from uid via the company roster (already loaded) instead of the hardcoded "AlianHub AI". Propagates to all AI activity logs (project / task / estimate).

Verification (deterministic, no DB/API calls)

Check Result
One Task_Created per task, type=task, correct project/task ids βœ…
Estimate history β€” "set to" (first) + "fromβ†’to" (re-estimate) βœ…
Empty-actor guard skips safely (no doomed write) βœ…
Manual trigger logs with a valid, non-blank UserId βœ…
Current-user name shown in task + estimate logs; no "AlianHub AI" βœ…
All touched files syntax-check βœ…

Existing functionality

  • Manual task/estimate flows untouched; the estimator remains fire-and-forget and never throws. History logging is best-effort (failures logged + swallowed) so it can't affect task creation or the estimate itself.

πŸ€– Generated with Claude Code

…mate updates

Adds task-level activity-log (history) entries to the AI flow so AI-created
tasks and AI-generated estimates appear in each task's Activity tab β€” the
same way manual task actions do β€” and attributes them to the current user.

orchestrator.js
- Logs one "Task_Created" history row per AI-created task (task-level only,
  so the project Activity keeps its single summary row instead of one per
  task). Threads userData through createTasksForSprint and the background
  estimator. Exposes createTasksForSprint for tests.

aiTaskEstimator.js
- persistEstimate now writes a "task_total_estimate" history row whenever
  the AI sets/updates an estimate β€” covering all three callers at once
  (AI bulk background, manual sidebar trigger, manual-create auto-estimate).
- "from X to Y" on a re-estimate, "set to Y" on a first estimate, rendered
  with the shared convertToDisplayFormat helper.
- Guards against a blank actor id: HISTORY.UserId is a required String, so
  an empty value would fail Mongoose validation and be silently swallowed.

EstimatedTime/controller.js + TaskDetailRightSide.vue
- The manual AI-estimate trigger now sends the logged-in user (userName +
  userId); the controller forwards it as userData so the entry is attributed
  to the clicker and UserId is never blank.

AIProjectGenerator/controller.js
- Resolves the current user's display name from uid via the company roster
  (already loaded) instead of the hardcoded "AlianHub AI" label, so every
  AI activity-log entry (project / task / estimate) shows the real person
  who triggered the run β€” matching the manual flow.

Verified (no DB/API needed): one Task_Created per task with correct
project/task ids; estimate history both message variants; empty-actor guard
skips safely; current-user name propagates to all entries with no
"AlianHub AI" remaining.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@parth0025 parth0025 self-assigned this Jun 1, 2026
@parth0025 parth0025 merged commit 814301e into staging Jun 1, 2026
2 checks passed
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