Skip to content

fix(ui): reconcile agent definitions after reconnect - #1618

Merged
cyhhao merged 16 commits into
masterfrom
fix/agents-reconnect-definition-refresh
Aug 22, 2026
Merged

fix(ui): reconcile agent definitions after reconnect#1618
cyhhao merged 16 commits into
masterfrom
fix/agents-reconnect-definition-refresh

Conversation

@cyhhao

@cyhhao cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

P0-10

Fixes the Avibe P0-10 Agent definition reconciliation gap observed at candidate head 594c94a (3.0.13rc3+master.594c94a4). After an SSE/controller offline -> online gap, the mounted Agents page now reconciles every server-backed definition it displays before treating it as current.

Root cause and ownership model

The original reconnect edge refreshed /api/running-agents but did not perform an authoritative /api/agents?include_disabled=1 read. Subsequent fixes exposed the broader cause: Definitions, selected full detail, mutation acknowledgements, onboarding inventory, and editable drafts had competing publication owners. This head consolidates those responsibilities in one bounded page-local reconciliation stage scheduler.

  • Definitions reads are cache-bypassing and latest-only. Superseded callers join the newer publication barrier, reconnect stages Definitions before selected detail, and causal retirement follow-up is bounded.
  • The selected coordinator owns desired/accepted identity epochs, stable-ID rename routing, mobile presentation intent, uncached physical detail producers, compatible selection/reconnect/debt consumers, retirement tombstones, and per-identity mutation debt. Invalidated or lower-floor stages cannot satisfy newer obligations; PATCH responses are acknowledgements, and each mutation operation keeps its own outcome.
  • AgentDetailPanel is keyed by stable Agent ID. The five editable fields track raw authoritative baselines and local submission provenance; whitespace remains part of an active draft, trim occurs only at submit/blur/save, and modal save remains an awaited/rejecting path.
  • Auto-selection uses explicit consumable initialization/replacement reasons, dismissal stays closed across reconnect publication, onboarding publishes only ordered GET snapshots, and resource-owned errors are localized at the final UI boundary.

Evidence

  • Base: origin/master 251f40d.
  • Candidate failing head: 594c94a.
  • Current implementation head: 4447d28.
  • Focused Vitest + Testing Library: 88 AgentsPage tests plus 15 real ApiProvider transport and stream-liveness tests (103 passing). Coverage includes list/detail stage ordering, identity-epoch and compatible-consumer joins, invalidated/lower-floor stage suppression, direct stale-row retirement, mobile presentation intent, stable-ID field isolation, one-shot debt/unmount behavior, expected disappearance and localized errors, per-operation mutation outcomes, raw-whitespace and clean-baseline fields, prompt save failure, explicit dismissal, enabled background failure consumption, onboarding settlement locking, and stale inventory ordering.
  • Changed-surface ESLint has no errors, tsc --noEmit passes, and npm run build passes. Build output retains only existing dependency annotation and chunk-size warnings.
  • No dependency, backend/API contract, locale, runtime, service, or acceptance-environment changes.

Residual risk is the requested manual Chrome/mobile verification of a real controller/SSE offline -> online gap, including full-detail fields and responsive rendering. Ports 5100/5190 and the acceptance runtime were not used. Do not merge from this PR.

@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c6466a18ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx
Comment thread ui/src/components/workbench/AgentsPage.tsx
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4bf65bd105

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8f846ad82

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
@cyhhao
cyhhao force-pushed the fix/agents-reconnect-definition-refresh branch from c8f846a to 7efcfef Compare August 21, 2026 05:28
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7efcfef55a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

1 similar comment
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48f103c596

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
@cyhhao
cyhhao force-pushed the fix/agents-reconnect-definition-refresh branch from 48f103c to 212be52 Compare August 21, 2026 07:58
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 212be52d17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea6d407b0f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx
@cyhhao
cyhhao force-pushed the fix/agents-reconnect-definition-refresh branch from ea6d407 to ba3c023 Compare August 21, 2026 09:43
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba3c0234b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

1 similar comment
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2f8a1975a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2f8a1975a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b50a10b989

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx
@cyhhao
cyhhao force-pushed the fix/agents-reconnect-definition-refresh branch from b50a10b to 91a10cf Compare August 21, 2026 13:18
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91a10cfbf0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx
@cyhhao
cyhhao force-pushed the fix/agents-reconnect-definition-refresh branch from 91a10cf to e1fb705 Compare August 21, 2026 14:07
@cyhhao
cyhhao force-pushed the fix/agents-reconnect-definition-refresh branch from e1fb705 to 45c2320 Compare August 21, 2026 15:11
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45c23200d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
@cyhhao
cyhhao force-pushed the fix/agents-reconnect-definition-refresh branch from 45c2320 to cca12e5 Compare August 21, 2026 16:15
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cca12e5355

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7c4d256c5b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

1 similar comment
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a323b48442

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/workbench/AgentsPage.tsx Outdated
@cyhhao

cyhhao commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 4447d28877

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cyhhao
cyhhao merged commit e07ba37 into master Aug 22, 2026
14 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.

1 participant