Skip to content

[Bug]: Telegram topic /status can report fallback model from internal subagent announce as the session model #85082

Closed

Description

@brokemac79

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

In a Telegram forum topic, /status and activity UI can show google/gemini-2.5-flash as the topic session model after an internal subagent announce/recovery turn used fallback, even though the normal user-facing topic session is configured for and returns to openai-codex/gpt-5.5.

Steps to reproduce

  1. Run OpenClaw 2026.5.19 with a Telegram forum topic bound to a main agent whose primary model is openai-codex/gpt-5.5 and whose fallback includes google/gemini-2.5-flash.
  2. From that Telegram topic, spawn a Codex subagent.
  3. Have one subagent or parent announce/recovery turn hit a Codex app-server timeout, causing fallback to google/gemini-2.5-flash.
  4. Run /status in the Telegram topic or inspect the topic activity UI.
  5. Observe the status/activity display can make the topic look like it is now using Gemini, although the next ordinary user turn uses openai-codex/gpt-5.5 again.

Observed topic/session:

  • session key: agent:main:telegram:group:-1003871627242:topic:6823
  • successful child: agent:codex:subagent:f1cc437f-6a10-4b48-a3da-2d67f47d747c
  • timed-out child: agent:codex:subagent:c34fca91-3b85-4c8a-a926-07cafbe162c2

Expected behavior

/status should distinguish at least these concepts instead of presenting them as one ambiguous session model:

  • configured/current primary model for the user-facing Telegram topic;
  • configured fallback chain;
  • last actual model used for the most recent user-facing turn;
  • last actual model used by an internal subagent announce/recovery turn.

If an internal announce turn uses a fallback model, that should not make the topic status look like the user-facing session has permanently switched to that fallback.

Actual behavior

After an internal subagent announce/recovery turn used Gemini fallback, the topic activity UI showed a Gemini-labelled assistant message, and /status output around the same period showed fallback-token/accounting state that matched that internal Gemini run.

The confusing user-visible effect was: the operator saw Gemini in the topic and asked why the Codex/OpenAI workflow was using Gemini, even though the successful Codex subagent had not run on Gemini and the next normal topic turn returned to OpenAI/Codex.

OpenClaw version

2026.5.19

CLI on host reported:

OpenClaw 2026.5.19 (a185ca2)

The Telegram /status card in the repro reported:

OpenClaw 2026.5.19 (0e30120)

Operating system

Ubuntu 24.04.3 LTS aarch64

Install method

npm global, single system install:

/usr/bin/openclaw -> /usr/lib/node_modules/openclaw/openclaw.mjs
ExecStart=/usr/bin/node /usr/lib/node_modules/openclaw/dist/index.js gateway --port 18789

Model

Primary: openai-codex/gpt-5.5 / openai/gpt-5.5

Fallback: google/gemini-2.5-flash

Provider / routing chain

OpenClaw -> OpenAI Codex runtime, with Google Gemini fallback configured

Additional provider/model setup details

The same Telegram topic continued to work with OpenAI/Codex after the fallback event.

A later /status tool result for the same session reported:

Model: openai-codex/gpt-5.5
Fallbacks: google/gemini-2.5-flash
Session: agent:main:telegram:group:-1003871627242:topic:6823
Execution: direct · Runtime: OpenAI Codex

So this is not a permanent model switch or an OpenAI outage. The confusing state appears to be caused by fallback usage from an internal announce/recovery turn being surfaced as topic/session model state.

Logs, screenshots, and evidence

Gateway logs show the main Telegram topic turn timed out on Codex and then fell back to Gemini:

2026-05-21T19:18:26.461+00:00 [agent/embedded] codex app-server turn idle timed out waiting for completion
2026-05-21T19:18:26.534+00:00 [agent/embedded] embedded run failover decision: runId=e9a3b0a4-edef-4ff6-a201-3d860cad8ddc stage=assistant decision=fallback_model reason=timeout from=openai-codex/gpt-5.5 rawError=codex app-server attempt timed out
2026-05-21T19:18:26.551+00:00 [model-fallback/decision] model fallback decision: decision=candidate_failed requested=openai/gpt-5.5 candidate=openai/gpt-5.5 reason=timeout next=google/gemini-2.5-flash detail=codex app-server attempt timed out
2026-05-21T19:18:54.128+00:00 [model-fallback/decision] model fallback decision: decision=candidate_succeeded requested=openai/gpt-5.5 candidate=google/gemini-2.5-flash reason=unknown next=none

Trajectory for the Telegram topic shows the same run first failing on Codex and then succeeding on Gemini:

{"ts":"2026-05-21T19:18:26.463Z","type":"model.completed","runId":"e9a3b0a4-edef-4ff6-a201-3d860cad8ddc","provider":"openai-codex","modelId":"gpt-5.5","timedOut":true}
{"ts":"2026-05-21T19:18:28.649Z","type":"session.started","runId":"e9a3b0a4-edef-4ff6-a201-3d860cad8ddc","provider":"google","modelId":"gemini-2.5-flash"}
{"ts":"2026-05-21T19:18:54.036Z","type":"model.completed","runId":"e9a3b0a4-edef-4ff6-a201-3d860cad8ddc","provider":"google","modelId":"gemini-2.5-flash","timedOut":false,"usage":{"input":120190,"output":3507,"total":123697}}

Task state showed the successful Milestone 1 child was a separate Codex subagent and delivered successfully:

{
  "runtime": "subagent",
  "sourceId": "de593004-fad4-4daf-8652-cfe1a51b1c31",
  "requesterSessionKey": "agent:main:telegram:group:-1003871627242:topic:6823",
  "childSessionKey": "agent:codex:subagent:f1cc437f-6a10-4b48-a3da-2d67f47d747c",
  "status": "succeeded",
  "deliveryStatus": "delivered"
}

A different child later timed out:

{
  "runtime": "subagent",
  "sourceId": "4d379e8f-a2a4-40d3-a2de-5f5dac5fb2cf",
  "requesterSessionKey": "agent:main:telegram:group:-1003871627242:topic:6823",
  "childSessionKey": "agent:codex:subagent:c34fca91-3b85-4c8a-a926-07cafbe162c2",
  "status": "timed_out",
  "deliveryStatus": "delivered"
}

The internal announce for that timed-out child used Gemini:

{"ts":"2026-05-21T19:34:29.374Z","type":"session.started","runId":"announce:v1:agent:codex:subagent:c34fca91-3b85-4c8a-a926-07cafbe162c2:4d379e8f-a2a4-40d3-a2de-5f5dac5fb2cf","provider":"google","modelId":"gemini-2.5-flash"}
{"ts":"2026-05-21T19:34:31.742Z","type":"model.completed","provider":"google","modelId":"gemini-2.5-flash","usage":{"input":39908,"output":122,"total":40030},"assistantTexts":["The latest notification is another timed-out subagent that didn't produce any output..."]}

That ~40k in / 122 out usage matched the confusing /status/activity observation from the topic.

A later normal user-facing turn on the same topic used OpenAI/Codex again:

{"ts":"2026-05-21T19:38:39.563Z","type":"session.started","runId":"912c97c8-e7ad-45fc-9751-a99aedd13c6d","provider":"openai-codex","modelId":"gpt-5.5"}
{"ts":"2026-05-21T19:38:48.310Z","type":"tool.result","runId":"912c97c8-e7ad-45fc-9751-a99aedd13c6d","provider":"openai-codex","modelId":"gpt-5.5","tool":"session_status"}
{"ts":"2026-05-21T19:38:58.716Z","type":"model.completed","runId":"912c97c8-e7ad-45fc-9751-a99aedd13c6d","provider":"openai-codex","modelId":"gpt-5.5","timedOut":false}

Impact and severity

Affected: Telegram forum-topic sessions with fallback models configured, especially where subagent completion/timeout announce turns run in the parent topic session.

Severity: Medium. The underlying work may still complete, but operator visibility is misleading: /status and activity can make it look like the topic or Codex worker switched to Gemini when only an internal announce/recovery turn used fallback.

Frequency: observed once on a live 2026.5.19 VPS during subagent work. NOT_ENOUGH_INFO on whether every internal announce fallback reproduces the misleading status display.

Consequence: debugging confusion, false suspicion that the wrong model is serving the user-facing topic, and difficulty separating subagent/announce model use from normal topic model use.

Additional information

Related but not a duplicate:

Likely investigation surfaces:

  • session_status tool/model usage reporting
  • session usage persistence fields used by status/activity UI
  • subagent announce/recovery turns and whether their model usage should update the parent topic's user-facing session model state

I plan to pick this up and open a PR for the fix, assuming maintainers agree with this issue scope.

Activity

  1. clawsweeper commented on May 21, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.

    Workflow note: Future ClawSweeper reviews update this same comment in place.

    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Summary
    Keep open. Current main still has a credible source-level path where an inter-session subagent announce runs on the requester session and can update the same model/fallback fields that /status renders as user-facing session state; the related issues are adjacent but do not own this Telegram/internal-announce attribution bug.

    Reproducibility: yes. at source level: the current announce path runs the internal handoff on the requester session, then the normal reply/session usage code can persist the fallback provider/model fields that /status reads. I did not establish a live Telegram failure path in this read-only review.

    Next step
    A focused repair looks feasible from source inspection, but it should be validated with targeted regression tests because live Telegram proof was not run here.

    Review details

    Best possible solution:

    Make session usage/status provenance-aware so subagent_announce or other inter-session internal runs are either labeled as internal last-run usage or excluded from the user-facing topic model/fallback fields, with a focused Telegram/forum-topic regression test.

    Do we have a high-confidence way to reproduce the issue?

    Yes at source level: the current announce path runs the internal handoff on the requester session, then the normal reply/session usage code can persist the fallback provider/model fields that /status reads. I did not establish a live Telegram failure path in this read-only review.

    Is this the best way to solve the issue?

    Yes, the maintainable fix is to carry provenance through usage/status and separate internal announce model usage from user-facing session model state. Closing as a duplicate of the broader fallback observability issues would leave this concrete Telegram attribution bug unowned.

    Label changes:

    • add P2: The bug is a normal-priority status/model-attribution problem with a limited Telegram/subagent/fallback blast radius.
    • add impact:session-state: The issue is about session status/activity showing internal-run state as the topic session state.
    • add impact:auth-provider: The report concerns provider/model fallback attribution between the configured OpenAI Codex route and Gemini fallback.
    • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
    • add clawsweeper:source-repro: Current issue advisory state selects this label.

    Label justifications:

    • P2: The bug is a normal-priority status/model-attribution problem with a limited Telegram/subagent/fallback blast radius.
    • impact:session-state: The issue is about session status/activity showing internal-run state as the topic session state.
    • impact:auth-provider: The report concerns provider/model fallback attribution between the configured OpenAI Codex route and Gemini fallback.

    Acceptance criteria:

    • node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner.runreplyagent.e2e.test.ts
    • node scripts/run-vitest.mjs src/auto-reply/status.test.ts
    • node scripts/run-vitest.mjs src/agents/subagent-announce-delivery.test.ts
    • git diff --check

    What I checked:

    • Reporter evidence: The issue includes a live 2026.5.19 Telegram forum-topic sequence where an internal announce run used google/gemini-2.5-flash, /status/activity reflected that internal Gemini usage, and a later ordinary topic turn used openai-codex/gpt-5.5 again.
    • Subagent announce uses requester session: Direct subagent completion delivery calls the gateway agent method with sessionKey set to the canonical requester session key and inputProvenance.sourceTool set to subagent_announce, so the announce/recovery run executes in the parent topic session surface. (src/agents/subagent-announce-delivery.ts:757, 016c34ff1d2a)
    • Fallback state is written as session state: The reply runner computes fallback transitions from the actual provider/model used by the run and persists fallbackNoticeSelectedModel/fallbackNoticeActiveModel to the session entry without a visible guard for inter-session announce provenance. (src/auto-reply/reply/agent-runner.ts:1555, f43e83c937f4)
    • Usage persistence overwrites runtime model fields: persistSessionUsageUpdate updates modelProvider and model for any non-heartbeat usage update, which means a non-heartbeat internal announce run can refresh the same runtime fields read by session status. (src/auto-reply/reply/session-usage.ts:137, f43e83c937f4)
    • Status output lacks internal/user-facing attribution: buildStatusMessage renders a single Model line plus a Fallback line from the session entry fallback state, with no displayed concept for internal announce/recovery usage versus the last ordinary user-facing turn. (src/status/status-message.ts:944, f43e83c937f4)
    • Documented status contract overlaps the reported ambiguity: The docs say session-level /status and session_status can recover the active runtime model label from transcript usage, and model-failover docs say /status shows selected and active fallback model; neither distinguishes internal subagent announce usage. Public docs: docs/concepts/usage-tracking.md. (docs/concepts/usage-tracking.md:15, 016c34ff1d2a)

    Likely related people:

    • steipete: Authored recent model fallback/status commits and current blame for the status, usage persistence, and fallback-state lines all points through the same current-main snapshot. (role: recent area contributor; confidence: high; commits: 4b0f16d496e5, a13468320c63, 02182d5a3031; files: src/auto-reply/reply/agent-runner.ts, src/auto-reply/reply/session-usage.ts, src/status/status-message.ts)
    • galiniliev: Authored recent subagent completion announce recovery work on the direct delivery path that injects announcements back into requester sessions. (role: recent adjacent contributor; confidence: medium; commits: 04eac15f43d5, 57ec361682e2; files: src/agents/subagent-announce-delivery.ts)
    • giodl73-repo: Authored recent session model display preservation work in the session usage/status area, which is adjacent to avoiding internal-turn model drift in status output. (role: adjacent session-status contributor; confidence: medium; commits: 0eca3a92e3e3; files: src/auto-reply/reply/session-usage.ts, src/auto-reply/status.test.ts)

    Remaining risk / open question:

    • I did not run a live Telegram forum-topic repro, so the exact UI frequency remains based on the reporter's logs plus source inspection.
    • A fix needs to preserve useful internal announce usage/accounting while preventing it from being presented as the user-facing topic session model.

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 016c34ff1d2a.

  2. brokemac79 commented on May 23, 2026

    @brokemac79
    ContributorAuthor

    @clawsweeper re-review as labels don't seem to be added to this issue

  3. clawsweeper commented on May 23, 2026

    @clawsweeper
    Contributor

    🦞👀
    ClawSweeper picked this up.

    Command router queued. I will update this comment with the next step.

  4. steipete commented on May 24, 2026

    @steipete
    Contributor

    Fixed on main via #85726 / f55e986.

    The landed fix preserves user-facing session status/model/usage attribution for internal handoffs while still allowing the handoff transcript/delivery path to complete. Proof included focused Vitest shards, E2E fallback coverage, tsgo, clean auto-review, and Testbox tbx_01ksbwhh1pmkmtyb6xa2rcag8p exit 0.

  5. locked as resolved and limited conversation to collaborators on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions