You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0be7147
Browse filesBrowse the repository at this point in the historyBrowse files
Address Copilot round 5 on F2d: verified draft state, re-read before drafting, title mentions, deadline budget
- markDraft and refresh poll the read-back for the requested draft or
ready state and fail if GitHub never shows it, so a publish stays
retryable instead of recording a change that did not apply.
- Re-read the task, its review and its head right before drafting the
earlier PR; a stale publish no longer touches the current PR.
- Neutralise @-mentions in the unfenced PR title.
- The check's runner waits 1 s before SIGKILL and 0.5 s for pipes, so
the whole check settles in 13.5 s, below the 15 s request budget.
- AGENTS.md: grace periods count inside deadlines; read back external
state changes; neutralise mentions in unfenced titles.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,8 @@ Every reproduced race requires a failing-before and passing-after regression. As
73
73
- Check an operation's source-state preconditions before any shortcut or early return that writes state or reports success, not only on the main path.
74
74
- Honour a cancellation signal that is already aborted before the first durable write, not only after awaits: a path with no await otherwise writes after the caller cancelled.
75
75
- Batch and briefly cache read-only status probes, and give the combined operation an overall deadline below the serving request timeout.
76
+
- Count the subprocess shutdown grace periods (SIGTERM-to-SIGKILL wait, pipe drain) inside that overall deadline: the operation ends when its processes have settled, not when the abort fires.
77
+
- After an external state change (ready, draft, close), read the record back and require the new state before recording success; a command that exits 0 does not prove the change applied.
76
78
- Budget a multi-stage validation across all sequential stages; giving each stage the full request allowance does not create an overall deadline.
77
79
- Preserve the distinction between an explicit unbound identity and missing or malformed authorization metadata. Missing or malformed identities must fail closed.
78
80
- Validate every field used to classify an external record as clear, including enum values and required nullable fields. Partial records and malformed policy objects must fail closed.
@@ -109,7 +111,7 @@ Every reproduced race requires a failing-before and passing-after regression. As
109
111
110
112
- When a subprocess reports a problem only as a warning and carries on, decide pass or fail by what each message means for the result, not by whether anything was printed: fail on messages that mean it did less than it should (for example could not read a path), and let through messages about harmless input the agent controls. Test both a benign case and a failing case, and filter the output as it arrives so that no volume of benign messages can push a failure out of a bounded buffer.
111
113
- Quote or escape agent-controlled text (file names, paths, branch names) wherever it lands in output that people or tools parse, such as diffs, notices, logs or reports, so it cannot forge that output's structure.
112
-
- Neutralise issue references (`#N`, `GH-N`, `owner/repo#N`, issue URLs) in any text codeboost writes that can become a commit message, such as a PR title or description. Code fences do not protect commit messages, and GitHub closes issues from closing keywords in default-branch commits.
114
+
- Neutralise issue references (`#N`, `GH-N`, `owner/repo#N`, issue URLs) in any text codeboost writes that can become a commit message, such as a PR title or description, and neutralise @-mentions in any of that text that is not fenced (a title). Code fences do not protect commit messages, and GitHub closes issues from closing keywords in default-branch commits.
113
115
- Never spread a collection whose size follows unbounded input into function arguments (`Math.max(...runs)`); engines limit the argument count, so use a loop.
114
116
- A hardened Git invocation must also keep Git out of nested repositories and populated submodules, whose own config and hooks are the agent's: pass `--ignore-submodules` on the command line (the config default does not bind plumbing or override `.gitmodules`), and never run Git with a nested repository as its working directory.
Copy file name to clipboardExpand all lines: docs/implementation/pull-request-opening.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ A commit mentions the issue with `#12`, `GH-12`, `owner/repo#12`, or the issue U
42
42
- a closed issue with no close event;
43
43
- a linked item that is missing, of an unknown type, or in a malformed response;
44
44
- a GitHub error or invalid JSON;
45
-
- the whole check running past its single deadline (12 seconds by default, below the 15-second request budget). Reaching the deadline stops the running `gh` call.
45
+
- the whole check running past its single deadline (12 seconds by default). For the check the runner waits 1 second after SIGTERM before SIGKILL, and half a second for inherited pipes, so the whole check settles within 13.5 seconds, below the 15-second request budget. Reaching the deadline stops the running `gh` call.
46
46
47
47
A cancelled check throws. It does not return `unknown`.
48
48
@@ -69,7 +69,7 @@ Each opening or refresh owns the task state version at the moment it passed step
69
69
70
70
After an update, the read-back polls up to 5 times, half a second apart, until GitHub shows the pushed head, because GitHub updates a PR's head a moment after a push.
71
71
72
-
When the check matches (or is unknown) and the task's earlier PR is open and ready for review, publish turns it back into a draft. A task that is not being published as ready never leaves its PR ready for review. This happens before the check result is recorded: if it fails, the task is still running, and a retry checks again and repeats it. A PR-number mismatch is refused before any GitHub change.
72
+
When the check matches (or is unknown) and the task's earlier PR is open and ready for review, publish turns it back into a draft. A task that is not being published as ready never leaves its PR ready for review. This happens before the check result is recorded, after re-reading the task, its review and its head: if the task changed during the check, nothing is drafted. If the draft change fails, or GitHub does not show the PR as a draft afterwards, the task is still running, and a retry checks again and repeats it. A refresh likewise fails when GitHub does not show the requested draft or ready state. A PR-number mismatch is refused before any GitHub change.
73
73
74
74
The adapter refuses any answer for a PR that is not open. A PR closed between the lookup and the update is never recorded as the task's review PR.
75
75
@@ -83,7 +83,7 @@ The description starts with the marker and `Fixes #<issue>`. The plan follows, i
83
83
84
84
GitHub ignores closing keywords and @-mentions inside code. So plan text or agent output cannot notify people from the description, and cannot end the block: the fence is longer than any run of backticks in the text.
85
85
86
-
Fences do not protect commit messages. A squash or merge commit can carry the PR title and description, and GitHub acts on closing keywords in default-branch commit messages. So every issue reference in the title's summary, the plan and the problems is neutralised: `#7` becomes `#7`, `GH-7` gets a non-breaking hyphen, and `/issues/7` or `/pull/7` gets a division slash. Only the task's own `Fixes #<issue>` line and the title's `(#<issue>)` remain real references.
86
+
Fences do not protect commit messages. A squash or merge commit can carry the PR title and description, and GitHub acts on closing keywords in default-branch commit messages. So every issue reference in the title's summary, the plan and the problems is neutralised: `#7` becomes `#7`, `GH-7` gets a non-breaking hyphen, and `/issues/7` or `/pull/7` gets a division slash. Only the task's own `Fixes #<issue>` line and the title's `(#<issue>)` remain real references. The title is not fenced, so an @-mention in it would notify: `@name` becomes `@name` there.
87
87
88
88
Titles and problems are cut by code point, never inside a surrogate pair. An empty summary becomes `codeboost plan`.
// A draft change GitHub has not applied fails the refresh, so it stays unconfirmed and the next publish repeats it.
110
+
if(wantDraft!==undefined&&pr.draft!==wantDraft)thrownewError(`GitHub did not ${wantDraft ? 'turn the pull request into a draft' : 'mark the pull request ready'}.`);
if(task.status!==(draft ? 'needs human' : 'running'))thrownewGuardRefusal(`A ${draft ? 'draft ' : ''}pull request cannot be opened while the task is ${task.status}.`);
@@ -99,8 +100,11 @@ export class PullRequestPublisher {
99
100
if(earlier&&live&&earlier.state==='opened'&&live.number!==earlier.number)thrownewGuardRefusal('GitHub returned a different pull request for this branch.');
100
101
// A task that is not published as ready never leaves its PR ready for review: on a match its earlier ready PR becomes
101
102
// a draft. This comes before the result is recorded, so if it fails the task is still running and a retry repeats it.
102
-
// Making a PR a draft only lowers what it offers, so it needs no re-read of the task first.
0 commit comments