Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/discussion-draft.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .github/workflows/discussion-draft.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,15 @@ jobs:
- name: Validate and seal the draft
id: seal
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
TYPECHAT_AGENT_OUTPUT_TYPES: ${{ needs.agent.outputs.output_types }}
with:
github-token: ${{ github.token }}
retries: 0
script: |
if (process.env.TYPECHAT_AGENT_OUTPUT_TYPES !== "noop") {
throw new Error("Only a successful native noop completion can be sealed; missing, incomplete, or failure outputs are rejected.");
}
const path = require("node:path");
const { pathToFileURL } = require("node:url");
const helper = await import(pathToFileURL(path.join(process.env.GITHUB_WORKSPACE, "tools", "discussion-draft.mjs")).href);
Expand Down
6 changes: 5 additions & 1 deletion AUTOMATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,11 @@ it as completed work and skips the model. The model writes the candidate first,
then emits its native completion signal. If it emits no terminal safe output,
the pinned collector records an explicit `report_incomplete` signal rather than
treating silence as successful work. The detection guard consumes the collected
output types; a missing signal cannot authorize sealing.
output types. Before rendering or sealing an artifact, the trusted sealing step
requires `noop` to be the only collected output type. Missing or unknown outputs
and `report_missing_data` or `report_incomplete` reports fail sealing, including
reports combined with `noop`. Both reply writers require a successful seal, so
publication cannot race the later conclusion job's handling of failure reports.

The first owner-commanded [draft run](https://github.com/microsoft/TypeChat/actions/runs/41136773812)
on 2026-10-30 exposed this preflight behavior. The synthetic pre-agent no-op caused
Expand Down
13 changes: 12 additions & 1 deletion tools/tests/discussion-draft.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,18 @@ for (const [kind, mode] of [["issue", "draft"], ["discussion", "draft"], ["issue
const scanDirectory = downloadDirectory(sealing.find(step => step.name === "Download candidate scan binding"));
fs.mkdirSync(scanDirectory);
fs.copyFileSync(scanned.path, path.join(scanDirectory, "candidate-scan.json"));
const sealed = await execute(sealing.find(step => step.id === "seal"), draftRun);
const seal = sealing.find(step => step.id === "seal");
for (const outputTypes of [undefined, "", "report_missing_data", "noop,report_missing_data",
"report_incomplete", "noop,report_incomplete", "report_missing_tool", "unknown"]) {
delete process.env.TYPECHAT_AGENT_OUTPUT_TYPES;
await assert.rejects(execute(seal, draftRun, outputTypes === undefined ? {} : {
TYPECHAT_AGENT_OUTPUT_TYPES: outputTypes,
}), /Only a successful native noop completion can be sealed/);
assert.equal(fs.existsSync(path.join(temporary, "typechat-sealed-draft")), false,
`${outputTypes} must not produce a sealed artifact despite a valid candidate and successful scan`);
assert.equal(fixture.state.posts.length, 0);
}
const sealed = await execute(seal, draftRun, { TYPECHAT_AGENT_OUTPUT_TYPES: "noop" });
const bundle = readJson(path.dirname(sealed.path), "sealed-draft.json", MAX_BUNDLE_BYTES);
assert.equal(fixture.state.posts.length, 0);

Expand Down
12 changes: 12 additions & 0 deletions tools/tests/discussion-workflows.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,18 @@ test("draft preparation must not pre-complete the model with a native noop", ()
assert.ok(text.includes("After writing `discussion-draft.json`, call `safeoutputs-noop`"));
});

test("trusted sealing checks native completion before exposing an artifact to either writer", () => {
const seal = sourceSeal.find(step => step.id === "seal");
const generated = compiled.jobs.seal.steps.find(step => step.id === "seal");
assert.deepEqual(seal.env, { TYPECHAT_AGENT_OUTPUT_TYPES: "${{ needs.agent.outputs.output_types }}" });
assert.deepEqual(generated.env, seal.env);
assert.equal(generated.with.script, seal.with.script);
assert.equal(agent.outputs.output_types, "${{ steps.collect_output.outputs.output_types }}");
for (const kind of ["issue", "discussion"]) {
assert.ok(compiled.jobs[`reply_${kind}`].if.includes("needs.seal.result == 'success'"));
}
});

test("the compiled detection guard accepts collected outputs but never treats a missing signal as success", () => {
const working = fs.mkdtempSync(path.join(os.tmpdir(), "typechat-detection-guard-"));
try {
Expand Down
Loading