Skip to content

feat(use_github): allow forking allowed repositories into the bot account - #96

Open
mkmeral wants to merge 1 commit into
strands-agents:mainfrom
mkmeral:feat/strands-factory-use-github-forks
Open

mkmeral wants to merge 1 commit into
strands-agents:mainfrom
mkmeral:feat/strands-factory-use-github-forks

Conversation

@mkmeral

@mkmeral mkmeral commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

What and why

The use_github REST passthrough refused POST /repos/{owner}/{repo}/forks (resource 'forks' is not in the allowed set), so the agent had no sanctioned way to fork a repository. This admits exactly that endpoint, narrowly:

  • forks joins the repo-scoped REST families, but only as /repos/{owner}/{repo}/forks itself. Any deeper sub-path is refused at parse time.
  • GET (list forks) is a read. POST (fork) is a write. PUT, PATCH and DELETE are refused.
  • The source owner/repo must pass the existing owner allow-list (_target_allowed: a bare owner or an owner/repo glob). With no policy configured, the POST is refused, as for every other write.
  • A fork always lands in the bot's own account. The POST body may only hold name (a valid repository name, [A-Za-z0-9._-]{1,100}, not ./..) and default_branch_only (bool). organization is refused with a specific message, any other key is refused, and a query string on the POST is refused so options cannot bypass the body check.
  • The fork goes through the same path as other REST writes: the bot token, the external-write throttle keyed on the source repo (bare internal owners exempt, repo-glob targets counted), and the write audit.
  • ForkEvent is added to the throttle's event tally (github_client._THROTTLED_EVENT_TYPES) and to the mention poller's write-audit events backstop (audit.WRITE_EVENT_TYPES; a parity test pins the two). A fork's event names its source repository, so it is metered and audited against the repo the allow-list checked.

Also:

  • The use_github tool description gains one bullet in its list of REST uses (tool spec fixture updated).
  • docs/architecture.md states that a fork lands only in the bot account.
  • No GraphQL change: GitHub's GraphQL API has no fork mutation.

Kind of change

Behavior: changes what the agent's use_github tool allows and what the mention poller's write audit counts. No infra, IAM or workflow change.

Note for deployers

A later push to the fork lands in the bot's own account. The write audit flags any repository outside the profile's managed_repositories, so add the bot's own login (or <bot>/<repo> entries) there if pushes to forks are expected.

Checks run locally (strands-factory/)

  • uv sync --locked --all-extras, python build.py web
  • ruff check .: clean
  • mypy harness/src/strandly cli/src/strandly_cli build.py: clean
  • pytest -q -p no:cacheprovider: 4845 passed, 18 skipped, 1 failed: test_runtime_reliability.py::test_the_body_does_not_see_the_heartbeat_as_its_last_job[/bin/sh], a timing-sensitive sandbox heartbeat test unrelated to this change; it passes when rerun on its own (3 of 3) and in CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant