Skip to content

fix(integrations): preserve native OMP lifecycle and prompt authority - #763

Closed
bandzalkin wants to merge 62 commits into
band-ai:mainfrom
bandzalkin:fix/omp-background-yield
Closed

bandzalkin wants to merge 62 commits into
band-ai:mainfrom
bandzalkin:fix/omp-background-yield

Conversation

@bandzalkin

@bandzalkin bandzalkin commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This adds a room-owned native RPC adapter for OMP so a Band turn stays attached to its background work instead of ending at the first yield. Prompt acceptance, an initial result, or agent_end is not enough: the adapter waits for both the matching prompt outcome and native session settlement, and reports failures from resumed work on the same turn.

  • Give each room its own process, workspace and persistent session, with restoration and history recovery. Model/effort selection, custom tools, structured text/image results and external MCP servers use native RPC.
  • Install Band's communication and completion policy in OMP's genuine system prompt and verify it before inference. Room/requester metadata and previously handled history remain data, not higher-authority instructions. Required MCP connection receipts must also be present before inference.
  • Keep reply ownership in Band's turn ledger: native assistant text and permission narration do not count as a delivered reply or deliberate decline.
  • Bind callbacks to the owning turn. Timeout, cancellation and transport failure close the native process and captured descendants before another turn can use a fresh process. Cleanup waits through caller cancellation; Windows descendant termination is forced, not a graceful-exit guarantee.
  • Preserve offered permission choices and native event identity. Cancelled selects get independent, best-effort permission records; privacy projection and encoding failures use opaque payloads without inventing reply effects or dropping the native record.

Requires band-sdk[omp] and OMP 18.8.9 or later. A room workspace is not an OS sandbox, and native approval settings do not grant Band platform permissions.

Validation

Regression coverage includes background settlement ordering, resumed errors, cancellation/restart, process custody, startup readiness, permission-record identity and privacy failures.

bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 10, 2026
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 10, 2026
@bandzalkin bandzalkin changed the title fix(omp): guide required background work through native wait fix(integrations): guide OMP background work through native wait Oct 10, 2026
@bandzalkin
bandzalkin requested a review from a team October 10, 2026 07:01
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 10, 2026
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 10, 2026
@bandzalkin bandzalkin changed the title fix(integrations): guide OMP background work through native wait fix(omp): preserve native background turn lifecycle and prompt authority Oct 11, 2026
@bandzalkin bandzalkin changed the title fix(omp): preserve native background turn lifecycle and prompt authority fix(integrations): preserve native OMP lifecycle and prompt authority Oct 11, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 11, 2026
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 11, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 11, 2026
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 11, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 11, 2026
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 11, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 13, 2026
Refresh the native OMP prerequisite onto upstream 497868e. Port every band-ai#772 permission-policy case to native select requests and preserve correlated denial narration without a chat or turn-completion effect. Keep the published 5.1.0 changelog unchanged below Unreleased.

Source prerequisite: 3d939244411931b973e1bfd3b6bc65c0d15defd5
Upstream-PR: band-ai#763
@bandzalkin
bandzalkin force-pushed the fix/omp-background-yield branch from 9b133be to 3352c62 Compare October 13, 2026 20:35
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 14, 2026
Source-Base: 97f8330
Source-Head: 4184abb
Applied-Over: bcf422f
Conflict-Notes: None; exact source delta, excluding CHANGELOG.md and FORK-CHANGES.md
Upstream-PR: band-ai#763
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 14, 2026
Source-Base: 97f8330
Source-Head: 4184abb
Applied-Over: bcf422f
Conflict-Notes: None; exact source delta, excluding CHANGELOG.md and FORK-CHANGES.md
Upstream-PR: band-ai#763
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 15, 2026
Source-Base: 97f8330
Source-Head: 4184abb
Applied-Over: 3643b7c
Conflict-Notes: Resolved band-ai#709 modify/delete conflicts by replacing OMP ACP with native RPC; retained the workspace flag and current form-policy test class, removed obsolete ACP profile fixtures, migrated the new room-rejoin test and matrix row, and preserved band-ai#804 owner-module imports. No behavioral source hunks dropped; CHANGELOG.md and FORK-CHANGES.md excluded.
Upstream-PR: band-ai#763
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 15, 2026
Source-Base: c18df71
Source-Head: 56a679d
Applied-Over: 850b0c3
Conflict-Notes: Reimplemented resolver and shared initializer on band-ai#709 ACPRoom/RetainedRoom custody; dropped superseded parallel retirement/shutdown/respawn APIs and restartable cleanup flags; retained narrow child-reaping and closing-connection guards; moved legacy coverage to clientadapter/ and roomownership/ without restoring deleted files. Stacked after band-ai#763: docs/acp.md keeps band-ai#763's removal of OmpACPAdapterConfig beside resolve_mcp_servers. The room records the initializer its last waiter abandoned, so a callback that uncancel()s cannot publish a session or hand its late result to a successor (the original's SessionInitializer.invalidated). A setup already settling its own cancellation is recorded as abandoned too, without a second cancel. A successor joining a setup that was only settling its own cancellation reuses the live session it published.
Upstream-PR: band-ai#799
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 15, 2026
Source-Base: 97f8330
Source-Head: 4184abb
Applied-Over: 1cd5845
Conflict-Notes: Resolved band-ai#709 modify/delete conflicts by replacing OMP ACP with native RPC; retained the workspace flag and current form-policy test class, removed obsolete ACP profile fixtures, migrated the new room-rejoin test and matrix row, and preserved band-ai#804 owner-module imports. No behavioral source hunks dropped; CHANGELOG.md and FORK-CHANGES.md excluded. Over band-ai#802: OMP image and turn-outcome probes move into its imageprobes.py/outcomeprobes.py registries; uv.lock regenerated over band-ai#796.
Upstream-PR: band-ai#763
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 15, 2026
Source-Base: c18df71
Source-Head: 56a679d
Applied-Over: 27431ce
Conflict-Notes: Reimplemented resolver and shared initializer on band-ai#709 ACPRoom/RetainedRoom custody; dropped superseded parallel retirement/shutdown/respawn APIs and restartable cleanup flags; retained narrow child-reaping and closing-connection guards; moved legacy coverage to clientadapter/ and roomownership/ without restoring deleted files. Stacked after band-ai#763: docs/acp.md keeps band-ai#763's removal of OmpACPAdapterConfig beside resolve_mcp_servers. The room records the initializer its last waiter abandoned, so a callback that uncancel()s cannot publish a session or hand its late result to a successor (the original's SessionInitializer.invalidated). A setup already settling its own cancellation is recorded as abandoned too, without a second cancel. A successor joining a setup that was only settling its own cancellation reuses the live session it published.
Upstream-PR: band-ai#799
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 15, 2026
Source-Base: 97f8330
Source-Head: 4184abb
Applied-Over: 1cd5845
Conflict-Notes: Resolved band-ai#709 modify/delete conflicts by replacing OMP ACP with native RPC; retained the workspace flag and current form-policy test class, removed obsolete ACP profile fixtures, migrated the new room-rejoin test and matrix row, and preserved band-ai#804 owner-module imports. No behavioral source hunks dropped; CHANGELOG.md and FORK-CHANGES.md excluded. Over band-ai#802: OMP image and turn-outcome probes move into its imageprobes.py/outcomeprobes.py registries; uv.lock regenerated over band-ai#796.
Upstream-PR: band-ai#763
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 15, 2026
Source-Base: c18df71
Source-Head: 56a679d
Applied-Over: 27431ce
Conflict-Notes: Reimplemented resolver and shared initializer on band-ai#709 ACPRoom/RetainedRoom custody; dropped superseded parallel retirement/shutdown/respawn APIs and restartable cleanup flags; retained narrow child-reaping and closing-connection guards; moved legacy coverage to clientadapter/ and roomownership/ without restoring deleted files. Stacked after band-ai#763: docs/acp.md keeps band-ai#763's removal of OmpACPAdapterConfig beside resolve_mcp_servers. The room records the initializer its last waiter abandoned, so a callback that uncancel()s cannot publish a session or hand its late result to a successor (the original's SessionInitializer.invalidated). A setup already settling its own cancellation is recorded as abandoned too, without a second cancel. A successor joining a setup that was only settling its own cancellation reuses the live session it published.
Upstream-PR: band-ai#799
@bandzalkin
bandzalkin force-pushed the fix/omp-background-yield branch from 4184abb to 242a3c9 Compare October 15, 2026 03:43
@bandzalkin

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (d7ab3429) at 242a3c96268e; the description's new first section lists the conflict resolutions and the verification at this head.

bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
The restack merge resolved src/band/runtime/tools/agent.py to this
branch's older lineage and dropped the activity observation the
producer stack added: the class decorator reporting method calls and
the model-tool wrapper around execute_tool_call. Native OMP work does
not touch that surface; restore it from the prerequisite.
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
Select upstream band-ai#841 (activity producers, carrying band-ai#839/band-ai#840 via
forward merges), band-ai#874 after 841 (tool-name emit gate with the I-08
name clamp), the host stack ahead of band-ai#763, band-ai#763 after 874 (native OMP
with the tool/permission activity hooks and omp_acp retirement), and
band-ai#854/band-ai#795/band-ai#848 after 763. Replayed from the branches' live heads.
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 20, 2026
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 21, 2026
Select upstream band-ai#841 (activity producers, carrying band-ai#839/band-ai#840 via
forward merges), band-ai#874 after 841 (tool-name emit gate with the I-08
name clamp), the host stack ahead of band-ai#763, band-ai#763 after 874 (native OMP
with the tool/permission activity hooks and omp_acp retirement), and
band-ai#854/band-ai#795/band-ai#848 after 763. Replayed from the branches' live heads.
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 21, 2026
Live capture on the platform showed the OMP hooks posting tool_call activity
details even when Emit.TOOL_CALLS was off: the activity channel is separate
from event narration, so the hook sites need the same gate the narration
already had. I-01/I-02: with tool reporting off, no tool kind or name may
reach the reporter. Tests now pin the gate directly (activity follows the
switch) instead of the incorrect independence premise.

Co-Authored-By: Claude <noreply@anthropic.com>
bandzalkin pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 21, 2026
bandzalkin pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 21, 2026
bandzalkin and others added 2 commits October 21, 2026 08:12
The mask wrapper was attached only when the flag was already off, so an
adapter that binds its observer before the emit sync (codex's item/started
path) kept reporting named tool_calls after the choice was turned off. The
observer now always wraps and reads the live flag on every report; the hook
site gates on the OMP branch remain as the second guard. Red-first test:
observer bound with names on, choice flipped off mid-turn, tool report must
arrive nameless.

Co-Authored-By: Claude <noreply@anthropic.com>
@bandzalkin

Copy link
Copy Markdown
Contributor Author

Provenance note (this branch outgrew its title): besides the background-yield fix it started with, fix/omp-background-yield now carries the native OMP typed-activity work:

One anomaly to flag rather than hide: commit 41fb96e7 carries author sim-artifacts <sim-only@invalid> — a quarantine git identity leaking from a shared worktree at commit time. The content is our work (reviewed above); we chose not to rewrite history on an open PR. Subsequent commits are correctly authored.

F-8 closure evidence: an observer bound at turn start now reads the gate
flag at report time (d764959, covered by the flip-after-binding test), and
a stale continuation report after the next turn takes activity ownership is
fenced before it can name anything. The two guards seal R-02 for OMP
background-yield continuations; no production change is required.
@bandzalkin

Copy link
Copy Markdown
Contributor Author

F-8 follow-up (board task 4, part 1): this branch gains a test guard, no code change. The question whether an OMP continuation's band-tool labels can outlive a Tool-calls-&-results flip is now answered at the tree, two ways:

  • Within a live turn: the gate flag lives on the shared ExecutionContext and ToolNamesObserver reads it at report time (feat: gate activity tool names on the tool-call emit choice #874 d764959b), so the next room-message turn's on_event sync renames the continuation's very next frame. Guarded by test_flip_after_binding_hides_names_in_the_running_turn (red on the pre-fix tree).
  • After the turn was taken over: a stale continuation report can no longer name anything — WorkingStateReporter.update re-checks ownership under its lock, so frames from a non-owning scope never reach the wire (verified falsifiable: bypassing owns_activity makes the new test_continuation_frame_after_takeover_never_reaches_wire fail).

Commit ddcaa947 adds the second guard here so both halves of the window stay pinned; the replay consumes it through this branch.

@bandzalkin

Copy link
Copy Markdown
Contributor Author

Closing: superseded by in-repo PR(s) #897, #898 (native adapter beside omp_acp), #893 and #894 (shared fixes carved out), #902 (activity hooks) with the same content, one concern each and a clean single-author history.

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.

2 participants