V0.3.2
Release Summary: amrita-sense v0.3.2
We are pleased to announce the release of amrita-sense v0.3.2. This version introduces a foundational concurrency primitive, the CLCA (Cross Loop Callback‑Allocate) design pattern, which enables safe cross‑event‑loop signalling and makes SuspendObjectStream fully thread‑ and coroutine‑safe. This unlocks new capabilities for sharing I/O streams across interpreters and threads without extra synchronization overhead.
✨ Major New Features
CLCA Design Pattern
- A new lightweight signal‑distribution pattern, CLCA, is now documented in both English and Chinese.
- CLCA decouples “suspend” and “resume” from complex flow control, providing a reusable cross‑event‑loop primitive for waking multiple waiters with a single signal.
- Two practical implementations are introduced:
Signal– coroutines voluntarily yield and wait for an external signal.CheckpointSignal– external controllers set checkpoints where coroutines automatically suspend.
- This pattern is the backbone for the concurrency improvements in
SuspendObjectStream.
SuspendObjectStream Now Fully Concurrency‑Safe
SuspendObjectStreamhas been re‑engineered using the CLCA pattern:- Multiple coroutines (even across threads/event loops) can now safely share a single
SuspendObjectStreaminstance. - Concurrent calls to
wait_to_suspend(),resume(),yield_response(), andpush_object()are properly serialized with an internalaiologic.Lock. - The previous one‑waiter limitation is gone; all waiters are woken atomically when
resume()is called.
- Multiple coroutines (even across threads/event loops) can now safely share a single
- This makes sharing the
object_iostream between parent and child interpreters safe and efficient.
Child Interpreter Now Shares object_io by Default
WorkflowInterpreter.fork_interpreter()now reuses the parent’sobject_ioinstance whenobject_io=None(previously it created a new independent stream).- Because
SuspendObjectStreamis now concurrency‑safe, sharing is safe across interpreters and threads. - This reduces resource duplication and simplifies cross‑interpreter communication.
📚 Documentation Improvements
- Added comprehensive CLCA Design Pattern guide (
/guide/practice/clca-design-pattern.md) with sequence diagrams, implementation details, and usage examples. - Updated
SuspendObjectStreamAPI reference to highlight concurrency safety (v0.3.2+). - Updated subgraph‑isolation documentation to reflect the new shared‑stream behavior.
- Both English and Chinese versions are provided.
🔧 CI & Dependency Updates
- CI pipeline: now triggers only on
mainbranch pushes and pull requests; added Python 3.15 to the test matrix. - Dependabot enabled for weekly dependency updates.
- Python version support: expanded to
<3.16(previously<3.15). - Dependencies upgraded:
aiologic→ 0.17.0anyio→ 4.14.0- Added explicit dependency on
exceptiongroup >=1.3.1.
- Frontend docs dependencies updated (mermaid, markdown-it, dompurify, etc.).
🐛 Bug Fixes & Code Cleanup
- Fixed a
finallyblock placement inhook/matcher.pythat incorrectly suppressed logging and early return ofblock=True. - Removed the deprecated
_advance_pointermethod (now useadvance_pointer). - Various internal improvements to
SuspendObjectStream:- State transitions (suspend/resume, queue closure, callback registration) are now properly guarded by locks.
- Cleaned up queue handling and callback logic.
- Added extensive test coverage for the new concurrency features (20+ new test cases).
📦 Upgrade Notes
- If you were relying on the old behavior where
fork_interpreter()created a new independentobject_io, be aware that it now shares the parent’s stream. This is safe, but if you explicitly need a fresh isolated stream, pass a new instance explicitly. - The
aiologicandanyioupgrades are backward‑compatible, but please review your own threading/async patterns if you heavily rely on these.
🙏 Acknowledgements
This release was driven by the need for reliable cross‑loop signalling in complex async workflows. The CLCA pattern is a distillation of lessons learned from real‑world usage. We hope it serves as a useful building block for your own projects.
Pull Requests
- fix: add exceptiongroup dependency and bump version to 0.3.1.post1 by @JohnRichard4096 in #2
- Configure Dependabot for uv and restrict CI to main branch by @JohnRichard4096 in #6
- build(deps): bump dompurify from 3.4.2 to 3.4.11 by @dependabot[bot] in #3
- build(deps): bump mermaid from 11.14.0 to 11.15.0 by @dependabot[bot] in #4
- build(deps): bump undici from 7.25.0 to 7.28.0 by @dependabot[bot] in #9
- build(deps): bump aiologic from 0.16.0 to 0.17.0 by @dependabot[bot] in #8
- build(deps): bump anyio from 4.13.0 to 4.14.0 by @dependabot[bot] in #7
- build(deps): bump markdown-it from 14.1.1 to 14.2.0 by @dependabot[bot] in #5
- Improve SuspendObjectStream concurrency and expand test coverage by @JohnRichard4096 in #11
- Update docs and API by @JohnRichard4096 in #12
New Contributors
- @dependabot[bot] made their first contribution in #3
Full Changelog: 0.3.1...0.3.2