Skip to content

fix: scope tool activity completion and output to its execution - #3713

Merged
vybe merged 3 commits into
Abilityai:devfrom
alex-furman:fix/3712-execution-tool-identity
Oct 14, 2026
Merged

vybe merged 3 commits into
Abilityai:devfrom
alex-furman:fix/3712-execution-tool-identity

Conversation

@alex-furman

@alex-furman alex-furman commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3712.

When concurrent executions reuse a provider tool ID, completing one currently marks the other timeline entry complete, clears both activity slots, and shares output storage. Give execution-scoped timeline entries unique opaque IDs and use execution identity when completing tools. Outputs remain attached to the same IDs used by the existing activity-detail API.

Live Codex and Claude parser call sites pass execution identity. Scoped duplicate completion cannot overwrite completed output. Legacy calls without execution context resolve only a single running match: completed entries do not block sequential ID reuse, while concurrent ambiguous matches are left untouched. This fallback cannot establish ownership for late unscoped events; it does not claim scoped ownership for every runtime.

Validation: stock ownership regression 3 failed / 12 passed; independent activity/Codex/Gemini checks on the current maintainer-updated revision passed 208 cases. These include sequential legacy ID reuse, both scoped parser paths and the actual detail route. No reply-history feature or new API route is introduced. Full unit suite and live UI execution were not run.

Journey Impact: extends: J04

Mutation: test_reused_provider_tool_ids_keep_completion_and_outputs_execution_scoped and test_unscoped_completion_does_not_guess_between_execution_owners reproduce 3 ownership/output failures on stock.

alex-furman and others added 3 commits October 14, 2026 08:03
…gacy completion (Abilityai#3712)

merge-train decision, per the merge-train note on the PR. The legacy
(unscoped) completion path filtered candidates by provider tool id alone
and bailed on ambiguity, so a provider with no execution scope that reuses
a tool id sequentially (Gemini) left every later reuse stuck running and
the session status stuck at running. Filter to running entries first, then
apply the ambiguity rule: the Abilityai#3712 guarantee (never guess between
concurrently running executions, never overwrite a completed entry's
output) is unchanged, and base behaviour for sequential reuse is restored.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@vybe

vybe commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

merge-train note: a train decision pushed to your branch (commit 96c8e55), please acknowledge or push back post-merge.

Validation found that the new legacy (unscoped) completion path filters candidates by provider tool id alone and then bails when there is more than one, so a provider with no execution scope that reuses a tool id sequentially (Gemini passes no execution_id) leaves every later reuse stuck running, with session_activity.status stuck at running and active_tool re-pointed at the stale entry. Base behaviour completed the running one. The pushed change filters to status == "running" entries first and then applies your ambiguity rule, so the #3712 guarantees are unchanged (never guess between concurrently running executions; a duplicate completion never overwrites a completed entry's output: all your tests still pass) while sequential reuse completes again. Added test_legacy_sequential_tool_id_reuse_completes_the_running_entry, red against your head and green with the change. 198 tests pass across the activity, Codex runtime and heartbeat suites.

Two pre-existing things noticed, not touched: gemini_runtime.py:602 calls complete_tool_execution(tool_id, tool_output, is_error) with the success and output arguments swapped, so Gemini top-level tool results never store output; and docs/memory/feature-flows/activity-monitoring.md embeds the old function body. Also labelled #3712 priority-p2 / type-bug / theme-reliability. Thanks for the fix.

@vybe vybe 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.

merge-train: batch validated on train/20261014-1750 (train PR #3729 green)

@vybe
vybe merged commit e4e739f into Abilityai:dev Oct 14, 2026
23 checks passed
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