Refactor CommentAuthor to support agent roles (Product, Designer, Engineer, Reviewer). This enables tracking which perspective an agent was using when it commented on a task.
data CommentAuthor = Human | Junior | System
deriving (Show, Eq, Read, Generic)
data Comment = Comment
{ commentText :: Text,
commentAuthor :: CommentAuthor,
commentCreatedAt :: UTCTime
}
data Role = Product | Designer | Engineer | Reviewer
deriving (Show, Eq, Read, Generic)
data CommentAuthor
= Human
| Agent Role
| System
deriving (Show, Eq, Read, Generic)
-- Comment stays the same, just uses new CommentAuthor
Update task comment to accept --role flag:
task comment <id> <message> [--role=<role>] [--json]
# Examples:
task comment t-123 --role=product "Here's the spec..." # Agent Product
task comment t-123 --role=engineer "Implementation notes" # Agent Engineer
task comment t-123 "My thoughts" # Human (no role)
Valid roles: product, designer, engineer, reviewer
{"author": {"agent": "product"}, "text": "...", "created_at": "..."}
{"author": "human", "text": "...", "created_at": "..."}
{"author": "system", "text": "...", "created_at": "..."}
Junior becomes Agent Engineer (backward compatibility)Junior author should be migrated or handled gracefully1. Omni/Task/Core.hs - Add Role type, update CommentAuthor
2. Omni/Task.hs - Update CLI docopt and move function to handle --role
3. Update JSON instances for new sum type structure
4. Database migration if comments are stored in SQLite (check schema)
1. Create comments with each role
2. Verify JSON serialization/deserialization roundtrips
3. Verify task show displays role correctly
4. Verify backward compat with existing Junior comments
5. Run bild --test Omni/Task.hs
Role type with Product, Designer, Engineer, Reviewer constructorsCommentAuthor refactored to Human | Agent Role | System--role flag works in CLItask show displays role nicely (e.g., "[product]" prefix or similar)
CHANGES REQUESTED: ## Code Review for t-306: Add Role to CommentAuthor for agent comments
Task Requirements Check
1. **
Roletype with Product, Designer, Engineer, Reviewer constructors** ✅data Role = ProductMgr | Designer | Engineer | ReviewerProductMgrinstead ofProductto avoid conflict withData.Semigroup.Product- good thinking2. **
CommentAuthorrefactored toHuman | Agent Role | System** ✅Human | Junior | SystemtoHuman | Agent Role | System3. **
--roleflag works in CLI** ✅task comment <id> <message> [--role=<role>] [--json]move'function with valid roles: product, designer, engineer, reviewer4. JSON serialization handles nested Agent structure ✅
ToJSON/FromJSONinstances implemented"human","system", or{"agent": "product"}5. Existing comments still parse (backward compat) ✅
"junior"and"Junior"parse toAgent Engineer"junior"maps toAgent Engineer6. **
task showdisplays role nicely** ✅formatAuthorfunction displaying[product],[designer], etc.Issues Found
1. Minor inconsistency in Role naming: The CLI uses
--role=productbut the Haskell type isProductMgr. This is documented and intentional (avoiding name conflict), but the JSON serialization needs checking.2. JSON serialization for Role: The
Roletype usesderiving Genericandinstance ToJSON Role/instance FromJSON Rolewithout customization. This means:ProductMgrwill serialize as"ProductMgr"not"product"The task spec says:
json {"author": {"agent": "product"}, ...}But with generic deriving, it will produce:
json {"author": {"agent": "ProductMgr"}, ...}This is a bug - the JSON output won't match the specified format.
3. SQLite field format: Uses
"agent:product","agent:engineer", etc. which is fine and handles backward compat with"junior"→Agent Engineer.Build/Test Status
The build and test output shows the file was processed (
* Omni/Task/Core.hs) but the output format is garbled with control characters. It appears to have completed without errors.Lint failed due to
lint: command not foundwhich is an environment issue, not a code issue.Critical Bug
The
Roletype needs custom JSON instances to serialize as lowercase strings ("product","designer", etc.) instead of the constructor names ("ProductMgr","Designer", etc.). The task spec is explicit about the JSON format:Currently, with generic deriving, it will produce
"ProductMgr"instead of"product".Fix needed: Add custom
ToJSONandFromJSONinstances forRolethat map:ProductMgr↔"product"Designer↔"designer"Engineer↔"engineer"Reviewer↔"reviewer"