Add comments support to Issue schema (CS-10724)#4395
Conversation
- Define Comment FieldDef with body (markdown), author (string), datetime - Add containsMany(Comment) field to Issue card - Render comments in Issue isolated template - Add add_comment agent tool with read-modify-write pattern - Update phase-2-plan.md to document comments support - 5 new tests for the add_comment tool Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The image is still accessible via the branch ref in the PR description. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6778fffe3a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds structured, append-only comments to the Software Factory Issue model and updates the agent/orchestrator loop to treat issue descriptions as immutable, using comments for ongoing context (including max-iteration blocking). This supports better auditability and avoids clobbering issue intent during automated updates.
Changes:
- Extend the darkfactory Issue schema with
comments: containsMany(Comment)and render comments in Issue templates. - Add
add_commenttool and centralizedaddCommentToIssue()read-modify-write helper; makeupdate_issuestripdescriptionand restrict agent-set statuses. - Update orchestrator loop behavior: set
in_progresson pickup, auto-markdoneonly onsignal_done+ passing validation, and log max-iteration failures as comments; update docs/prompts/skills accordingly.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/software-factory/tests/issue-scheduler.test.ts | Updates MockIssueStore to satisfy new addComment() interface method. |
| packages/software-factory/tests/issue-loop.test.ts | Expands mocks and adds coverage for orchestrator-owned transitions, comment logging, and project completion updates. |
| packages/software-factory/tests/factory-tool-executor.spec.ts | Adds integration coverage for add_comment and updates tooling config (darkfactoryModuleUrl). |
| packages/software-factory/tests/factory-tool-builder.test.ts | Adds read-patch-write tests, add_comment tool tests, and removes run_tests tool assertions. |
| packages/software-factory/src/test-run-execution.ts | Fixes Playwright waitForFunction arg placement and increases timeout for QUnit completion. |
| packages/software-factory/src/realm-operations.ts | Introduces ensureJsonExtension() and central addCommentToIssue() helper. |
| packages/software-factory/src/issue-scheduler.ts | Extends IssueStore with addComment() and optional updateProjectStatus(), normalizes .json paths, adds project completion update implementation. |
| packages/software-factory/src/issue-loop.ts | Implements orchestrator-owned status transitions, uses comments for max-iteration blocking context, and updates project completion logic. |
| packages/software-factory/src/factory-tool-builder.ts | Adds darkfactoryModuleUrl to config, implements read-patch-write updates, adds add_comment, removes run_tests. |
| packages/software-factory/src/factory-issue-loop-wiring.ts | Threads darkfactoryModuleUrl through ToolBuilderConfig. |
| packages/software-factory/src/darkfactory-schemas.ts | Adjusts buildCardDocument() to accept the darkfactory module URL (not derived from target realm). |
| packages/software-factory/scripts/smoke-tests/issue-loop-smoke.ts | Updates smoke-test mock store with addComment(). |
| packages/software-factory/scripts/smoke-tests/factory-tools-smoke.ts | Provides darkfactoryModuleUrl in smoke tool builder config. |
| packages/software-factory/realm/test-results.gts | Improves TestRun UI: empty status and module count styling tweaks. |
| packages/software-factory/realm/darkfactory.gts | Adds Comment FieldDef, Issue.comments, comment rendering, and status badges in Issue/Project templates. |
| packages/software-factory/prompts/ticket-implement.md | Reorders implementation steps; reinforces orchestrator-managed completion flow. |
| packages/software-factory/prompts/system.md | Documents immutable descriptions and clarifies validation pipeline behavior. |
| packages/software-factory/prompts/bootstrap-implement.md | Updates bootstrap naming conventions and completion signaling (signal_done instead of setting status). |
| packages/software-factory/docs/phase-2-plan.md | Documents comment system, immutable descriptions, orchestrator-owned transitions, project completion, and tooling behaviors. |
| packages/software-factory/.agents/skills/software-factory-operations/SKILL.md | Updates skill guidance for immutable descriptions and adds add_comment usage. |
| packages/software-factory/.agents/skills/software-factory-bootstrap/SKILL.md | Updates bootstrap conventions (project path/name, issue naming) and completion flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…n context - Add addCommentToIssue() to realm-operations.ts as centralized comment logic - Add addComment() to IssueStore interface; remove description from updateIssue - Refactor max-iteration blocking to use addComment instead of overwriting description - Strip description from update_issue agent tool (like status stripping) - Update skills, system prompt, and SKILL.md to document the rule - Add unit test for description stripping in update_issue - Add Playwright integration test for add_comment tool - Update phase-2-plan.md with immutable description design principle Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6b473ee to
4804a00
Compare
…ndling - Use Array.isArray() in addCommentToIssue to handle corrupt/non-array comments field gracefully - Separate try/catch blocks for addComment and updateIssue in the max-iteration blocking path so a comment write failure doesn't prevent the critical status transition to blocked Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| /** | ||
| * Ensure a card instance path ends with `.json`. The realm API uses | ||
| * `card+source` content negotiation which requires the full file path | ||
| * including extension. | ||
| */ | ||
| export function ensureJsonExtension(path: string): string { | ||
| if (!path.endsWith('.json')) { | ||
| return `${path}.json`; | ||
| } | ||
| return path; | ||
| } |
There was a problem hiding this comment.
runtime-common/url.ts seems to contain related json extension trimming, so maybe this could go there. up to you. ensureTrailingSlash above exists in runtime-common
Summary
CommentFieldDef withbody(MarkdownField),author(StringField), anddatetime(DateTimeField) fieldscontainsMany(Comment)field to the Issue card schemaadd_commentagent tool that appends structured comments to issues via read-modify-write patternupdate_issuestripsdescription, orchestrator uses comments for max-iteration blockingaddCommentToIssue()inrealm-operations.ts(used by both agent tool and orchestrator)Comment rendering preview (isolated template)
Design decisions
add_commenttool only adds — it cannot edit or delete existing comments.update_issuestripsdescription), theIssueStoreinterface (nodescriptioninupdateIssue), and in skills/prompts.addCommentToIssue()inrealm-operations.tsis the single implementation. Both the agent'sadd_commenttool and the orchestrator'sIssueStore.addComment()delegate to it.orchestrator) instead of overwriting the description.Test plan
add_commentappends a comment to an issue with no existing commentsadd_commentappends to existing comments without losing themadd_commentreturns error when issue doesn't existadd_commentpreserves existing relationshipsadd_commenttool is always built (no schema required)update_issuestripsdescription(descriptions are immutable)addCommentwithorchestratorauthoradd_commentappends comment without changing other fieldsCloses CS-10724
🤖 Generated with Claude Code