Skip to content

[docs] Client-tool interaction lifecycle: research, blame timeline, plan v2 - #5916

Merged
mmabrouk merged 5 commits into
release/v0.112.0from
docs/client-tool-interaction-lifecycle
Aug 11, 2026
Merged

[docs] Client-tool interaction lifecycle: research, blame timeline, plan v2#5916
mmabrouk merged 5 commits into
release/v0.112.0from
docs/client-tool-interaction-lifecycle

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

Context

Today's recurring interaction-card bugs (resurrected questionnaires, dead connect cards, the running-elsewhere strip accusing its own tab, answers ignored) got the full planning treatment instead of more symptom patches. This PR lands the workspace at docs/design/client-tool-interaction-lifecycle/.

What is inside

  • context.md — the user experience that opened the project and the thesis (whenever there is one new thing to show, the UI shows everything instead of that thing).
  • research.md — the six evidenced mechanisms; the complete frontend render inventory and server-side lifecycle inventory with file references; the kind-by-outcome settlement table (approvals settle correctly; forms and connect cards NEVER record success, in any version); the blame timeline verified against v0.108.1 (the settlement gap shipped complete in v0.105.0 and is not a regression; the visibility regressions date to v0.111's live adoption and one 2026-08-10 dispatch line).
  • plan.md — v2, reshaped after an adversarial review (codex gpt-5.6-sol) found v1 unsound: four changes — the answer flips the interaction row first (winning the sweep race by ordering, zero sweep changes), one replay precedence rule (no new record kind), desktop subscribes to the existing interaction event and stops adopting over pending cards, and cards act wherever they render. Mobile client-tool answering is documented as a pre-existing limitation with its own ticket.
  • status.md — the decision log, including the review verdict and its adoption.

Related, already merged today: #5909, #5912, #5913, #5910. Open issues it references: #5907, #5911.

@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Aug 10, 2026
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Error Error Aug 11, 2026 11:08am

Request Review

@dosubot dosubot Bot added the documentation Improvements or additions to documentation label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 0892491b-62cd-4c4c-98f0-326e372fb355

📥 Commits

Reviewing files that changed from the base of the PR and between 6e5ec9c and e019d34.

📒 Files selected for processing (4)
  • docs/design/client-tool-interaction-lifecycle/implementation.md
  • docs/design/client-tool-interaction-lifecycle/plan.md
  • docs/design/client-tool-interaction-lifecycle/qa.md
  • docs/design/client-tool-interaction-lifecycle/research.md

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Added comprehensive design documentation for the client-tool interaction lifecycle.
    • Defined shared terminology, lifecycle states, reading order, and architecture decisions.
    • Documented issues affecting interaction cards, replay, persistence, cancellation, connections, approvals, adoption, and status indicators.
    • Added implementation priorities, QA guidance, project status, scope limitations, and deferred work.
    • Documented validation for terminal states, replay consistency, race conditions, transcript adoption, reloads, deployment journeys, and production monitoring.

Walkthrough

The PR adds lifecycle documentation for client-tool interactions. It records observed defects, historical evidence, a v2 implementation plan, implementation status, and QA coverage.

Changes

Client-tool interaction lifecycle

Layer / File(s) Summary
Lifecycle scope and problem context
docs/design/client-tool-interaction-lifecycle/README.md, docs/design/client-tool-interaction-lifecycle/context.md
Defines lifecycle terminology, document scope, observed failures, fragmented state ownership, goals, and exclusions.
Defect research and evidence
docs/design/client-tool-interaction-lifecycle/research.md
Documents persistence, replay, adoption, card, status, cancellation, connection, and historical regression findings.
Lifecycle plan and implementation design
docs/design/client-tool-interaction-lifecycle/plan.md, docs/design/client-tool-interaction-lifecycle/implementation.md
Defines answer recording, replay precedence, adoption rules, event handling, card controls, shared descriptors, implementation slices, validation scenarios, and scope decisions.
Implementation and verification status
docs/design/client-tool-interaction-lifecycle/status.md
Records implementation slices, review fixes, API and browser verification, adoption behavior, retry handling, and final QA approval.
Lifecycle QA coverage
docs/design/client-tool-interaction-lifecycle/qa.md
Defines settlement, replay, adoption, release-journey, production-detection, model, and mobile validation coverage.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the documentation workspace and its main contents: research, blame timeline, and plan v2.
Description check ✅ Passed The description directly explains the lifecycle documentation, its contents, related issues, and the intended planning outcomes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/client-tool-interaction-lifecycle

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (1)
docs/design/client-tool-interaction-lifecycle/plan.md (1)

74-82: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Map validation to each C3 and C4 invariant.

The current cases directly cover settlement and replay. The broad live scenario does not prove the watch subscription, pending-card adoption guard, non-last-message actions, unknown render-kind fallback, or registry consistency. Add deterministic validation cases for these behaviors.

This maps the plan to the defects documented in research.md Lines 100-141.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 3770a2a1-bd90-43f0-b719-bc4a45453703

📥 Commits

Reviewing files that changed from the base of the PR and between 94a6813 and 37d8ceb.

📒 Files selected for processing (5)
  • docs/design/client-tool-interaction-lifecycle/README.md
  • docs/design/client-tool-interaction-lifecycle/context.md
  • docs/design/client-tool-interaction-lifecycle/plan.md
  • docs/design/client-tool-interaction-lifecycle/research.md
  • docs/design/client-tool-interaction-lifecycle/status.md

Comment thread docs/design/client-tool-interaction-lifecycle/context.md Outdated
Comment thread docs/design/client-tool-interaction-lifecycle/plan.md Outdated
Comment on lines +22 to +23
responded row survives it by existing semantics. If the respond call fails, the flow
degrades to today's behavior (message-borne only), never blocks the user.

@coderabbitai coderabbitai Bot Aug 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Do not preserve the known broken fallback.

If the pending -> responded call fails, the plan resumes with message-borne data only. The research shows that this path leaves client-tool rows pending, after which the next-turn sweep cancels them without an outcome. Define a retry or durable recovery path before dispatching the resume.

This follows research.md Lines 155-164 and Lines 168-173.

🧰 Tools
🪛 LanguageTool

[grammar] ~22-~22: Ensure spelling is correct
Context: ...rvives it by existing semantics. If the respond call fails, the flow degrades to today'...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered on the current thread for this line. Short version: the "nothing blocks" wording was stale and is fixed (the resume now waits for the answered call under a two second cap, and a late call still lands if the sweep has not run). The durable retry path stays declined on cost, since the answer survives in the conversation records either way.

(The fix is pushed in e019d34.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rate Limit Exceeded

@mmabrouk have exceeded the limit for the number of chat messages per hour. Please wait 12 minutes and 6 seconds before sending another message.

Comment on lines +34 to +44
### C2. One replay precedence rule (no new record kind)

The closing conversational fact for a client tool already exists: the `tool_result`
record. Replay (both copies) reads outcomes in fixed precedence:
1. a real `tool_result` (wins always, preserves the actual answer),
2. else a post-contract row resolution,
3. else, for a legacy cancelled row with no result: a neutral, inert "interaction
ended" state — never inferred success or decline,
4. else (still pending): the live, actionable card.
The v1 idea of emitting `interaction_response` records for client tools is dropped: it
duplicated an existing fact and created ordering disagreements.

@coderabbitai coderabbitai Bot Aug 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Complete replay precedence for intermediate and synthetic states.

C1 introduces status=responded, but C2 defines rules only for tool_result, resolved rows, cancelled rows, and pending rows. A reload during the answer/resume gap can therefore encounter an undefined state. Also define “real tool_result” using the same predicate in both replay copies. services/runner/src/responder.ts Lines 440-457 excludes isPauseSyntheticResult, and research.md records differing sentinel matching.

This follows the replay contract in services/runner/src/responder.ts Lines 440-457 and research.md Lines 55-61 and 135-137.

🧰 Tools
🪛 LanguageTool

[style] ~34-~34: ‘new record’ might be wordy. Consider a shorter alternative.
Context: ... ### C2. One replay precedence rule (no new record kind) The closing conversational fact ...

(EN_WORDINESS_PREMIUM_NEW_RECORD)


[style] ~38-~38: The adverb ‘always’ is usually put before the verb ‘wins’.
Context: ...ed precedence: 1. a real tool_result (wins always, preserves the actual answer), 2. else ...

(ADVERB_WORD_ORDER)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered on the current thread for this line. Short version: rule 3 now covers every terminal status without a saved answer (cancelled, responded, resolved), which closes the undefined state you found. The exact predicates stay in implementation.md, since plan.md is the plain-language summary.

(The fix is pushed in e019d34.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rate Limit Exceeded

@mmabrouk have exceeded the limit for the number of chat messages per hour. Please wait 12 minutes and 3 seconds before sending another message.

Comment thread docs/design/client-tool-interaction-lifecycle/plan.md Outdated
Comment thread docs/design/client-tool-interaction-lifecycle/plan.md Outdated
Comment thread docs/design/client-tool-interaction-lifecycle/status.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (4)
docs/design/client-tool-interaction-lifecycle/qa.md (4)

38-42: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Define “both copies” before making replay equality a gate.

Name the two replay copies or code paths. Define which normalized fields must match, such as interaction identity, terminal status, resolution payload, and ordering. Otherwise, different implementations can satisfy the same prose requirement.


64-69: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Define “exactly once” by interaction identity and render surface.

The project scope includes card behavior across render locations. Specify whether “exactly once” means one lifecycle row, one visible card in the driving tab, or one DOM instance across all surfaces. Include the interaction identifier and allowed surfaces in the assertion.


62-69: 🩺 Stability & Availability | 🔵 Trivial

Isolate the live smoke data and failure path.

This scenario runs after every deploy on every deployed stack and creates persistent interaction rows. Define a dedicated test tenant or session, unique run identifiers, cleanup, and timeout behavior. A failed answer or reload can leave unresolved client_tool rows and contaminate the alert described in Lines 73 through 77.


78-80: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Emit the telemetry signal on a state transition, not every render.

A card can render many times while it remains interactive. Require one event per transition, with a stable interaction ID and the observed row status. Deduplicate or rate-limit the event.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: c62db5ac-4ae4-4480-95ce-c1a2ff076b2c

📥 Commits

Reviewing files that changed from the base of the PR and between 37d8ceb and b96a1e4.

📒 Files selected for processing (1)
  • docs/design/client-tool-interaction-lifecycle/qa.md

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Aug 10, 2026
…eline, plan v2

The planning workspace for the interaction-card bug class (2026-08-10):
context (the user experience and thesis), research (six evidenced
mechanisms, full render and lifecycle inventories, the kind-by-outcome
settlement table, the blame timeline against v0.108), and plan v2 (four
changes, reshaped after an adversarial review found v1 unsound).
…overable no more

Why every layer missed it (seam bugs between green units), and six standing
checks: the settlement matrix as a permanent acceptance test, replay goldens
across both copies and cache states, the geometry invariant, an adoption
safety property, the scripted compound journey as the deploy smoke, and two
production detection signals.
Per Mahmoud: the docs were too dense to read. Full rewrite in simple
technical English — short sentences, one idea per sentence, one name per
thing (card, row, sweep, replay, adoption), concepts explained before
use, file:line detail moved out of the prose. Content unchanged: same
findings, same four-change plan, same six standing checks.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
docs/design/client-tool-interaction-lifecycle/research.md (1)

3-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add durable links to the evidence sources.

This section names “the two inventory reports” and “the PR discussion” but does not identify or link them. Add report paths and stable commit or PR references. Otherwise, readers cannot audit the database, log, and history claims after this PR.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: bd88bdb3-8127-474f-bc9a-19f3c8ab6fc0

📥 Commits

Reviewing files that changed from the base of the PR and between b96a1e4 and b0005fb.

📒 Files selected for processing (6)
  • docs/design/client-tool-interaction-lifecycle/README.md
  • docs/design/client-tool-interaction-lifecycle/context.md
  • docs/design/client-tool-interaction-lifecycle/plan.md
  • docs/design/client-tool-interaction-lifecycle/qa.md
  • docs/design/client-tool-interaction-lifecycle/research.md
  • docs/design/client-tool-interaction-lifecycle/status.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/design/client-tool-interaction-lifecycle/context.md
  • docs/design/client-tool-interaction-lifecycle/README.md

Comment thread docs/design/client-tool-interaction-lifecycle/qa.md Outdated
Comment thread docs/design/client-tool-interaction-lifecycle/qa.md Outdated
Comment thread docs/design/client-tool-interaction-lifecycle/research.md Outdated
Comment thread docs/design/client-tool-interaction-lifecycle/research.md
Comment thread docs/design/client-tool-interaction-lifecycle/research.md Outdated
@mmabrouk
mmabrouk force-pushed the docs/client-tool-interaction-lifecycle branch from b0005fb to 6e5ec9c Compare August 10, 2026 22:15
@dosubot dosubot Bot removed the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 10, 2026
@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Aug 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

♻️ Duplicate comments (1)
docs/design/client-tool-interaction-lifecycle/qa.md (1)

25-27: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Exercise the production cancellation path for walk away.

For walk away, create a pending row, run the same cancel-stale or expiry path used in production, then assert cancelled with no resolution. A direct transition call does not verify the production cancellation path.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c546000-4516-4b90-82e8-cb5686bff700

📥 Commits

Reviewing files that changed from the base of the PR and between b0005fb and 6e5ec9c.

📒 Files selected for processing (4)
  • docs/design/client-tool-interaction-lifecycle/implementation.md
  • docs/design/client-tool-interaction-lifecycle/plan.md
  • docs/design/client-tool-interaction-lifecycle/qa.md
  • docs/design/client-tool-interaction-lifecycle/status.md

Comment thread docs/design/client-tool-interaction-lifecycle/implementation.md Outdated
Comment on lines +32 to +33
If the "answered" call fails, nothing blocks: the flow falls back to today's behavior.

@coderabbitai coderabbitai Bot Aug 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major

Do not keep the known broken fallback.

If the answered call fails, this plan still falls back to the flow described at Lines 14-15: the row remains pending, and the sweep can mark it cancelled. Define an idempotent retry or durable recovery path instead of silently using the path that loses the answer.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in part. The stale half was real: the plan still said "nothing blocks", written before the review moved the ordering. It now describes what shipped, which is a bounded wait rather than an unguarded fallback: the resume waits for the answered call, the wait is capped at two seconds, and a late answered call still lands if the sweep has not run yet. So the failure path costs at most today's behavior.

Declining the durable retry queue. It was considered and rejected on cost: the answer already survives in the conversation records, which is how the agent learns it today, so a lost row costs a display state and not the user's work. A client-side retry store for a two second window would add persistence and replay machinery to recover a status word. If the alarm in qa.md check 6 shows this failing in practice, that is the moment to build it.

(The fix is pushed in e019d34.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rate Limit Exceeded

@mmabrouk have exceeded the limit for the number of chat messages per hour. Please wait 12 minutes and 9 seconds before sending another message.

Comment thread docs/design/client-tool-interaction-lifecycle/plan.md
Comment on lines +73 to +85
- The three code paths that only looked at the last message now scan the whole chat,
like the status fix (#5913) already does.
- The one-line dispatch repair from research Finding 3 lands immediately, outside this
project.
- The card tool-name list gets one shared source.

## Filed separately (not in this project)

- Mobile answering of form and connect cards.
- Making the agent's "am I connected?" check verify the connection is valid.
- Reusing an existing connection (issue #5911).
- Small cleanups: stale form drafts, one missing error catch, one unreachable sweep
edge case.

@coderabbitai coderabbitai Bot Aug 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major

Track carried-sibling re-announcement.

Change 4 still omits the known suppressed re-announcement when a carried sibling is adopted. Add it to the implementation and QA scope, or list it under “Filed separately” with an owner and issue. Otherwise, the project can pass the current card-location checks while the visibility regression remains.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. You were reading a finding that the plain-language rewrite dropped without a home, which was our mistake. plan.md "Filed separately" now carries it: announcing a carried approval gate again, with the mechanism in one sentence, the ordering half credited to #5910, and the rest pointed at the open runner race #5907. So it is explicitly out of this project's scope with a tracked home rather than silently missing.

(The fix is pushed in e019d34.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rate Limit Exceeded

@mmabrouk have exceeded the limit for the number of chat messages per hour. Please wait 12 minutes and 7 seconds before sending another message.

Comment thread docs/design/client-tool-interaction-lifecycle/qa.md
Comment thread docs/design/client-tool-interaction-lifecycle/status.md
Comment thread docs/design/client-tool-interaction-lifecycle/status.md
Comment thread docs/design/client-tool-interaction-lifecycle/status.md
@mmabrouk mmabrouk added the lgtm This PR has been approved by a maintainer label Aug 11, 2026
@mmabrouk
mmabrouk merged commit e2b5d1b into release/v0.112.0 Aug 11, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant