Skip to content
Merged
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
4 changes: 4 additions & 0 deletions emrg/server/open_source_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ Closes #<N>
- [ ] 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/<owner>/<repo>/issues/<n>/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 `<owner>`/`<repo>`/`<n>` (NOT Jinja2 double-brace delimiters, which would be silently erased). Verify via GraphQL `closingIssuesReferences`: `gh api graphql -f query='{ repository(owner: "<owner>", name: "<repo>") { pullRequest(number: <n>) { closingIssuesReferences(first: 5) { nodes { number } } } } }'` — `gh pr view <N> --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/<n>/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.
Expand Down
Loading