Repository navigation
refactor(orchestration): back SubAgentJobRegistry with DetachedTaskRegistry (D11 phase 3) - #346
Conversation
Add tests for cooperative registration cancellation, verifying that cancelling only succeeds for the owning parent, leaves the entry registered, and releases the token without aborting the task. Also cover releasing a cancellation token without cancelling it and confirming hard cancel still works afterwards. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Restructured the task runtime to reduce duplication and clarify the control flow without changing observable behaviour. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce a registry that tracks subagent tool invocations so callers can look up and manage in-flight subagent runs. This provides the foundation for coordinating multiple subagent invocations within the orchestration layer. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Introduce types describing subagent invocation so callers have a shared shape for requests and results. This is groundwork for wiring up subagent execution. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The subagent job registry now stores job state in the shared detached task registry instead of its own map, so cancellation tokens, steering handles, and request-id claims are owned in one place. A new settle helper centralizes terminal transitions and releases the cancellation token and steering handle together, keeping the first-terminal-state-wins behaviour intact. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The tasks accessor on SubAgentJobRegistry is only used by tests, so it is now compiled under cfg(test) to keep it out of non-test builds. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Document the tinyagents-orchestration crate so its purpose and usage are discoverable from the source tree. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
The unused top-level import of DetachedTaskRegistry was dropped and the test-only accessor now refers to the type through its full path, keeping the import list limited to what the module actually uses. Auto-committed-on: dragonfly Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reached
This review includes 8 billable files and costs up to $2.00. Or wait 17 minutes for your next included review. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (8)
Comment |
Tiny Sweeper reviewTiny Sweeper reviewed this change across 6 lane(s) and found 7 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below. State: Changes requested Review snapshot
Completeness: Complete What changedThe review could not produce a supported behavioral summary; inspect the cited changed surface and lane details below. FeaturesNone identified with supported citations. TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. Findings
Resolved this pass
Before merge
How this fits togetherflowchart LR
n0["new"]:::impacted
n1["invoke_in_parent_context"]:::impacted
n2["child_config"]:::impacted
n3["run_child"]:::impacted
n4["RunContext"]:::impacted
n5["AgentRun"]:::impacted
n1 -->|calls| n2
n1 -->|uses| n4
n2 -->|calls| n0
n3 -->|uses| n4
n3 -->|uses| n5
classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Agent review detailscritique
security
tests
commits
description
e2e
Evidence and run details
|
There was a problem hiding this comment.
Requesting changes: 2 lane(s) blocking, worst finding is critical.
Fix or reply to the findings below and push. The next review clears this automatically once they are gone — you should not need to dismiss anything by hand.
$0.0302 · 623,973 in / 35,558 out · 66,973 cached (11%) · gpt-5.6-luna, glm-5.3-flash
critique: $0.0158 · 316,619 in / 15,591 out · 34,570 cached (11%) · gpt-5.6-luna, glm-5.3-flash
security: $0.0129 · 236,790 in / 11,771 out · 32,211 cached (14%) · gpt-5.6-luna
tests: $0.0012 · 39,023 in / 5,960 out · 64 cached (0%) · glm-5.3-flash
description: $0.0001 · 15,782 in / 492 out · 64 cached (0%) · glm-5.3-flash
…ted release API Co-authored-by: Medulla <medulla@tinyhumans.ai>
There was a problem hiding this comment.
Requesting changes: 1 lane(s) blocking, worst finding is high.
Fix or reply to the findings below and push. The next review clears this automatically once they are gone — you should not need to dismiss anything by hand.
$0.0255 · 454,543 in / 36,749 out · 39,261 cached (9%) · gpt-5.6-luna, glm-5.3-flash
critique: $0.0141 · 232,715 in / 19,100 out · 18,310 cached (8%) · gpt-5.6-luna, glm-5.3-flash
security: $0.0110 · 172,342 in / 14,016 out · 17,879 cached (10%) · gpt-5.6-luna
tests: $0.0001 · 16,589 in / 1,040 out · 1,536 cached (9%) · glm-5.3-flash
description: $0.0001 · 16,484 in / 801 out · 1,408 cached (9%) · glm-5.3-flash
…n, Unknown on release Co-authored-by: Medulla <medulla@tinyhumans.ai>
Summary
D11 phase 3:
SubAgentJobRegistryis now a thin adapter overtinyagents_tasks::DetachedTaskRegistry, so there is one live registry implementation. Public API ofSubAgentJobRegistryandSubAgentJobsToolis unchanged.SubAgentJobsnapshot is the detached registry's watched status (watch::channel); ownership, snapshots, steering lookup and request-id dedupe (D7) are the detached registry's.controlsmutex that acts as the transition gate, so a settle and a cancel never interleave (first terminal state wins, as before).mark_aborted) behave as before. Existing tests pass unchanged except one mechanical edit:settled_jobs_release_their_cancellation_tokenread the privateinnermap, now it usesholds_live_cancellation/get.usize::MAX, and the registry's pruning APIs (wait,cancel,sweep_terminal) are never called by the adapter (field is private to the module, invariant documented).Minimal
tinyagents-tasksadditionsregister_cooperative(no abort handle; jobs are stopped through their own token, never hard-aborted),cancel_cooperative(trip + release token, keep entry),release_cancellation,holds_cancellation. Entrycancellation/abortbecameOption.registerandregister_cooperativeshare one privateregister_entry.Things to know
waitverb existed onSubAgentJobRegistry/SubAgentJobsTool(verbs are query/list/cancel + the message tool), so none was kept or added. Adding one would change the tool schema.TaskStoreis not used: job lifecycle is process-local and synchronous here, as before, and the store is durable/async. Not a fit without changing behaviour.invocation/plus the tasks additions above;subagent/detached/untouched.Tests
New: tasks cooperative-cancel/release tests; adapter tests for registry view, steering release, 2000 settled jobs surviving, and the exact NotFound/Terminal/Cancelling/RequestIdTooLong ordering.
cargo test --workspace(only knownvalidate_repo_root_rejects_non_repofails), clippy-D warnings, fmt clean. Reviewed by a code-reviewer pass; all Important findings fixed.Co-authored-by: Medulla medulla@tinyhumans.ai