feat(ai-project-generator): activity logs for AI task creation & estimate updates#204
Merged
Conversation
β¦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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 creationTask_Createdhistory row per AI-created task (message matches the manual create format).userDatathroughcreateTasksForSprintβ background estimator.aiTaskEstimator.jsβ activity log on estimate updatepersistEstimatewrites atask_total_estimatehistory row whenever the AI sets/updates an estimate β covering all three callers: AI bulk background, manual sidebar trigger, manual-create auto-estimate.convertToDisplayFormat).HISTORY.UserIdis arequiredString β 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 attributionuserName+userId); the controller forwards it asuserData, so the entry is attributed to the clicker andUserIdis never blank. This is what fixes the "manual trigger not logging" bug.AIProjectGenerator/controller.jsβ current-user name everywhereuidvia 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)
Task_Createdper task, type=task, correct project/task idsUserIdExisting functionality
π€ Generated with Claude Code