Skip to content

🤖 feat: AI-generated sidebar status via small-model loop#3238

Merged
ammario merged 33 commits intomainfrom
sidebar-t7ry
May 9, 2026
Merged

🤖 feat: AI-generated sidebar status via small-model loop#3238
ammario merged 33 commits intomainfrom
sidebar-t7ry

Conversation

@ammar-agent
Copy link
Copy Markdown
Collaborator

@ammar-agent ammar-agent commented May 6, 2026

Summary

Adds an AgentStatusService that produces the sidebar agent-status text using the same "small model" path as workspace title generation (NAME_GEN_PREFERRED_MODELS — Claude Haiku → GPT-mini), instead of inferring it from the workspace's TODO list. The status is regenerated on a focus-aware cadence, skips when the trailing transcript hash is unchanged, and is fed at most ~8k trailing transcript tokens.

Background

Today the sidebar's per-workspace status string is derived from deriveTodoStatus, which picks the first in-progress / pending / last-completed TODO. That's a noisy proxy for "what is the agent doing right now":

  • It only updates when the agent invokes todo_write, so a long bash run or a multi-step assistant turn shows a stale TODO.
  • It can be empty for entire conversations that don't use TODO-style planning.
  • It can't summarize free-form work like "investigating crash" or "running tests".

The user asked for the status to come from a small LLM call instead, with sensible cost controls (token cap, cadence, dedup, focus gating).

Implementation

Constants (src/constants/agentStatus.ts)

  • Focused cadence 30s, unfocused cadence 120s, scheduler tick 10s, startup delay 30s.
  • Trailing-window budget: ≤ 80 messages, ≤ 8000 tokens, with a per-message char cap of 4000.
  • Concurrency cap of 1 global generation in flight.

Small-model path (src/node/services/workspaceStatusGenerator.ts)

  • Mirrors workspaceTitleGenerator.ts. streamText + a new propose_status tool (added to toolDefinitions.ts); reuses mapNameGenerationError / mapModelCreationError so all the existing 401/402/403/429/5xx classifications apply.
  • Prompt explicitly delimits the transcript with <transcript> markers and instructs the model to focus on current activity rather than overall task scope.
  • propose_status is excluded from default tools.ts registration with the same comment as propose_name.

Scheduler (src/node/services/agentStatusService.ts)

  • Single setInterval ticking every 10s. Per-workspace lastRanAt + a current focused/unfocused interval gate the actual generation.
  • For each eligible workspace: read getLastMessages(80) + readPartial → format → trim oldest entries until under the token budget (using TokenizerService with a fallback model constant), then SHA-256 the transcript.
  • If the hash matches the last successful generation, skip — exactly the "frozen chat → no new status" behavior the user asked for. The dedup is in-memory; on app relaunch every workspace generates once and then dedups normally.
  • Eligible workspaces are sorted by lastRanAt ascending so MAX_CONCURRENT=1 doesn't starve workspaces deeper in the list (round-robin without an explicit queue).
  • runTick awaits all dispatched workspaces (via tracked inFlightPromises) instead of fire-and-forget, so production schedulers and tests can observe completion deterministically.
  • Two if (this.stopped) return guards (post-generation, post-persist) so a stop() mid-flight never leaks writes past the service's lifecycle.
  • Persists before updating the in-memory dedup hash so a transient I/O failure leaves the next tick free to retry the same transcript.

Focus tracking (src/node/services/windowService.ts)

  • WindowService.isFocused() delegates to BrowserWindow.isFocused() directly. Falls back to true in non-desktop contexts (CLI server, tests) so backend services don't throttle themselves to "unfocused" cadence when there is no window.

Schema + persistence

  • New aiStatus field on ExtensionMetadata + WorkspaceActivitySnapshotSchema.
  • AgentStatusService calls extensionMetadata.setAiStatus directly (bypassing the historical emitWorkspaceActivityUpdate wrapper that would have swallowed disk errors) and emits the activity snapshot via workspaceService.emitWorkspaceActivity only after the disk write resolves successfully. ExtensionMetadataService.save() re-throws on failure to support this; initialize() keeps its startup-safety semantics by wrapping its mutation calls in a logged try/catch per AGENTS.md.

Frontend (src/browser/stores/WorkspaceStore.ts)

  • New precedence: transientStatus ?? aiStatus ?? todoStatus. transientStatus collapses displayStatus (inactive workspaces) and aggregator.getAgentStatus() (active workspaces) so explicit system-set messages always beat aiStatus regardless of which branch produces them.
  • applyWorkspaceActivitySnapshot diffs aiStatus so a fresh small-model status triggers re-render.

Validation

  • New tests
    • workspaceStatusGenerator.test.ts: prompt structure (transcript delimiters, empty-transcript sentinel) + empty-candidates short-circuit.
    • agentStatusService.test.ts: generates on first tick, dedups when transcript is unchanged, regenerates after history changes, includes the partial assistant message mid-stream, skips empty workspaces, focused-vs-unfocused cadence boundaries, round-robin fairness across multiple workspaces, archived workspaces are skipped, stops cleanly mid-generation, persist failures don't advance the dedup hash.
    • WorkspaceStore.test.ts: aiStatus beats todoStatus; displayStatus still beats aiStatus.
  • make static-check clean (eslint, typecheck, prettier, doc-link check).
  • make test shows only pre-existing flaky-timing failures present on main (CLI auth + GitStatusStore subset). My new files pass cleanly.

Risks

  • The new service makes provider calls that didn't exist before. Mitigations: 30s startup delay, 30s/120s focus-gated cadence, transcript-hash dedup, ≤1 concurrent generation, mapNameGenerationError retry budget capped at 3 candidates.
  • Sidebar precedence change is the only user-visible behavior change. If aiStatus generation fails or hasn't completed yet, behavior is identical to today (todoStatus fallback). Explicit system-set transient status (heartbeat / idle-compaction / background-turn) still beats aiStatus.
Codex review history (resolved)
  1. Partial stream output: AI status was hashing only committed chat.jsonl. Fixed by appending readPartial so the hash refreshes mid-stream.
  2. Fair scheduling: with MAX_CONCURRENT=1 and fixed iteration order, deep workspaces would starve. Fixed with lastRanAt ascending sort.
  3. Hash-before-persist: updateAiStatus went through a wrapper that silently swallowed disk errors. Fixed by calling setAiStatus directly and updating the hash only on success.
  4. save() swallowing errors: ExtensionMetadataService.save() itself swallowed errors. Fixed by re-throwing; initialize() wraps its calls in try/catch to preserve startup-safety.
  5. Active-workspace transient precedence: aggregator.getAgentStatus() was being buried under aiStatus for active workspaces. Fixed with the transientStatus tier.
  6. Lifecycle stop guard: runForWorkspace could persist/emit after stop(). Fixed with two this.stopped checks at await boundaries.
Simplification refactor

After the original implementation landed and Codex approved, the diff was simplified for minimal LoC / maintenance burden (8 files, +232 / -670 lines):

  • Dropped cross-restart hash dedup. After the original Codex approval the disk-stored aiStatusInputHash round-trip turned out to add ~50 LoC of complexity (hydration sweep, getter method, conditional-spread coercion) for ~one extra LLM call per workspace per app launch. Removed the field from the type, the coercion, the setter signature, and getAiStatusInputHash entirely; in-session dedup still works.
  • WindowService: dropped EventEmitter inheritance, setFocused, focused field, focus/blur listeners, and the test-stub defensive check. isFocused() delegates to BrowserWindow.isFocused() directly.
  • AgentStatusService: dropped __test__ exports, inFlightCount (use inFlightPromises.size), markInFlight helper, drainInFlight helper, hashesHydrated + hydratePersistedHashes, resolveTokenizerModel. Merged tick() + runTick(). Used FALLBACK_TOKENIZER_MODEL constant in buildTrailingTranscript so we don't double-call getWorkspaceTitleModelCandidates per workspace.
  • Trimmed verbose multi-paragraph comments to one-line summaries throughout.

Generated with mux • Model: anthropic:claude-opus-4-7 • Thinking: max • Cost: $58.06

@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 6, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Mux 🟢 Ready View Preview May 6, 2026, 12:30 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Please review this PR. Key areas:

  • The new AgentStatusService (cadence/dedup correctness, focus gating)
  • workspaceStatusGenerator (prompt structure, error mapping reuse)
  • WorkspaceStore precedence change (displayStatus > aiStatus > todoStatus > fallback)
  • Schema additions to WorkspaceActivitySnapshot + ExtensionMetadata

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: f1c982f6c7

ℹ️ 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 src/node/services/agentStatusService.ts
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed the partial.json feedback: buildTrailingTranscript now appends historyService.readPartial(workspaceId) after the committed tail, so the input hash changes and the small-model status refreshes mid-stream. Added a unit test that stages a partial assistant message and asserts the new transcript + new hash.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: b52db3d1d4

ℹ️ 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 src/node/services/agentStatusService.ts Outdated
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed the fairness feedback: processEligibleWorkspaces now collects every eligible workspace, sorts by lastRanAt ascending, and dispatches up to AGENT_STATUS_MAX_CONCURRENT per tick. Workspaces that have never run sort with lastRanAt=0 so new workspaces preempt previously-run ones. Added a 3-workspace round-robin unit test that asserts every workspace gets a turn before any repeats.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 265f907bf5

ℹ️ 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 src/node/services/agentStatusService.ts Outdated
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Fixed the persist-vs-hash ordering. agentStatusService now calls extensionMetadata.setAiStatus directly (which throws on failure) and only updates state.lastInputHash after the write resolves, then emits the activity snapshot via the new public workspaceService.emitWorkspaceActivity. The legacy updateAiStatus wrapper was removed since this was its only caller. Added a regression test that injects a disk-write failure and asserts the next tick retries against the same transcript.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 3d2ac73d1c

ℹ️ 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 src/node/services/ExtensionMetadataService.ts Outdated
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Made ExtensionMetadataService.save() rethrow after logging. All historical callers wrap their setX / updateX calls in emitWorkspaceActivityUpdate, which still downgrades the throw to a logged warning, so their semantics are unchanged. AgentStatusService invokes setAiStatus directly and now sees real disk-write failures, skipping the lastInputHash advance so the next tick retries.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 3b118b76b2

ℹ️ 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 src/node/services/ExtensionMetadataService.ts
Comment thread src/browser/stores/WorkspaceStore.ts Outdated
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Two follow-ups:

  1. ExtensionMetadataService.initialize() now wraps both the dir-create and clearStaleStreaming() in try/catch + log, so a transient disk failure at startup doesn't crash the app. save() keeps its strict throw semantics for AgentStatusService.

  2. Reworked sidebar precedence: displayStatus and fallbackAgentStatus are collapsed into a single transientStatus tier (displayStatus ?? fallbackAgentStatus). The final precedence is transientStatus ?? aiStatus ?? todoStatus, so explicit system-set messages — whether they arrived via the activity snapshot for inactive workspaces or via aggregator.getAgentStatus() for active/caught-up workspaces — always outrank an AI summary.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 2264113ab8

ℹ️ 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 src/node/services/agentStatusService.ts Outdated
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed the lifecycle hazard: runForWorkspace now checks this.stopped both after generateWorkspaceStatus returns and after the disk write resolves, returning early in both cases so a generation that's still in flight when stop() is called doesn't persist or emit. Added a regression test that pauses generation, calls stop(), then releases generation and asserts no setAiStatus / activity emit fires.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ 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".

@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Refactor pass for simplicity / minimal LoC / maintenance burden. Net delta: -438 lines.

  • Dropped cross-restart hash dedup (the disk-stored aiStatusInputHash round-trip). In-session dedup is unchanged; on app relaunch every workspace generates once and then dedups normally.
  • Dropped EventEmitter inheritance from WindowService; isFocused() now delegates to BrowserWindow.isFocused() directly.
  • Removed several internal helpers in AgentStatusService (__test__, inFlightCount, markInFlight, drainInFlight, hashesHydrated, hydratePersistedHashes, resolveTokenizerModel); merged tick() + runTick(); eliminated the duplicate getWorkspaceTitleModelCandidates call inside buildTrailingTranscript by using a fallback tokenizer model constant.
  • Trimmed verbose comments / tests to focus on intent rather than narrating the obvious.

All previously-resolved review concerns (round-robin fairness, persist-then-hash, partial-stream inclusion, lifecycle stop guard, transient status precedence) are preserved and still tested.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 5a67d08ddf

ℹ️ 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 src/node/services/ExtensionMetadataService.ts Outdated
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed P1: setAiStatus now preserves the existing entry's recency and seeds recency=0 for the rare brand-new entry case (workspace has chat but no metadata yet). Pinned the contract with a direct test against ExtensionMetadataService.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 5325acf7a2

ℹ️ 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 src/node/services/agentStatusService.ts
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed P2: added a this.stopped check immediately before generateWorkspaceStatus, so a stop() during the earlier awaits (transcript build, candidates fetch) skips the provider call entirely. New test pins the contract.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ 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".

@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed three review threads:

  1. Hide bespoke tools from docs — added internal: true to propose_name and propose_status in TOOL_DEFINITIONS; scripts/gen_docs.ts now filters internal tools out of the hook env-var block. The auto-generated docs/hooks/tools.mdx and builtInSkillContent.generated.ts no longer expose env-var entries for these tools.
  2. Collapse aiStatus into todoStatus — the frontend never distinguished between them, so the AI-generated payload now writes to the same todoStatus slot. Dropped the schema field, the ExtensionMetadata field, and the frontend precedence tier. setAiStatussetSidebarStatus to reflect the unified role.
  3. Drop AGENT_STATUS_STARTUP_DELAY_MS — with MAX_CONCURRENT=1 the scheduler already serializes generation per tick, so a separate startup delay is unnecessary. Dropped the constant, startupTimeout, the begin() helper, and the startupDelayMs option.

Net diff: +83 / -163. All previously-resolved Codex concerns (recency preservation, pre-generator stop guard, partial-stream inclusion, round-robin fairness, persist-then-hash, lifecycle stop guard) are preserved.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 9b9aafe40b

ℹ️ 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 src/browser/stores/WorkspaceStore.ts Outdated
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed P2: inverted the precedence in the active-workspace branch so activity?.todoStatus (which is now the canonical "last write wins" slot for both AI and todo-derivation) wins over deriveTodoStatus(aggregatorTodos). The live aggregator derivation is now a fallback only when the snapshot has no entry yet.

Added a regression test that gives the workspace BOTH live aggregator todos AND a persisted activity todoStatus, asserting the persisted one wins.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ 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".

@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Bug fix prompted by deployed behavior: most workspaces were showing the literal phrase "Awaiting next task" in the sidebar. Root cause was the small-model prompt itself, which both:

  1. Framed the task as "what is the agent doing right now" — pushing the model to bucket every paused chat as "idle/finished".
  2. Handed the model the literal example "Awaiting next task" for that idle/finished case — so it just copied the example verbatim.

Reframed around "most recent activity", dropped the special idle branch, and explicitly forbid generic placeholders so the model names the concrete activity from the transcript instead.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ 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".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: fc33fa5cbe

ℹ️ 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 src/node/services/workspaceStatusGenerator.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 32a90729c5

ℹ️ 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 src/node/services/agentStatusService.ts
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Handled the startup/no-settled-hash variant too: a first recent recency bump now waits one scheduler tick instead of generating against potentially stale pre-pivot history, then the still-unconsumed recency can force the refresh once the user message is in history.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: fd88f3f4a7

ℹ️ 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 src/node/services/agentStatusService.ts Outdated
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Fixed the empty-transcript starvation path: non-racy empty transcripts now consume observed recency so they do not keep sorting ahead of populated workspaces under max-concurrency=1, while the recent first-recency guard still protects the sendMessage recency/history race.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 40d38dd213

ℹ️ 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 src/node/services/agentStatusService.ts
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Fixed the pre-provider failure starvation path: config/auth failures now consume the observed recency priority while leaving lastInputHash unset, so the same transcript remains retryable on cadence without monopolizing every scheduler tick.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: bb21f74090

ℹ️ 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 src/node/services/agentStatusService.ts
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Addressed the pre-provider/history race by tracking the last transcript hash the scheduler examined separately from the settled dedup hash. Recent recency bumps now wait if history still shows the same transcript, including pre-provider retry states, while older/config-failure recency is still consumed to avoid starvation.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 37a9dc9a72

ℹ️ 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 src/node/services/agentStatusService.ts Outdated
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Fixed stale dedup recency priority: once the recent history-catchup guard has expired, unchanged transcript dedup skips now consume observed recency so the workspace stops bypassing cadence and cannot starve other workspaces.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: be1bf725a0

ℹ️ 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 src/node/services/agentStatusService.ts
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Fixed startup behavior too: AgentStatusService.start() now kicks off one immediate runTick in addition to scheduling future interval ticks, matching the no-startup-delay comment while preserving max-concurrency=1.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 07e2ef0c88

ℹ️ 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 src/node/services/agentStatusService.ts
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Fixed in-flight stale writes: after generation returns, AgentStatusService now reloads the workspace snapshot and drops the result if recency advanced beyond the value observed at dispatch, so a slow provider response cannot persist/emit a pre-pivot status after a newer user turn.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: c8f8d35d80

ℹ️ 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 src/node/services/agentStatusService.ts Outdated
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Fixed the atomicity issue: ExtensionMetadataService.setSidebarStatus now accepts a serialized-mutation guard (skipIfRecencyAdvancedSince) and performs the recency comparison immediately before the status write in the same mutation queue. AgentStatusService uses that guard instead of a separate pre-write getSnapshot check.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ 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".

@ammario ammario merged commit 64b36e7 into main May 9, 2026
24 checks passed
@ammario ammario deleted the sidebar-t7ry branch May 9, 2026 23:59
mux-bot Bot pushed a commit that referenced this pull request May 10, 2026
The post-provider-failure / placeholder-rejection / successful-persist
branches in runForWorkspace each ran the same two-line pair:
markRecencyObserved() to consume any observed recency bump, then
state.lastInputHash = inputHash to advance the dedup hash so the next
tick won't regenerate against the same transcript.

Hoist that pair into a settleOnTranscript() closure (next to the
existing markRecencyObserved closure) so the three settlement branches
read as a single named intent. The pre-provider-failure and
empty/dedup-hit branches keep using bare markRecencyObserved() because
they should still retry against the same transcript when conditions
change — captured in a comment on the new helper so a future reader
doesn't reintroduce the duplicated pair.

Pure refactor — emitted JS, all six callsite branches, and the existing
25-test agentStatusService suite (including the
post-provider/placeholder/success/pre-provider/pre-provider-retry/dedup
regression cases added in #3238) are all unchanged.

🤖 Generated with mux

Co-Authored-By: Mux <noreply@coder.com>
mux-bot Bot pushed a commit that referenced this pull request May 10, 2026
The post-provider-failure / placeholder-rejection / successful-persist
branches in runForWorkspace each ran the same two-line pair:
markRecencyObserved() to consume any observed recency bump, then
state.lastInputHash = inputHash to advance the dedup hash so the next
tick won't regenerate against the same transcript.

Hoist that pair into a settleOnTranscript() closure (next to the
existing markRecencyObserved closure) so the three settlement branches
read as a single named intent. The pre-provider-failure and
empty/dedup-hit branches keep using bare markRecencyObserved() because
they should still retry against the same transcript when conditions
change — captured in a comment on the new helper so a future reader
doesn't reintroduce the duplicated pair.

Pure refactor — emitted JS, all six callsite branches, and the existing
25-test agentStatusService suite (including the
post-provider/placeholder/success/pre-provider/pre-provider-retry/dedup
regression cases added in #3238) are all unchanged.

🤖 Generated with mux

Co-Authored-By: Mux <noreply@coder.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.

2 participants