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
10 changes: 5 additions & 5 deletions .agents/skills/nemoclaw-contributor-create-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: Create or update a NemoClaw pull request with its authoring-session

# Create or Update a Pull Request

Session reporting follows v1 PR #13918 at `7238cbdff9`, retaining its notices and report contract. Main retains its publication and validation requirements.
Session reporting retains the format from v1 PR #13918. Main also accepts reports posted by repository maintainers, including when they take over an existing PR.

Before publication, follow [Validation](references/validation.md) and [Publication](references/publication.md). For an open PR, first follow the [PR follow-up contract](../_shared/pr-follow-up.md); route valid code repairs to `nemoclaw-contributor-implement-issue`. These references own trusted-base validation, source-repository selection, guarded writes, verified commits, DCO, draft handling, and review follow-up. Follow [Writing and review](../_shared/documentation-writing-review.md) for PR text.

Expand All @@ -22,19 +22,19 @@ When changing live E2E evidence, require the implementation handoff to apply [De
/tmp/pr-session-report report-comment.md
```

3. Publish through the [publication procedure](references/publication.md), preserving main’s description sections, DCO, and draft requirements. Read all pages of PR comments before posting, including after an uncertain retry; reuse an existing opening report by the PR author instead of duplicating it. If absent, post once as the PR author with `gh pr comment NUMBER --body-file report-comment.md`.
4. Read back the description and comments. Verify the description has no report, exactly one opening report by the PR author exists, and its contents match the intended report. Keep the exact summary `Authoring session — opening`. Validate the retrieved files with `/tmp/pr-session-report --pr description.md author-comment-1.md author-comment-2.md`; pass every PR-author comment, including later reports and unrelated comments. Comments by others are ignored; a maintainer's comment cannot substitute for an automated PR author's report.
3. Publish through the [publication procedure](references/publication.md), preserving main’s description sections, DCO, and draft requirements. Read all pages of PR comments before posting, including after an uncertain retry. Reuse an existing opening report from the PR author or a repository maintainer. If absent, either may post it with `gh pr comment NUMBER --body-file report-comment.md`. When a maintainer takes over an existing or automated PR, do not require the original author to post the report or add a separate takeover record.
4. Read back the description and comments. Verify the description has no report, exactly one eligible opening report exists, and its contents match the intended report. CI accepts the PR author and accounts with repository `maintain` or `admin` permission, verified through GitHub's collaborator-permission API. Keep the exact summary `Authoring session — opening`. Validate the retrieved files with `/tmp/pr-session-report --pr description.md report-comment-1.md report-comment-2.md`; pass comments from eligible accounts, including later reports and unrelated comments. Ignore reports from other accounts.
5. Follow checks and automated reviews on the latest commit. If the metadata job fetched comments before the opening report was posted, wait for that run to finish, then use `gh run rerun --job JOB_ID` for its failed `commit-lint` job. Select the job from this PR's latest-revision run; a rerun retains the original revision but fetches current comments. Reruns require repository write permission, so external contributors may need a maintainer. Confirm the rerun passes.

CI fetches the description and all comment pages on PR opening, updates, reopening, and description/title edits. It checks the presence and format of the PR author's opening report, not the truth or completeness of its evidence. Fetch failures fail the check. Comment posting, editing, or deletion alone does not trigger a refresh; rerun the metadata job after such changes.
CI fetches the description and all comment pages on PR opening, updates, reopening, and description/title edits. It checks the report's presence, format, and posting account's eligibility, not the truth or completeness of its evidence. Comment or permission fetch failures fail the check. Comment posting, editing, or deletion alone does not trigger a refresh; rerun the metadata job after such changes.

The check uses the candidate checkout's validator and workflow. It does not protect against a PR changing its own validation; trusted-base enforcement is outside this check's scope.

Preserve historical reports and their cutoffs. Optional later commit or merge reports may use the same collapsed format with a distinct summary and revision; they do not replace the opening report or create a publication requirement.

## Session Report

Report the session that wrote the change, up to a cutoff you state; if this session only publishes the PR, mark every row unavailable.
Report the session that wrote the change, up to a cutoff you state. When publishing or taking over a PR without the original authoring-session evidence, mark the fields unavailable; the report does not need to come from the person who wrote the change.
Give each row one status:

- `recorded`: the session record covers the whole session.
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/commit-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@ jobs:
mkdir -p "$input"
gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" --jq '.body // ""' > "$input/description.md"
gh api --paginate --slurp "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments?per_page=100" > "$input/comments.json"
jq -r --argjson author "$PR_AUTHOR_ID" '.[][] | select(.user.id == $author) | .body | @base64' "$input/comments.json" > "$input/author-comments.b64"
printf '%s\n' "$PR_AUTHOR_ID" > "$input/reporters.jsonl"
jq -r --argjson author "$PR_AUTHOR_ID" '.[][] | select(.user.id != $author and ((.body // "") | contains("<summary>Authoring session — opening</summary>"))) | .user.login' "$input/comments.json" | sort -u > "$input/reporters.txt"
while IFS= read -r login; do
gh api "repos/$GITHUB_REPOSITORY/collaborators/$login/permission" --jq 'select(.role_name == "maintain" or .role_name == "admin") | .user.id' >> "$input/reporters.jsonl"
done < "$input/reporters.txt"
jq -r --slurpfile reporters "$input/reporters.jsonl" '.[][] | select(.user.id as $id | $reporters | index($id)) | .body | @base64' "$input/comments.json" > "$input/report-comments.b64"
comments=()
while IFS= read -r encoded; do
path="$input/comment-${#comments[@]}.md"
printf '%s' "$encoded" | base64 --decode > "$path"
comments+=("$path")
done < "$input/author-comments.b64"
done < "$input/report-comments.b64"
"$RUNNER_TEMP/report-check" --pr "$input/description.md" "${comments[@]}"
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ owns the automated publication and review-follow-up workflow. The root

Every PR includes a collapsed opening [authoring-session report](.agents/skills/nemoclaw-contributor-create-pr/SKILL.md#session-report) comment, including existing and automated PRs.
Post the report when opening a PR, or on the next update to an existing PR.
The metadata job checks the PR author's posted comment and the shared template. Use unavailable fields when historical evidence is missing; preserve existing evidence and cutoffs. After posting, rerun a failed metadata job for the current PR revision. Comment events alone do not refresh this check.
The PR author or a repository maintainer may post the report, including when taking over an existing or automated PR. CI verifies maintainer eligibility through repository `maintain` or `admin` permission. Use unavailable fields when historical evidence is missing; preserve existing evidence and cutoffs. After posting, rerun a failed metadata job for the current PR revision. Comment events alone do not refresh this check.

After each revision, follow CI and review to completion. Address valid findings with a change, or
explain why they do not apply. Keep the PR description and validation evidence current.
100 changes: 80 additions & 20 deletions src/lib/onboard/__test-helpers__/compatible-endpoint-smoke-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ export function runProviderNeutralScript(options: {
denialBytes?: readonly number[];
denialOversized?: boolean;
directError?: "connection-refused" | "dns" | "timeout";
directAddresses?: readonly string[];
directOutcomes?: Readonly<
Record<
string,
"connection-refused" | "network-unreachable" | "host-unreachable" | "timeout" | "http-200"
>
>;
managedProxyResponses?: unknown[];
inferenceUrl?: string;
expectedAuthorization?: string;
Expand All @@ -191,7 +198,7 @@ export function runProviderNeutralScript(options: {
const prelude = `
import atexit
import errno
import io
import http.client
import json
import socket
import time
Expand All @@ -204,9 +211,15 @@ managed_proxy_responses = json.loads(${JSON.stringify(
)})
managed_proxy_enabled = ${options.managedProxyResponses === undefined ? "False" : "True"}
denial_bytes = ${denialBody}
direct_addresses = json.loads(${JSON.stringify(
JSON.stringify(options.directAddresses ?? ["192.168.65.254"]),
)})
direct_outcomes = json.loads(${JSON.stringify(JSON.stringify(options.directOutcomes ?? {}))})
inference_request_tokens = []
direct_request_count = []
direct_request_urls = []
direct_request_addresses = []
direct_request_hosts = []
managed_proxy_request_count = []
managed_proxy_request_urls = []
sleep_delays = []
Expand All @@ -216,6 +229,8 @@ def emit_request_evidence():
print("INFERENCE_REQUEST_TOKENS=" + ",".join(str(value) for value in inference_request_tokens))
print("DIRECT_REQUEST_COUNT=" + str(len(direct_request_count)))
print("DIRECT_REQUEST_URLS=" + ",".join(direct_request_urls))
print("DIRECT_REQUEST_ADDRESSES=" + ",".join(direct_request_addresses))
print("DIRECT_REQUEST_HOSTS=" + ",".join(direct_request_hosts))
print("MANAGED_PROXY_REQUEST_COUNT=" + str(len(managed_proxy_request_count)))
print("MANAGED_PROXY_REQUEST_URLS=" + ",".join(managed_proxy_request_urls))
print("SLEEP_DELAYS=" + ",".join(str(value) for value in sleep_delays))
Expand All @@ -236,6 +251,12 @@ class FakeResponse:
return b"x" * (size if size >= 0 else 1048577)
return self.payload if size < 0 else self.payload[:size]

class FakeDirectResponse:
def __init__(self, status):
self.status = status
def read(self, size=-1):
return denial_bytes if size < 0 else denial_bytes[:size]

class FakeOpener:
def open(self, request, timeout):
if request.full_url == ${JSON.stringify(options.inferenceUrl ?? "https://inference.local/v1/chat/completions")}:
Expand All @@ -246,22 +267,65 @@ class FakeOpener:
inference_request_tokens.append(
request_data.get("max_tokens", request_data.get("max_completion_tokens"))
)
if responses[0] == "__timeout__":
raise TimeoutError("timed out after %s seconds" % timeout)
if responses[0] == "__wrapped_timeout__":
raise urllib.error.URLError(TimeoutError("timed out after %s seconds" % timeout))
return FakeResponse(200, responses.pop(0))
direct_request_count.append(1)
direct_request_urls.append(request.full_url)
if direct_error == "connection-refused":
raise urllib.error.URLError(ConnectionRefusedError(errno.ECONNREFUSED, "refused"))
if direct_error == "dns":
raise urllib.error.URLError(socket.gaierror(socket.EAI_NONAME, "not known"))
if direct_error == "timeout":
raise urllib.error.URLError(TimeoutError("timed out"))
raise urllib.error.HTTPError(
request.full_url,
403,
"Forbidden",
{},
io.BytesIO(denial_bytes),
raise RuntimeError("unexpected direct request through inference opener")

def fake_getaddrinfo(host, port, type=0):
if direct_error == "dns":
raise socket.gaierror(socket.EAI_NONAME, "not known")
return [
(
socket.AF_INET6 if ":" in address else socket.AF_INET,
socket.SOCK_STREAM,
socket.IPPROTO_TCP,
"",
(address, port, 0, 0) if ":" in address else (address, port),
)
for address in direct_addresses
]

class FakeSocket:
def __init__(self, family, type):
self.address = None
def __enter__(self):
return self
def __exit__(self, exc_type, exc, traceback):
return False
def settimeout(self, timeout):
pass
def connect(self, sockaddr):
self.address = sockaddr[0]
direct_request_count.append(1)
direct_request_urls.append(direct_url)
direct_request_addresses.append(self.address)
outcome = direct_outcomes.get(self.address, direct_error)
if outcome == "connection-refused":
raise ConnectionRefusedError(errno.ECONNREFUSED, "refused")
if outcome == "network-unreachable":
raise OSError(errno.ENETUNREACH, "network unreachable")
if outcome == "host-unreachable":
raise OSError(errno.EHOSTUNREACH, "host unreachable")
if outcome == "timeout":
raise TimeoutError("timed out")

class FakeHTTPConnection:
def __init__(self, host, port, timeout):
self.sock = None
def request(self, method, path, body, headers):
direct_request_hosts.append(headers.get("Host"))
def getresponse(self):
outcome = direct_outcomes.get(self.sock.address, direct_error)
return FakeDirectResponse(200 if outcome == "http-200" else 403)
def close(self):
pass

socket.getaddrinfo = fake_getaddrinfo
socket.socket = FakeSocket
http.client.HTTPConnection = FakeHTTPConnection

class ManagedProxyOpener:
def open(self, request, timeout):
Expand All @@ -276,11 +340,7 @@ class ManagedProxyOpener:
return FakeResponse(200, managed_proxy_responses.pop(0))

def build_test_opener(*handlers):
proxy_disabled = any(
isinstance(handler, urllib.request.ProxyHandler) and handler.proxies == {}
for handler in handlers
)
if managed_proxy_enabled and not proxy_disabled:
if managed_proxy_enabled:
return ManagedProxyOpener()
return FakeOpener()

Expand Down
Loading
Loading