Skip to content

fix(qa): run Telegram plugin source in --source-gateway userbot runs - #163718

Merged
steipete merged 1 commit into
mainfrom
steipete/goofy-hodgkin-307498
Oct 2, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/goofy-hodgkin-307498

Conversation

@steipete

@steipete steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: Telegram userbot proofs run with --source-gateway silently executed the built dist/extensions/telegram plugin instead of the checkout's Telegram source whenever a build existed. That happens in any worktree prepared with node scripts/worktree-setup.mjs gateway.

User Impact

User impact: maintainers proving Telegram changes with --source-gateway now exercise the edited extensions/telegram source, so a proof can no longer pass against stale built code. Other plugins, including the model provider and memory-core, still use built output when present; the help text and skill docs now say so. Source-mode Gateway startup is slower because it compiles the Telegram plugin, and its default readiness wait grows from 300 s to 900 s. --gateway-ready-timeout-ms still overrides it.

Why This Change Was Made

Gateway startup intentionally passes preferBuiltPluginArtifacts: true, which swaps bundled source entries for their canonical root build. That is the documented behavior in docs/help/debugging.md. The runner's existing OPENCLAW_BUNDLED_PLUGINS_DIR override only chose the discovery root, so the swap still happened.

Source mode now uses the documented exception, an intentional source-entry selection. It adds plugins.load.paths: [<repo>/extensions/telegram]. Discovery merges that alias into the independently discovered bundled candidate, which keeps origin: "bundled" and its trust, and the loader then runs the source entry. No loader or bundled-dir trust rule changes.

The Vitest-only OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR was inert in the runner, so it is removed. OPENCLAW_BUNDLED_PLUGINS_DIR stays so the dist core copies that built plugins load also resolve extensions/ as the trusted bundled root.

I also tried aliasing the whole extensions/ root, so every loaded plugin would run from source. The HTTP listener alone took 358 s before channels started, so this change scopes source execution to Telegram.

Evidence

  • Mechanism: reproduced without live Telegram. A source Gateway with a fake Bot API, plus a module-resolution hook, showed loadGatewayPlugins → loadOpenClawPlugins → loadRuntimePluginCandidate requiring dist/extensions/telegram/index.js from the TypeScript loader.
  • Fix (exact runner config and env): a temporary marker at handleInboundMessageLike in extensions/telegram/src/bot-handlers.inbound-pipeline.ts fired on the delivered DM. 0 of 1,228 resolved Telegram modules came from dist; only memory-core and openai loaded from built output. Discovery reports a single Telegram candidate with origin: "bundled" and configSelected: true.
  • Readiness: /readyz arrived after 537 s on a host at load average ~60–85. Event-loop stalls showed cpuCoreRatio around 0.12, so the host starved the process of CPU and I/O. The previous 300 s default would have failed that run.
  • Regression test: run-mock-sut-user-e2e.test.mjs asserts source mode selects the checkout's Telegram plugin directory and built mode adds no load path. It fails on the previous runner (actual: undefined). The loader side of the contract is already covered by src/plugins/loader.hooks-and-runtime.test-utils.ts.
  • Checks:
    • node --test on run-mock-sut-user-e2e.test.mjs and telegram-run-composition.test.mjs: 31/31 pass.
    • The new case takes ~0.06 s. These skill .test.mjs files do not run in PR CI, so the change adds 0 CI seconds.
    • Formatting is clean. Lint is unchanged: 55 pre-existing curly errors in the runner, 0 in the test.
    • Autoreview (Codex, P2): scoped-clean.
  • Not run: a live Convex-leased Test Server run. Lease, proxy and TDLib layers do not affect which plugin build loads; the boundary probe used the runner's exact config and env.

The Telegram userbot runner's --source-gateway mode claimed to run the
exact TypeScript checkout, but in any built checkout the Gateway executed
dist/extensions/telegram. Gateway startup passes preferBuiltPluginArtifacts,
which swaps bundled source entries for their canonical root build, so
Telegram proofs silently exercised stale built code.

Source mode now selects the bundled Telegram source entry through
plugins.load.paths, the documented intentional source-entry selection. The
alias merges into the bundled candidate, keeping bundled trust, and the
loader executes the checkout's Telegram source. The inert Vitest-only
OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR is dropped; OPENCLAW_BUNDLED_PLUGINS_DIR
stays so dist core copies resolve the same bundled root. The source-mode
readiness default grows from 300 s to 900 s because compiling the Telegram
source pushed /readyz to 537 s on a loaded host. Help and skill docs now say
core and Telegram run from source while other plugins use built output.
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 2, 2026 18:50
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 2:56 PM ET / 18:56 UTC.

ClawSweeper review

What this changes

The Telegram QA runner selects the checkout’s Telegram plugin in source mode, increases its default startup wait, and clarifies which other plugins still use built output.

Merge readiness

✅ Ready for maintainer review

The fix remains useful: fetched main still permits source-mode Telegram proofs to execute built plugin code. The pinned patch uses the existing loader contract correctly, and no actionable introduced defect was found.

Priority: P2
Reviewed head: 7a66669847abb72c867fda62e6667032a61693e7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant reported runtime observations, complementary regression coverage, and no identified correctness or security blocker.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured body reports the real Gateway loading Telegram with the runner’s exact configuration: an inbound source marker fired and zero resolved Telegram modules came from dist. This directly covers artifact selection; a live Test Server conversation is unnecessary for this internal harness change. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured body reports the real Gateway loading Telegram with the runner’s exact configuration: an inbound source marker fired and zero resolved Telegram modules came from dist. This directly covers artifact selection; a live Test Server conversation is unnecessary for this internal harness change. No stored-data contract changes.
Evidence reviewed 8 items Pinned introduced change: The merge-base-to-head patch adds a Telegram-only configured load path, passes the repository root from the production caller, removes an inert test trust variable, and increases only the source-mode readiness default.
Current-main necessity: Fetched main still sets the bundled discovery directory and test trust variable without adding the explicit Telegram source selection; its source readiness default remains 300,000 ms. The fix is therefore still necessary on the inspected main revision.
Existing source-selection contract: Discovery records explicit selection while retaining independently established bundled provenance. Manifest construction makes a selected bundled candidate source-preferred, and artifact selection preserves that source instead of replacing it with compiled output. The documented debugging contract expressly supports this path.
Findings None None.
Security None None.

How this fits together

The Telegram QA runner creates an isolated Gateway configuration and drives test conversations. Gateway plugin discovery and loading determine whether those conversations exercise checkout source or compiled artifacts.

flowchart TD
 A[QA run options] --> B[Isolated Gateway configuration]
 B --> C{Source mode selected?}
 C -->|Yes| D[Explicit Telegram source path]
 C -->|No| E[Normal built plugin selection]
 D --> F[Gateway plugin loader]
 E --> F
 F --> G[Telegram scenario evidence]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +22, Docs +3, Other +9. Total +34 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 22 0 +22
Docs 2 6 3 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 1 13 4 +9
Total 4 41 7 +34

Review metrics

Metric Value Why it matters
Source startup budget 300 seconds → 900 seconds; built mode stays at 45 seconds The reported 537-second source startup exceeds the previous default, while the existing explicit timeout override remains available.

Technical review

Best possible solution:

Keep Telegram source selection explicit in source-mode QA runs and document the remaining built-plugin behavior accurately.

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

Yes, source inspection establishes the mechanism: main supplies a discovery root without explicit source selection, allowing the loader’s built-artifact preference to win. The author reports a confirming Gateway probe; this review did not execute it.

Is this the best way to solve the issue?

Yes. Using the documented configured-source selection repairs the runner at its configuration boundary without changing shared loader policy or forcing every plugin through source compilation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fecba819ef2e.

Labels

Label changes:

  • add P2: This repairs a bounded QA correctness problem that can otherwise validate stale Telegram code.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports the real Gateway loading Telegram with the runner’s exact configuration: an inbound source marker fired and zero resolved Telegram modules came from dist. This directly covers artifact selection; a live Test Server conversation is unnecessary for this internal harness change. No stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body reports the real Gateway loading Telegram with the runner’s exact configuration: an inbound source marker fired and zero resolved Telegram modules came from dist. This directly covers artifact selection; a live Test Server conversation is unnecessary for this internal harness change. No stored-data contract changes.

Label justifications:

  • P2: This repairs a bounded QA correctness problem that can otherwise validate stale Telegram code.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured body reports the real Gateway loading Telegram with the runner’s exact configuration: an inbound source marker fired and zero resolved Telegram modules came from dist. This directly covers artifact selection; a live Test Server conversation is unnecessary for this internal harness change. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body reports the real Gateway loading Telegram with the runner’s exact configuration: an inbound source marker fired and zero resolved Telegram modules came from dist. This directly covers artifact selection; a live Test Server conversation is unnecessary for this internal harness change. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head patch adds a Telegram-only configured load path, passes the repository root from the production caller, removes an inert test trust variable, and increases only the source-mode readiness default. (.agents/skills/telegram-e2e-userbot/scripts/run-mock-sut-user-e2e.mjs:454, 7a66669847ab)
  • Current-main necessity: Fetched main still sets the bundled discovery directory and test trust variable without adding the explicit Telegram source selection; its source readiness default remains 300,000 ms. The fix is therefore still necessary on the inspected main revision. (.agents/skills/telegram-e2e-userbot/scripts/run-mock-sut-user-e2e.mjs:1176, fecba819ef2e)
  • Existing source-selection contract: Discovery records explicit selection while retaining independently established bundled provenance. Manifest construction makes a selected bundled candidate source-preferred, and artifact selection preserves that source instead of replacing it with compiled output. The documented debugging contract expressly supports this path. (src/plugins/manifest-registry-build.ts:475, 7a66669847ab)
  • Regression coverage: The added test protects generated configuration for both source and built runs. Existing loader tests independently exercise configured directory, file, and symlink selection against built peers, so the runner test covers a distinct configuration boundary without adding a test-only production seam. (.agents/skills/telegram-e2e-userbot/scripts/run-mock-sut-user-e2e.test.mjs:305, 7a66669847ab)
  • Reported production-boundary probe: The captured PR body reports a source Gateway using the runner’s exact configuration and environment with a fake Bot API: a marker in Telegram’s inbound pipeline fired for the delivered DM, none of 1,228 resolved Telegram modules came from dist, and discovery retained one bundled, explicitly selected candidate. Readiness arrived after 537 seconds. The author also reports 31 passing focused tests; those tests were not rerun during this read-only review. (7a66669847ab)
  • Cancellation and trust remain owned: The longer readiness deadline retains lease-aware fetches and cancellable sleeps. The removed environment variable grants test trust only in a Vitest runtime; the patch does not change loader trust rules, credentials, allowed Telegram principals, or lease settlement. (.agents/skills/telegram-e2e-userbot/scripts/telegram-run-scope.mjs:11, 7a66669847ab)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Avant: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • 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.

@steipete
steipete merged commit aac001b into main Oct 2, 2026
139 of 140 checks passed
@steipete
steipete deleted the steipete/goofy-hodgkin-307498 branch October 2, 2026 20:40
@steipete

steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Oct 2, 2026
* commit '79be075e5aa46be9e42dbd53ed6e30e81469210a': (33 commits)
  fix(ui): keep selected-text comment input readable while scrolling (#163772)
  test(memory): open corpus database explicitly
  fix: bound Doctor migration capture to plugin data (#163780)
  fix(ui): gate system information at the shared reader (#160982)
  chore(db): reclassify worker inventory sites with caller evidence (#163754)
  refactor(channels): deslop Slack and Matrix (#163740)
  fix(agents): reject empty sessions_search queries in the tool schema (#129120)
  perf(nodes): load only what a worker turn needs (#160442)
  test(cli): assert concise Gateway failure copy in CLI process tests (#163649)
  refactor(discord): deslop discord (#163728)
  fix(workboard): make Sessions boards work on multi-agent Gateways (#163761)
  test(gateway): add sustained heap retention diagnostics (#163764)
  test(ui): disambiguate session filter controls
  refactor(plugins): deslop imessage, mattermost, and voice-call (#163767)
  fix(qa): run Telegram plugin source in --source-gateway userbot runs (#163718)
  feat(macos): add a --no-activate launch flag for background automation (#163758)
  fix(agents): preserve host authority across module reloads (#163725)
  perf(gateway): serve the listener before multi-gigabyte store validation and honor clean-close receipts at startup (#163690)
  fix: keep video widgets scrollable and preload initial frames (#163762)
  feat(memory): add a provider-neutral memory provider runtime (#162175)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
…penclaw#163718)

The Telegram userbot runner's --source-gateway mode claimed to run the
exact TypeScript checkout, but in any built checkout the Gateway executed
dist/extensions/telegram. Gateway startup passes preferBuiltPluginArtifacts,
which swaps bundled source entries for their canonical root build, so
Telegram proofs silently exercised stale built code.

Source mode now selects the bundled Telegram source entry through
plugins.load.paths, the documented intentional source-entry selection. The
alias merges into the bundled candidate, keeping bundled trust, and the
loader executes the checkout's Telegram source. The inert Vitest-only
OPENCLAW_TEST_TRUST_BUNDLED_PLUGINS_DIR is dropped; OPENCLAW_BUNDLED_PLUGINS_DIR
stays so dist core copies resolve the same bundled root. The source-mode
readiness default grows from 300 s to 900 s because compiling the Telegram
source pushed /readyz to 537 s on a loaded host. Help and skill docs now say
core and Telegram run from source while other plugins use built output.
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 3, 2026
* commit '1fda703fb4d3630e4633461967b2a2186e8f15fd': (33 commits)
  fix(ui): keep selected-text comment input readable while scrolling (openclaw#163772)
  test(memory): open corpus database explicitly
  fix: bound Doctor migration capture to plugin data (openclaw#163780)
  fix(ui): gate system information at the shared reader (openclaw#160982)
  chore(db): reclassify worker inventory sites with caller evidence (openclaw#163754)
  refactor(channels): deslop Slack and Matrix (openclaw#163740)
  fix(agents): reject empty sessions_search queries in the tool schema (openclaw#129120)
  perf(nodes): load only what a worker turn needs (openclaw#160442)
  test(cli): assert concise Gateway failure copy in CLI process tests (openclaw#163649)
  refactor(discord): deslop discord (openclaw#163728)
  fix(workboard): make Sessions boards work on multi-agent Gateways (openclaw#163761)
  test(gateway): add sustained heap retention diagnostics (openclaw#163764)
  test(ui): disambiguate session filter controls
  refactor(plugins): deslop imessage, mattermost, and voice-call (openclaw#163767)
  fix(qa): run Telegram plugin source in --source-gateway userbot runs (openclaw#163718)
  feat(macos): add a --no-activate launch flag for background automation (openclaw#163758)
  fix(agents): preserve host authority across module reloads (openclaw#163725)
  perf(gateway): serve the listener before multi-gigabyte store validation and honor clean-close receipts at startup (openclaw#163690)
  fix: keep video widgets scrollable and preload initial frames (openclaw#163762)
  feat(memory): add a provider-neutral memory provider runtime (openclaw#162175)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant