Skip to content

Bootstrap the ai-integrations monorepo: governance, CI, release pipeline, Python template - #1

Merged
brianstrauch merged 11 commits into
mainfrom
bootstrap
Sep 3, 2026
Merged

brianstrauch merged 11 commits into
mainfrom
bootstrap

Conversation

@DABH

@DABH DABH commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

What

Bootstraps the repository for the plan in the ai-integrations design doc. No plugin code yet; the Python openai_agents history import follows in a stacked PR.

  • CI (.github/workflows/ci.yml): one entry workflow. detect_changes.py maps changed files to per-language plugin matrices (plugins auto-discovered from manifests; shared paths fan out to a whole language); conventions enforces repository invariants and runs the tooling tests; _python-plugin.yml runs once per selected plugin (plugin is a parameter, never a per-plugin workflow); ci-status is the only required check. Nightly newest/lowest dependency lanes are advisory. No secrets anywhere: test suites run offline from recorded cassettes.
  • Release (.github/workflows/release-python.yml): scoped tags python/<plugin>/v<version>; validates the tag against the manifest and the version policy (pypi.org is the source of truth; first release exactly 1.0.0 or 0.1.0), builds once, publishes to TestPyPI via OIDC trusted publishing (pypa/gh-action-pypi-publish, no stored tokens, publish jobs inline because PyPI cannot bind reusable workflows), smoke-installs from TestPyPI in a clean project, publishes finals to PyPI behind the pypi environment, and drafts a GitHub release with notes generated from commit history (no changelog files).
  • Python shared tooling: python/_shared/python.mk (every task is a plain uv command; UV_NO_EDITABLE exported because an editable install cannot resolve temporalio.contrib.<name> from src/), python/_template/ (uv_build namespace layout, exclude-newer = "2 weeks" with temporalio exempted, plugin.toml metadata, LICENSE symlink to the root license, pruned conftest with record/replay and a provenance guard).
  • Migration tooling: scripts/migrate/extract-sdk-python.sh (git-filter-repo 2.47.0, history-preserving, Migrated-From trailers, issue refs repointed) and scripts/new_python_plugin.py.

Verified locally

  • cd scripts && uv run --locked pytest -q: 69 passed (change detection rules, matrix profiles, tag parsing, version policy, release notes, conventions, a real wheel/sdist build with tampering detection, workflow SHA-pinning/no-secrets/no-cancel-in-progress checks).
  • check_conventions.py passes on this zero-plugin tree; detect_changes.py --dry-run --base origin/main selects nothing, so ci-status should pass here with the plugin job skipped.
  • Packaging probes (scratch project): uv_build dotted namespace wheel has no parent __init__.py; exclude-newer-package = { temporalio = false } resolves temporalio 1.32.0 under the two-week cooldown; a symlinked LICENSE builds into both wheel and sdist; the overlap with temporalio<=1.32 behaves exactly as the provenance guard assumes.
  • History extraction dry run against sdk-python main: 101 commits, 18 author identities, single root commit OpenAI agents support (#898), trailers on every commit, 0 tags.

How to merge

Please use "Create a merge commit" for this PR: the import PR is stacked on this branch, and keeping these commit SHAs on main keeps its diff limited to the import.

Follow-ups that need an admin (not in this PR)

  • Grant @temporalio/ai-sdk access to the repo (CODEOWNERS is ignored until the team has access; today only security: pull is configured).
  • Create environments testpypi (tag policy python/*/v*) and pypi (same plus required reviewers); rulesets for main (ci-status required, no linear history) and tags */*/v*; TestPyPI and PyPI pending trusted publishers for temporalio-openai-agents.

Comment thread .github/workflows/_python-plugin.yml Resolved
DABH added 7 commits September 1, 2026 21:58
AGENTS.md is the single normative guide (design decisions, invariants,
CODEOWNERS assigns everything to @temporalio/ai-sdk. Dependabot covers each
plugin lockfile, the tooling project and pinned actions with a 14-day
cooldown. An empty PR template and an issue-template config override the
org defaults so no templates are offered. Line endings are normalized to LF.
python/_shared/python.mk defines every task as a plain uv command (sync,
lint, test, build, record, ...) with UV_NO_EDITABLE exported, because an
editable install cannot resolve temporalio.contrib.<name> from src/.
python/_template holds the files every Python plugin gets: pyproject with
uv_build namespace layout, cooldown with the SDK exempted, plugin.toml
metadata, a LICENSE symlink to the root license, and a pruned conftest that
replays recorded HTTP traffic (no API keys in CI) and runs the provenance
guard at session start.
…in status

ci.yml is the single entry point: detect_changes.py maps changed files to
per-language plugin matrices (auto-discovered from manifests; shared paths
fan out to a whole language), a conventions job enforces repository
invariants and runs the tooling tests, _python-plugin.yml is called once
per selected plugin, and ci-status is the only required check. Nightly
runs re-lock to newest and lowest allowed dependencies as advisory lanes.
The org opengrep SAST caller is included. No secrets are used anywhere.
release-python.yml runs on python/<plugin>/v<version> tags: validates the
tag against the manifest and the version policy (pypi.org is the source of
truth; first release exactly 1.0.0 or 0.1.0; finals need allow-final),
reuses the CI workflow at the full profile, builds once, publishes to
TestPyPI via OIDC trusted publishing, smoke-installs from TestPyPI in a
clean project, publishes finals to PyPI behind the pypi environment, and
drafts a GitHub release with notes generated from commit history.
extract-sdk-python.sh rewrites a fresh sdk-python clone with git-filter-repo
(pinned 2.47.0) so one plugin's full history lands at its new paths with
authorship intact, issue references repointed and a Migrated-From trailer
on every commit. new_python_plugin.py instantiates python/_template for a
new or freshly imported plugin.
…eate lock on first sync

The org's Opengrep SAST required workflow flagged `defaults.run.working-directory`
interpolating a reusable-workflow input; run steps now `cd "$PLUGIN_DIR"` from a
job-level env entry, and the composite action does the same. The local
opengrep.yml is removed because the organization already runs that scan as a
required workflow on every PR. `make sync` creates uv.lock when it does not
exist yet so a freshly scaffolded plugin can be synced in one step.
- ruff isort: force `temporalio` and `tests` first-party so imported files stay
  byte-identical to upstream (only our subpackage exists under src/).
- pyright/basedpyright: execution environments so `tests.*` resolves from the
  project root, `src/` is checked from source, and upstream's relative import
  into a sibling contrib package does not fail the build (TRANSITION).
- Vendored helpers: `Path(str(...))` for importlib.metadata SimplePath values;
  ignore the unused `session` hook parameter the upstream way.
- Scaffolder: add `py.typed` inside an imported package (never other src files)
  and report why a file was skipped.
- `.sync-identical` lists the files the conventions check keeps identical to
  the template across plugins.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Release-policy, Windows CI, change-detection, and generic-template defects must be resolved before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Bootstraps the monorepo’s governance, shared Python plugin tooling, CI, release automation, and migration infrastructure.

Changes:

  • Defines repository conventions and Python plugin scaffolding.
  • Adds change-aware CI, artifact validation, and release workflows.
  • Adds migration/release utilities with comprehensive tooling tests.
File summaries
File Description
AGENTS.md Defines normative repository policies.
CLAUDE.md Points agents to repository guidance.
CONTRIBUTING.md Documents contributor workflows.
README.md Introduces plugins and development.
.gitattributes Normalizes text and binary files.
.gitignore Ignores development artifacts.
.github/CODEOWNERS Assigns repository ownership.
.github/dependabot.yml Configures dependency updates.
.github/ISSUE_TEMPLATE/config.yml Enables blank issues.
.github/pull_request_template.md Overrides the organization template.
.github/actions/python-build-check/action.yml Builds and validates Python artifacts.
.github/workflows/ci.yml Implements change-aware CI.
.github/workflows/_python-plugin.yml Tests individual Python plugins.
.github/workflows/release-python.yml Publishes and verifies Python releases.
python/README.md Documents Python-specific conventions.
python/_shared/python.mk Provides shared plugin targets.
python/_template/.sync-identical Lists synchronized template files.
python/_template/Makefile.tmpl Defines generated plugin Makefiles.
python/_template/README.md.tmpl Defines generated plugin documentation.
python/_template/plugin.toml.tmpl Defines plugin metadata.
python/_template/pyproject.toml.tmpl Defines Python packaging and tooling.
python/_template/src/temporalio/contrib/__NAME__/__init__.py Creates the leaf plugin package.
python/_template/src/temporalio/contrib/__NAME__/py.typed Marks generated packages as typed.
python/_template/tests/__init__.py.tmpl Pins the test server version.
python/_template/tests/conftest.py Configures plugin tests and replay.
python/_template/tests/helpers/__init__.py Provides shared test helpers.
python/_template/tests/helpers/nexus.py Provides Nexus test naming.
python/_template/tests/helpers/plugin_meta.py Loads plugin metadata in tests.
python/_template/tests/helpers/provenance.py Validates installed package provenance.
python/_template/tests/test_installed_matches_source.py Compares installed and source files.
scripts/pyproject.toml Defines tooling dependencies.
scripts/uv.lock Locks tooling dependencies.
scripts/new_python_plugin.py Scaffolds Python plugins.
scripts/ci/_common.py Shares CI discovery/output helpers.
scripts/ci/check_conventions.py Enforces repository invariants.
scripts/ci/check_typecheck_resolution.sh Probes type-checker resolution.
scripts/ci/check_wheel.py Validates wheel and sdist contents.
scripts/ci/detect_changes.py Selects affected plugins.
scripts/ci/matrix.py Generates Python test matrices.
scripts/ci/nightly_report.py Manages nightly failure issues.
scripts/ci/smoke.py Smoke-tests installed artifacts.
scripts/migrate/IMPORTS.md Records history imports.
scripts/migrate/README.md Documents migration procedures.
scripts/migrate/extract-sdk-python.sh Rewrites SDK plugin history.
scripts/migrate/replace-message.txt Repoints imported issue references.
scripts/release/release_tool.py Implements release policy and notes.
scripts/release/smoke_from_index.sh Smoke-tests published packages.
scripts/tests/conftest.py Provides tooling test fixtures.
scripts/tests/test_check_conventions.py Tests convention enforcement.
scripts/tests/test_check_wheel_and_smoke.py Tests artifact verification.
scripts/tests/test_detect_changes.py Tests plugin change selection.
scripts/tests/test_matrix.py Tests matrix generation.
scripts/tests/test_release_tool.py Tests release policy and notes.
scripts/tests/test_workflows.py Statically validates workflows.
Review details
  • Files reviewed: 51/55 changed files
  • Comments generated: 7
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/_python-plugin.yml Resolved
Comment thread python/_template/README.md.tmpl Resolved
Comment thread python/_template/tests/conftest.py Resolved
Comment thread scripts/ci/check_wheel.py Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/release-python.yml Resolved
Comment thread scripts/ci/detect_changes.py Resolved
- Run the build/wheel/smoke check only on the designated dist cell: Windows
  checkouts turn the LICENSE symlink into a stub and would fail the license
  byte comparison.
- Template README links to AGENTS.md with an absolute URL (conventions reject
  relative links because PyPI renders READMEs).
- Template conftest is plugin-agnostic: the OpenAI Agents SDK trace-exporter
  reset is guarded by an import check, and placeholder env values plus the
  offline skip list move to plugin.toml [offline] (validated by conventions:
  placeholders only, never real credentials).
- check_wheel matches the canonical requirement name `temporalio` exactly
  instead of a prefix that also accepted temporalio-mcp.
- ci.yml re-evaluates the history-import commit policy on `unlabeled`.
- The pre-release-to-PyPI dispatch override is ignored while plugin.toml
  [release] allow-final is false, so nothing reaches production before cutover.
- A root LICENSE change fans out to every plugin, since every wheel packages it.
Comment thread .github/ISSUE_TEMPLATE/config.yml Resolved
Comment thread .github/workflows/_python-plugin.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/dependabot.yml Resolved
Comment thread CLAUDE.md Resolved
…dependency changes, security-only Dependabot

- The Python test matrix is the same for every run, pull requests included:
  ubuntu at the min and max supported versions plus macOS and Windows at max.
  The pr/full profile distinction is gone.
- The lowest-direct dependency lane runs and blocks on PRs that change a
  plugin's pyproject.toml or uv.lock (that is when floors change), and still
  runs for every plugin nightly because transitive dependencies drift.
- Dependabot mirrors sdk-python: security advisories only, since its uv
  support is not yet mature enough for routine version bumps.
- Restore the Python 3.10 tomllib guard in the template's plugin_meta.py; it
  was lost when the import branch was rebuilt and the 3.10 lint job regressed.
Comment thread python/README.md Resolved
Comment thread python/README.md

## Platform notes

- Node (`npx`) is required by the MCP tests; GitHub-hosted runners have it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can rewrite our MCP tests to avoid this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. The only test that spawns npx is test_stateful_mcp_server_no_worker, and it does so because its monkey-patch targets a method name that no longer exists (get_activities vs _get_activities), so the real stdio server connect runs. That is an upstream test fix (one line), which we planned to make in sdk-python during the plugin fix pass and pick up here by re-sync rather than editing imported files; I have noted it in AGENTS.md as the reason Node is currently required.

Comment thread python/README.md Resolved
Comment thread python/README.md Resolved
Comment thread python/_template/tests/conftest.py Resolved
@temporalio temporalio deleted a comment from DABH Sep 2, 2026
- LICENSE: no symlink and nothing committed in plugin directories. `make`
  copies the root LICENSE into the plugin as a gitignored file before any uv
  command that may build (uv_build fails when a declared license file is
  missing). Conventions reject a committed or symlinked plugin LICENSE.
- Issue and PR templates: the repository-level overrides are removed; the
  organization defaults from temporalio/.github apply.
- Time-skipping pass dropped from CI and the make targets; the plugin suites
  skip or gain nothing from it.
- Dev server runs with its default configuration: the full suite without any
  --dynamic-config-value flag produces exactly the same results as with the
  25 inherited flags, so the template conftest carries none.
- Offline policy: no real provider key anywhere, not even for recording.
  plugin.toml [offline] skips may now name parametrized ids, so the real-API
  arms of upstream tests can be skipped while their offline twins run;
  cassette recording stays available as an opt-in.
Comment thread python/_shared/python.mk Resolved
Per review, a committed copy beats the make-materialized file: it needs no
tooling before `uv sync` or `uv build` and behaves the same on every OS. The
root LICENSE stays the source of truth; the conventions check fails on any
plugin LICENSE that is a symlink, missing, or not byte-identical to it, and
check_wheel.py still verifies the packaged text. The scaffolder copies the
root file into new plugins.
@brianstrauch
brianstrauch merged commit b18d2de into main Sep 3, 2026
9 checks passed
@brianstrauch
brianstrauch deleted the bootstrap branch September 3, 2026 17:55
sohom-cs added a commit to sohom-cs/ai-integrations that referenced this pull request Nov 2, 2026
… parallel

Two tests over three runs: run k makes k + 1 identical task calls, and
every Activity returns a new value. In the first, the calls go one after
another: the completed calls, including the "temporalio#1" and "temporalio#2" occurrences,
come back from the cache in order, and each later run schedules an
Activity for its extra call only. In the second, the calls start
together: they are scheduled before any completes, get separate
results, and keep their places after continue-as-new. Every run's
history is replayed.
sohom-cs added a commit to sohom-cs/ai-integrations that referenced this pull request Nov 9, 2026
A call that fails or is interrupted stores no result. It now gives its
place back, so the retry or the resumed call takes its key, and after
continue-as-new the first call finds that result. This replaces the
"<key>:failed" entries, which did not cover an interrupted call: its
resumed result went under "temporalio#1" and the next run ran it again.

Calls made in a workflow-side node or task are counted per call of it.
The scope is a hash of the node's or task's name, its place among its
caller's calls of that name, and the caller's scope, and a subgraph run
from it inherits it. This replaces the hash of LangGraph's task path,
whose call index counted failed calls, and which gave parallel runs of
one subgraph the same scope.
sohom-cs added a commit to sohom-cs/ai-integrations that referenced this pull request Nov 11, 2026
When a workflow-side node or task failed and was called again, the calls
it had made kept their places and cached results, so the retry's calls
went under "temporalio#1" keys, and after continue-as-new the first call got the
failed attempt's results. A failed call now also drops the results and
places of the calls made in it, its nested calls' included, so the retry
makes them under the same keys. An interrupted call keeps them.
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.

3 participants