Skip to content

Add owner-approved discussion drafting and an owner cheat sheet - #493

Merged
robgruen merged 3 commits into
mainfrom
dev/robgruen/owner-discussion-pilot
Oct 30, 2026
Merged

robgruen merged 3 commits into
mainfrom
dev/robgruen/owner-discussion-pilot

Conversation

@robgruen

@robgruen robgruen commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add an owner-only /typechat draft workflow for Issues and Discussions that prepares a read-only draft, validates it after threat detection, and publishes an exact preview and immutable review artifact in the Actions summary.
  • Add a separate /typechat publish <artifact-id>:<body-sha256> workflow that posts only the owner's explicitly approved text through github-actions[bot]. Discussion posts are top-level comments.
  • Share the proven read-only model/tool/native-metric controls with the existing backlog assessment without changing its runtime settings beyond the empty shared prompt import.
  • Add the standalone owner cheat sheet, update the automation guide and rollout history, and expand PR CI to cover both workflows and the protocol helper.

Approval and safety boundaries

Drafting does not post, accept work, close threads, label items, or start implementation. Publishing approves only the exact comment, not implementation or merging.

The protocol checks the human owner, default-branch code, repository and artifact/run provenance, current policy/control fingerprints, thread snapshots, referenced PR revisions, and the approved body hash. Target-specific publishing jobs have only their required comment-write scope. Durable publication intents and existing-comment checks prevent blind retries after an uncertain write; stale drafts fail closed. No personal token or new bot secret is introduced.

The main drafting budget is 50 AI credits; the backlog's main budget remains 400. Threat detection retains its separate 400-credit default, so neither is a combined workflow cap. The future 1,000-credit implementation allowance and budget overrides remain documentation only.

Verification

  • 110 automation tests passed using Node 24.22.1, including actual workflow-script execution with mocked GitHub for both Issues and Discussions, approval withdrawal, stale context, exact size/page limits, provenance, and uncertain-write recovery.
  • Both workflows strictly compile with gh-aw v0.93.5, pinned runtime 32ecafbc061c9af57e9361942099e381102ae304; repeat compilation produces no generated-file drift.
  • Parsed backlog settings match current main, except the verified empty shared import.
  • Owner-guide and automation-document local links/anchors, staged whitespace, and preservation of the newer upstream README navigation checked.
  • Read-only GitHub API checks verified public thread queries, stable Actions-bot identity, and artifact/run/history response shapes.

Rollout and review

This branch is based on the latest main (a322637), with one new commit. No live drafting run or bot publication has been performed. Existing branch-review protections are unchanged, and the project-direction policy is not modified.

PR CI can validate this without merging. Full pre-merge end-to-end testing would use an isolated staging repository with explicitly pinned staging identity and available Copilot access; production comment triggers require these workflows on the default branch. Human review and explicit owner approval remain required. After deployment, record live verification before marking the pilot active.

Separate read-only drafting from exact-text owner-approved publication, preserve the backlog controls, and add an owner cheat sheet with regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 16:30
Comment thread tools/discussion-draft.mjs Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The timestamp comparison can reject valid drafts and block publication when sealing and artifact creation occur within the same second because their timestamp precision differs.

1 open issue
What changed in this PR

Adds owner-approved drafting and exact-text publication for Issues and Discussions, extending TypeChat’s automation beyond read-only backlog assessments without enabling work acceptance or implementation.

Changes:

  • Adds separate draft and publish workflows with approval, provenance, freshness, and duplicate-publication checks.
  • Shares read-only agent controls and expands workflow and protocol regression tests.
  • Adds an owner cheat sheet and updates rollout guidance; live verification remains pending.
File Description
tools/​tests/​discussion-workflows.test.mjs Checks workflow permissions, budgets, gates, and CI coverage.
tools/​tests/​discussion-draft.test.mjs Tests approval, validation, publication, and recovery behavior.
tools/​tests/​backlog-assessment.test.mjs Adapts contract tests to shared controls.
tools/​discussion-draft.mjs Implements draft sealing and approved-publication validation.
README.md Updates automation status and pilot milestones.
OWNER-CHEATSHEET.md Adds owner commands and recovery guidance.
AUTOMATION.md Documents the pilot, safeguards, budgets, and rollout.
.github/​workflows/​shared/​read-only-analysis.md Extracts shared model, tool, and diagnostic controls.
.github/​workflows/​publish-discussion-draft.yml Adds target-specific approved-comment publication.
.github/​workflows/​discussion-draft.md Adds context preparation, drafting, and sealing.
.github/​workflows/​backlog-assessment.md Imports shared read-only controls.
.github/​workflows/​backlog-assessment.lock.yml Regenerates the assessment with the shared import.
.github/​workflows/​agent-workflow-check.yml Expands compilation and test coverage.
.github/​copilot-instructions.md Documents approval boundaries for the discussion pilot.

Review effort: Balanced

Comment thread tools/discussion-draft.mjs Resolved
Cover HTML comment delimiters across every plain-text draft field and preserve escaped generic type and comparison text.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 16:37
Accept sealing and artifact creation within the same recorded second without changing sealed bytes, lower-bound ordering, or expiry checks. Add successful publication and invalid-ordering regressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Timestamp precision mismatches can permanently block valid drafts, while per-run artifact scans risk API-quota exhaustion and publication timeouts.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Avoid per-run artifact scans when checking publication history

tools/​discussion-draft.mjs:708

At the supported 1,000-run history limit, this loop makes roughly 1,000 artifact-list requests, and a single publication scans that history in both checkPublication and publishDraft. This consumes API quota and risks exhausting the publisher's 15-minute timeout, even when those runs have no relevant intent. Replace the per-run scan with a bounded lookup keyed by the draft artifact, while preserving detection of prior intents across runs and reruns.

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 30, 2026 16:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The publication gate does not ensure the exact candidate artifact undergoes a successful threat scan before sealing and publishing, especially for file-only candidates.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Scan the candidate artifact before sealing

.github/​workflows/​discussion-draft.md:91

The candidate JSON is uploaded separately, but the compiled detector downloads only agent/agent-output-fallback and can skip scanning when there are no safe outputs or patches. This gate therefore does not establish that the exact candidate later rendered and published underwent threat detection. Make the candidate artifact an explicit detection input, require an executed and successful scan before sealing, and add coverage for a file-only candidate.

Review effort: Balanced

@robgruen
robgruen merged commit 4c78c82 into main Oct 30, 2026
14 checks passed
@robgruen

Copy link
Copy Markdown
Contributor Author

The two remaining Copilot review-summary concerns are addressed in follow-up #494 (commit ba43644), since #493 was merged before these fixes were pushed.

  • Exact candidate scanning: stage the candidate JSON in detector input and require successful execution, a successful verdict, and a matching same-run/attempt SHA-256 scan binding before sealing. File-only candidates, skipped/failed scans, missing evidence, and changed bytes have regression coverage.
  • Bounded intent lookup: one exact-name repository-artifact request per phase, reading at most two matches. The regression reproduced 2,022 requests before the fix; the corrected publication cycle uses two. Prior intents across runs and reruns still block uncertain duplicate writes, and existing exact bot comments remain no-op retries.

All 123 automation tests pass on Node 24.22.1. Both workflows strictly compile with gh-aw v0.93.5, with zero warnings and no repeat-compilation drift. The backlog workflow, inference budgets, and read-only drafting permissions are unchanged.

No live drafting run or bot publication was performed. Please review and merge #494 before the first live draft/publish verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants