feat(github): route lifecycle writes through App connection
Merged
KH
4mo ago+1036+1036+0123456789012345678901234567890123456789-78-78-01234567890123456789
Advances #221
Outcome
- Adds an
AppGithubWritebackadapter from the connectedGithubConnectionWriteto the orchestratorGithubWritebacklifecycle port. - Extends the Relayfile connection writer with confirmed GitHub issue comments and issue label/state updates.
- Requires
confirmWriteto acknowledge every App mutation; pending, failed, or timed-out writes reject. - Extends the guarded cloud-mount allowlist only for canonical issue patches and Factory deterministic comment drafts.
Selection and attribution
- Exact
github.identity: "app"selects the App lifecycle adapter atFactoryLoopconstruction and refuses local-ghfallback when the capability is absent. autoanduserretain the current local-ghissue lifecycle behavior. ExistingautoPR publication remains App-preferred.- App mode sends PR publication, issue comments, lifecycle labels, and issue close through the workspace connection. Factory holds no GitHub credential; the server-side repo-capable App connection performs the provider mutation.
Deliberate scope
getIssueAuthor,getIssueStatus, andhasCommentMarkerremain absent because provider-authoritative App reads are tracked separately in relayfile-cloud#159; existing callers keep their conservative optional-read behavior.mergePolicy: "never"short-circuits real-issue merge-gate check/merge calls, sogh pr mergeis not ported.- Notion intake owns a separate
GhCliIssuePublishersurface and is unchanged.
Verification
npm run build- Changed-file suite: 685 passed across mount writer, writeback, orchestrator, and fleet CLI tests.
- Final selection regression run: 3 passed (App/no-token must-fire, default-
ghmust-not-fire, missing capability fail-loud). - Guarded mount regression: 1 passed.
git diff --checkand targeted credential-pattern scan passed.
Summary by cubic
Routes GitHub issue lifecycle writes (comments, status labels, close) through the connected App when github.identity is "app", preserving non-Factory labels and clearing all Factory lifecycle labels on "ready". The default "auto" keeps the local gh path for issues; "user" always uses gh.
- Exact "app" selects
AppGithubWritebackand refuses local-ghfallback if the mount lackspostIssueComment,ensureRepositoryLabel,mutateIssueLabel, orupdateIssue. Provider-authoritative reads stay optional on the adapter. - Adds App-authored issue writes to
GithubConnectionWritevia confirmed Relayfile drafts:- Deterministic comment drafts at
/issues/{n}/comments/factory-{sha256-24}.jsonbound to the comment body. - Canonical partial issue updates at
/issues/{n}.json(state-only for close). - Unique lifecycle label operations via
/labels/factory-{uuid}.jsonand/issues/{n}/labels/factory-{uuid}.json. confirmWritemust returnacked;pending,failed, or timeouts reject.
- Deterministic comment drafts at
- Mount guard scopes App lifecycle drafts:
- Always allow Factory-authored PR/ref/close artifacts.
- Allow issue comment/update/label drafts only for configured repositories with an in-scope open issue; validate filenames, bind comment names to body content, and require exact repository label name/color/description. Installed for both ordinary CLI cloud mounts and direct library mounts.
- Identity behavior: "user" always uses local
gh; "auto" prefers App for PRs while keepingghfor issue lifecycle. Notion intake’s GitHub publisher is unchanged.