Skip to content

feat(core): add Pipeline.attach_runtime() (v0.24.0)#30

Merged
CocoRoF merged 1 commit intomainfrom
feat/pipeline-attach-runtime
Apr 20, 2026
Merged

feat(core): add Pipeline.attach_runtime() (v0.24.0)#30
CocoRoF merged 1 commit intomainfrom
feat/pipeline-attach-runtime

Conversation

@CocoRoF
Copy link
Copy Markdown
Owner

@CocoRoF CocoRoF commented Apr 20, 2026

Summary

  • New Pipeline.attach_runtime(*, memory_retriever=None, memory_strategy=None, memory_persistence=None) — a single explicit injection point for session-scoped runtime objects that an EnvironmentManifest cannot express (host-specific retriever, update strategy, and conversation persistence).
  • New Pipeline._has_started flag, flipped by _init_state on the first run() / run_stream() invocation. attach_runtime raises RuntimeError after this flip to prevent mixed-runtime pipelines where earlier stage state has captured pre-attach slot values.
  • 8 new unit tests (tests/unit/test_pipeline_attach_runtime.py).

Why

The Geny cutover (Geny/dev_docs/20260420_3/plan/02_default_env_per_role.md) moves session creation from hardcoded GenyPresets.* branches to Pipeline.from_manifest_async(...). Manifests are declarative, so they cannot carry runtime objects (SessionMemoryManager, CuratedKnowledgeManager, persistence callbacks). Before this release hosts reached into _slots[...].strategy directly — now they call one helper.

Contract

Kwarg Target Slot
memory_retriever Stage 2 (Context) retriever
memory_strategy Stage 15 (Memory) strategy
memory_persistence Stage 15 (Memory) persistence
  • Keyword-only. Omitted kwargs leave the corresponding slot untouched.
  • Missing target stage is a silent no-op (a pipeline without Memory has nowhere to attach memory runtime).
  • Must be called before the first run() / run_stream(). Raises RuntimeError afterwards.

Backwards compatibility

No breaking changes. Pipelines that never call attach_runtime behave identically to 0.23.0. The GenyPresets.worker_adaptive(...) / GenyPresets.vtuber(...) builders remain available and unchanged.

Test plan

  • pytest tests/unit/test_pipeline_attach_runtime.py — 8 passed
  • Full suite: 1023 passed, 18 skipped
  • ruff check + ruff format --check clean
  • CHANGELOG.md [0.24.0] entry
  • pyproject.toml + __init__.py version bumped to 0.24.0

🤖 Generated with Claude Code

Manifest-first hosts can now wire session-scoped runtime objects
(memory retriever, memory strategy, conversation persistence) into a
pipeline built from an EnvironmentManifest without reaching into
stage internals.

attach_runtime walks registered stages and replaces the relevant
slot strategies:
  - memory_retriever  → Stage 2 (Context), slot 'retriever'
  - memory_strategy   → Stage 15 (Memory), slot 'strategy'
  - memory_persistence → Stage 15 (Memory), slot 'persistence'

Kwargs are keyword-only; omitted kwargs leave the corresponding slot
untouched. Missing target stages are silently skipped. A new
_has_started flag (flipped by _init_state) causes attach_runtime to
raise RuntimeError after the first run() invocation — prior stage
state has already captured slot references.

No breaking changes. Pipelines that never call attach_runtime behave
identically to 0.23.0.

Tests: tests/unit/test_pipeline_attach_runtime.py (8 new tests).
Full suite: 1023 passed, 18 skipped. Ruff + format clean.

Refs: Geny/dev_docs/20260420_3/plan/02_default_env_per_role.md

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@CocoRoF CocoRoF merged commit 4bd4418 into main Apr 20, 2026
6 checks passed
@CocoRoF CocoRoF deleted the feat/pipeline-attach-runtime branch April 20, 2026 07:12
CocoRoF added a commit to CocoRoF/Geny that referenced this pull request Apr 20, 2026
v0.24.0 adds Pipeline.attach_runtime() — the runtime-object injection
helper we'll use in PR16 when AgentSession._build_pipeline is reduced
to one attach_runtime call. No consumer code changes in this PR —
the pin bump lands separately so the executor upgrade is isolated
from downstream refactors.

Refs: dev_docs/20260420_3/plan/02_default_env_per_role.md (Prereq B)
Executor PR: CocoRoF/geny-executor#30
Executor release: https://github.com/CocoRoF/geny-executor/releases/tag/v0.24.0

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
CocoRoF added a commit to CocoRoF/Geny that referenced this pull request Apr 20, 2026
v0.24.0 adds Pipeline.attach_runtime() — the runtime-object injection
helper we'll use in PR16 when AgentSession._build_pipeline is reduced
to one attach_runtime call. No consumer code changes in this PR —
the pin bump lands separately so the executor upgrade is isolated
from downstream refactors.

Refs: dev_docs/20260420_3/plan/02_default_env_per_role.md (Prereq B)
Executor PR: CocoRoF/geny-executor#30
Executor release: https://github.com/CocoRoF/geny-executor/releases/tag/v0.24.0

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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