diff --git a/emrg/server/open_source_prompt.md b/emrg/server/open_source_prompt.md index f120d9a..e7a5d50 100644 --- a/emrg/server/open_source_prompt.md +++ b/emrg/server/open_source_prompt.md @@ -381,6 +381,10 @@ Closes # - [ ] New tests added" ``` +> ⚠️ **PR submission rules (rant 2026-08-20T21:53:36 — supersedes earlier PR-issue linking notes)**: +> 1. **Base the PR on the DEFAULT branch.** Before opening a PR, check the target repo's default branch (`gh repo view --json defaultBranchRef`) and open the PR against it. GitHub only resolves closing keywords in the body/commit message into the linked-issue field when the PR base is the default branch; for any other base the linked field stays empty and bot checks like `needs:issue` never pass. If the repo explicitly requires a non-default base (e.g. per CONTRIBUTING), record in the state file that the check fails by design and is ignorable — do not keep retrying. +> 2. **Act on PR feedback the same round.** After creating the PR and in every reflection round, check bot/maintainer comments (`gh api repos///issues//comments`). A bot block comment is a hard signal: handle it that round — determine what the bot actually checks (linked-issue field vs body keywords), fix what is fixable, and record-and-ignore what cannot pass by design. Never self-confirm with "the body already says Closes" and shelve the block. +> 3. **For default-branch PRs, verify the issue is actually linked, not just mentioned in the body.** This prompt is Jinja2-rendered — use plain placeholders ``/``/`` (NOT Jinja2 double-brace delimiters, which would be silently erased). Verify via GraphQL `closingIssuesReferences`: `gh api graphql -f query='{ repository(owner: "", name: "") { pullRequest(number: ) { closingIssuesReferences(first: 5) { nodes { number } } } } }'` — `gh pr view --json linkedIssues` FAILS on gh ≤ 2.58 (unknown field). If empty, attempt association via the GraphQL `addLinkedIssues` mutation (`mutation { addLinkedIssues(input: {issueId: ..., linkedPullRequestId: ..., relationship: CLOSES}) }`) — REST `POST /pulls//issues` is 404 and `gh pr edit` does not manage linked issues. If association still fails, record it in the state file and ask in the PR thread instead of assuming it worked. > ⚠️ **Publishing spec (rant 2026-08-20T14:10:28 — comment double-encoding bug)**: > 1. **Always pass RAW text as the body of any comment / discussion / issue / PR** — write the body to a file with a heredoc and submit via `--field body=@file` (or `$(cat file)` / inline text). **NEVER** use patterns like `python3 -c "import json; print(json.dumps(...))"` that JSON-serialize the body before submitting — GitHub renders the escaped literal as-is (中文→`\uXXXX`, newlines→literal `\n`, quotes wrapped), producing garbled text. > 2. **Always read back and verify the posted body**: after posting, fetch the comment and check that the first character is NOT `"` and the text contains no `\uXXXX` residuals. If garbled, fix immediately with `updateDiscussionComment` (or the equivalent edit mutation) using the decoded original.