feat(sdk): 并发面零机制——无背压无并发上限,同 session 并发 resume 未定义,洪峰行为(排队 vs 丢弃)未显式化
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
Research direction
Start with spec/protocol.md:317 and the SDK state and locking code in init.py:269 and :311-317; inspect the runner, hub, and CLI entry points for existing concurrency behavior. Clarify the per-session, global-limit, lock-generation, and surge-handling semantics before choosing an implementation. Done means the SDK exposes and tests those decisions without session history corruption or unbounded process fan-out.
Written by the indexing model from the issue text.
Description
场景 gap 单(okguitar 提报)· 优先级 P1 · 依赖:无
基线 HEAD = 840392d。
Summary
spec/protocol.md:317 把并发划出 scope("concurrent requests … out of scope by design"),SDK 全层也无任何原语:三语言 runner/hub/cli grep 无信号量/队列/并发上限;run() 可无限并发、每调用 spawn 一进程。具体缺口:
- 同 session 两条快消息 → 两个 CLI 进程并发
--resume同一 session——协议只字未提其行为(CLI 侧 transcript 分叉与否未定义); - 每会话状态仅
~/.agentproc/sessions/<id>.jsonl(__init__.py:269),append_history无文件锁(:311-317)——并发追加交错; - run lock 是 opt-in 且同 key 并发时
write_run_lock后写覆盖前写、先结束者clear_run_lock误清在跑者的锁; - IM 洪峰时既不排队也不丢弃——直接进程扇出直到 OOM,每进程数百 MB RSS。
影响
im-agentproc 类常驻桥接方必须各自从零实现串行化/限流;不同桥接方行为碎片化,同用户连击产生 session 分叉/历史交错。
建议
SDK 提供 per-session 串行化原语 + 全局并发闸(信号量/拒绝语义可配);run lock 写入加进程内互斥 + 世代号;把「洪峰时排队还是丢弃」的决策点显式暴露给桥方。
- Dominant language
- Python
- Stars
- 2
- Forks
- 0
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 13
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
tharje/spooler-v2#20 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Bump version of azure-servicebusPossibly taken @joostlek claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
home-assistant/core#186275 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 72/100