Skip to content

Centralize run lifecycle and enable strict templates - #805

Merged
blove merged 3 commits into
mainfrom
blove/lifecycle-integration-investigation
Jul 13, 2026
Merged

Centralize run lifecycle and enable strict templates#805
blove merged 3 commits into
mainfrom
blove/lifecycle-integration-investigation

Conversation

@blove

@blove blove commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • route submit, retry, resume, regenerate, and client-tool continuation through one adapter-owned run gateway
  • drive streaming presentation from message delivery state instead of global loading and tail-position heuristics
  • enable strict Angular template checking across the workspace and harden generic agent state boundaries

Root cause

Client-tool continuation bypassed the adapter lifecycle boundary by invoking the transport directly. That left continuation-generated assistant messages outside the active delivery generation and forced presentation code to infer ownership from global loading state.

Impact

Continuation runs now receive the same lifecycle ownership, telemetry, terminal handling, and tool catalog behavior as every other run. Angular templates compile under strict checking without project-level opt-outs.

Validation

  • NX_DAEMON=false npx nx run-many -t test,type-tests,build --projects=ag-ui,chat --skip-nx-cache
  • all 41 affected buildable Angular applications compiled with strict templates
  • fresh external consumer install and production build
  • client-tools, input, and messages browser E2Es
  • live Chrome smoke of client-tool confirmation and continuation
  • git diff --check

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
threadplane Ignored Ignored Preview Jul 13, 2026 6:46pm

Request Review

@github-actions github-actions Bot 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.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

@blove
blove enabled auto-merge (squash) July 13, 2026 18:44
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

@blove
blove merged commit bfc1130 into main Jul 13, 2026
67 checks passed
@blove
blove deleted the blove/lifecycle-integration-investigation branch July 13, 2026 19:18
blove added a commit that referenced this pull request Aug 7, 2026
)

* docs(specs): client-tool continuation correctness fixes

Design for five defects found reviewing the shipped client-tool
continuation stack (#782-#805). Four violate one unstated invariant:
the server thread must never hold a client tool call without a result.

Adds flush() to ClientToolsCapability so a settled result can be made
durable without continuing the run, and maps all five fixes onto it.

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

* docs(plans): client-tool continuation fixes implementation plan

Ten tasks covering all five defects, TDD per task, with a live
browser verification gate whose decisive step is reload-then-continue.

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

* feat(chat): add flush() to ClientToolsCapability

* feat(langgraph): batched flush() with submit-drain fallback

* fix(langgraph): take flush() batch ownership at snapshot and clear staging on thread switch

* fix(chat): flush settled client-tool groups and stop discarding limited results

* fix(chat): settle aborted client tools and wrap agent.stop once

* fix(chat): flush blocked client-tool groups once on completion

Flushing per blocked call stranded every batch after the first: adapter
flush() implementations coalesce concurrent calls by returning the
in-flight promise, so only the first batch was ever snapshotted. Gate the
blocked-group flush on group completion, mirroring the terminal path.

Drop the blockedIds guard: both shipped adapters mark a call resolved
inside settle() so pending() drops it immediately, meaning a settled call
can never be re-presented to the executor effect. The hazard it guarded
was an artifact of a test double whose settle() left calls pending
forever; the fakes now mirror adapter behavior instead.

Warn rather than silently discard when a blocked call cannot be recorded
because the capability implements no settle().

* fix(middleware): enforce tenant isolation in the client tool execution store

* fix(chat): never continue the run when settling a cancelled client tool

* feat(examples): add terminal client tool to the chat demo

* docs: regenerate API docs for client-tool flush surface

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

* fix(langgraph): chain concurrent flushes and drop stale-thread client tool results

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant