Repository navigation
factory: comment on a job's issue from the app, and the manager's read of each new comment - #2109
Merged
Merged
Conversation
…e manager's read of each new comment factory.issue_comment posts the person's words on the job's GitHub issue with their own sign-in and keeps the comment on the job. The poll's read of every new comment records what the job's manager did with it (comment_reads): context for people without write access, an ask in the manager conversation on a job with a run under way, nothing on a job not started or finished. The first version never adopts a comment on its own.
…mment # Conflicts: # internal/factory/api/jobs.go
santoshkumarradha
marked this pull request as ready for review
November 2, 2026 01:03
santoshkumarradha
added a commit
that referenced
this pull request
Nov 2, 2026
…y declares #2109 and this branch each added the same constant and the same helper with identical bodies; the merge keeps app/v3's declarations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
santoshkumarradha
added a commit
that referenced
this pull request
Nov 2, 2026
…newest or its stub (#2111) * factory: a job keeps its brief versions, and factory.job_brief reads the newest or its stub The job keeps its last 20 BriefVersions on the item. The facts row is computed from the steps' structured results (test counts or exit, findings, proof claims shown of total, rule checks), and a job with no version is answered a stub from engine data alone. GET /v1/jobs/{id}/brief answers the newest version, its status and the keys changed since a rev; the job read carries the brief's rev and status. The Brief block palette is Go types with its limits as faults. The hello says factory.job_brief. * factory: gofmt the brief mark * factory: one spelling for a route a factory does not serve; brief write states are status words * changes: the job brief entry * factory: keep the one EndpointNotFound and routeMissing app/v3 already declares #2109 and this branch each added the same constant and the same helper with identical bodies; the merge keeps app/v3's declarations. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
santoshkumarradha
added a commit
that referenced
this pull request
Nov 2, 2026
…cked by the factory before it is kept (#2116) * factory: a job keeps its brief versions, and factory.job_brief reads the newest or its stub The job keeps its last 20 BriefVersions on the item. The facts row is computed from the steps' structured results (test counts or exit, findings, proof claims shown of total, rule checks), and a job with no version is answered a stub from engine data alone. GET /v1/jobs/{id}/brief answers the newest version, its status and the keys changed since a rev; the job read carries the brief's rev and status. The Brief block palette is Go types with its limits as faults. The hello says factory.job_brief. * factory: gofmt the brief mark * factory: one spelling for a route a factory does not serve; brief write states are status words * changes: the job brief entry * factory: the brief's writer, one small errand on the job's agent, checked by the factory before it is kept The factory assembles the writer's input (issue, plan, each step's try, change stats and hunk index, rules, facts, the brief before) and hashes it; POST brief/begin decides whether to write (unchanged inputs, a write under way, the cost guard of $0.03 a version and 5% of the job's spend, held back except for an ask, the end or a retry) and marks it generating. The engine asks the job's agent one errand under the new brief role on the small-work tier and hands the answer to POST brief/keep, which checks it against the job (palette limits, evidence that exists, every number in its evidence), keeps what passes, counts the drops and books the cost to the job. Runner progress news and step or model edits trigger it, ten seconds debounced. factory.job_brief_write is the page's Retry; the hello says factory.job_brief_writer. * factory: the change's stat is evidence of its own; the replay prices the brief role as an errand * factory: one rule for the triggers the cost guard lets through * changes: the brief writer entry * factory: keep the one EndpointNotFound and routeMissing app/v3 already declares #2109 and this branch each added the same constant and the same helper with identical bodies; the merge keeps app/v3's declarations. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 2, 2026
santoshkumarradha
added a commit
that referenced
this pull request
Nov 2, 2026
…t reads it (#2119) * factory: a job keeps its brief versions, and factory.job_brief reads the newest or its stub The job keeps its last 20 BriefVersions on the item. The facts row is computed from the steps' structured results (test counts or exit, findings, proof claims shown of total, rule checks), and a job with no version is answered a stub from engine data alone. GET /v1/jobs/{id}/brief answers the newest version, its status and the keys changed since a rev; the job read carries the brief's rev and status. The Brief block palette is Go types with its limits as faults. The hello says factory.job_brief. * factory: gofmt the brief mark * factory: one spelling for a route a factory does not serve; brief write states are status words * changes: the job brief entry * factory: the brief's writer, one small errand on the job's agent, checked by the factory before it is kept The factory assembles the writer's input (issue, plan, each step's try, change stats and hunk index, rules, facts, the brief before) and hashes it; POST brief/begin decides whether to write (unchanged inputs, a write under way, the cost guard of $0.03 a version and 5% of the job's spend, held back except for an ask, the end or a retry) and marks it generating. The engine asks the job's agent one errand under the new brief role on the small-work tier and hands the answer to POST brief/keep, which checks it against the job (palette limits, evidence that exists, every number in its evidence), keeps what passes, counts the drops and books the cost to the job. Runner progress news and step or model edits trigger it, ten seconds debounced. factory.job_brief_write is the page's Retry; the hello says factory.job_brief_writer. * factory: the change's stat is evidence of its own; the replay prices the brief role as an errand * factory: a brief's spot opens on its own hunks with the writer's notes; factory.job_brief_spot reads it Spots are numbered as a version is kept, and a spot may carry the writer's one-line notes on its hunks, each checked to name a hunk of its file. GET /v1/jobs/{id}/brief/spots/{spot} answers the hunks of the spot's file in the job's change, narrowed to its symbol when a hunk names it, with the notes as annotations after their hunks. The hello says factory.job_brief_spot. * factory: one rule for the triggers the cost guard lets through * changes: the brief writer entry * changes: the brief spot entry * factory: keep the one EndpointNotFound and routeMissing app/v3 already declares #2109 and this branch each added the same constant and the same helper with identical bodies; the merge keeps app/v3's declarations. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
What the job page needs
The job page's Issue tab lets people comment on the job's GitHub issue without leaving the app, and draws one quiet line under each comment the manager handled ("Manager read this · …"). This PR is the engine side of both.
Wire
Hello features (the app hides the comment box and the read lines unless announced):
factory.issue_comment: the engine serves the method below.factory.issue_comment_reads: job reads carry commentid/urlanddesk.comment_reads.factory.issue_commentParams (strict):
{"factory": "<connection id>", "job": 12, "body": "please cover the batch path too"}bodyis trimmed and must be 1 to 8000 characters (factory.IssueCommentMost). Noexpect: a comment changes nothing the person read.Result:
{"factory": {...}, "job": 12, "comment": {"author": "alice", "body": "…", "at": "2026-10-16T12:00:00Z", "id": "4401", "url": "https://github.com/acme/api/issues/12#issuecomment-4401"}}Errors:
bad_params(empty or too long; also an empty body from the factory's 422),conflict(the job has no GitHub issue, or the factory is older than the route: "This factory doesn't support that yet…"),forbidden("Your GitHub sign-in can't comment on owner/repo (HTTP 403); nothing was posted", for GitHub 403/404/410),signed_out/github_expired(GitHub 401; a factory sign-in token is ended),busy(GitHub 429),uncertain(transport failure, 5xx, or a yes without a receipt; the comment may have posted, nothing is retried).Factory route:
POST /v1/jobs/{id}/issue_commentwith{"body": "…"}→api.IssueCommentPosted. The comment is posted as the caller with the token of their own factory sign-in, never a host token; a solo factory uses its host's token (the host is the person), exactly as the pipeline pull request does. The words go as written, with no publication marker. The posted comment is added to the job's cached comments at once, so the next job read carries it.Job read additions (
desk)desk.comments[]gains optional fields:id,url,tier(owner|collaborator|stranger, the author's standing on the repo),by_factory(the factory's own publication comment).desk.comment_reads[](absent when none):{"comment_id": "4401", "at": "2026-10-16T12:01:00Z", "outcome": "asked", "line": "asked you in the manager chat whether the plan should change"}contextread as context · no write access to the reponothingthe job is finished · nothing to changenothingthe job hasn't started · its plan reads the issue's commentsaskedasked you in the manager chat whether the plan should changeadoptedAn
askedread also adds a manager line to the job's conversation (desk.thread, idcomment_<comment id>):@raj commented on the issue: “…”. I don't change the plan from a comment on my own. Should the plan change for it? Reply here with what to do.How reads are decided
Permissioncache), and marks the factory's own publication comments.factory.ReadComments(pure) runs inside the poll's merge, the one place the floor learns of comments. The comments a job first reads are its context and get no read. Every later comment with an id gets exactly one read. A comment posted from the app waits until the poll reads its author's standing (about a minute), so it is handled by the same path as any other comment. The factory's own comments get none. Reads keep the newest 20.The engine cannot tell a comment that narrows scope from one that widens it deterministically, so this first version never adopts. Every comment from someone with write access on an active job becomes an ask. The ask is a line in the manager conversation, not the job's blocking needs-you question: that question belongs to the run's own state machine, and a GitHub read must not change it under a running step. The person's reply in the manager chat reaches the manager as any reply does. No model is called.
Tests
internal/factory:TestReadCommentsFirstReadIsTheBaseline,TestReadCommentsOutcomes,TestReadCommentsWhenNoRunIsUnderWay.internal/factory/github:TestMergeHandsNewCommentsToTheManager.TestReadCarriesThePageCommentsFilesAndChecksnow also checks the comment id, URL, tier and the factory marker read through the real forge client.cmd/codeaf:TestAppFactoryIssueCommentAgainstTheRealServerruns the wire, the real factory server and store, with a GitHub in the test. It covers: hello announces both features; a person posts as themselves with their own token and the words alone; the next read carries the comment; the poll's read records oneaskedread and the manager line; GitHub 403 isforbiddenand the job is unchanged; empty or too-long words are refused before GitHub; a job with no issue is refused; an older factory's missing route is "doesn't support that yet".api.TestEveryFieldRoundTrips:Item.CommentsSeenis service-only and listed inLost; the other new fields round-trip.make test-touched BASE=origin/app/v3passes.cmd/codeafTestProcessActionsOpensALightCrewOwnerOncewas judged flaky;praf/githubTestFilesChecksAndOneIssuealready fails on app/v3.make manual-gatespasses.make pr-readystops atchangelog-checkon entries already on app/v3 that are not this PR's; this PR's entry passes.Limits
askedcomment does not pause the job or show as needs-you; it is a manager-chat question.read:user repo, which can. A token without it is refused asforbidden.id,urlorcomment_reads; the app shows no read line.