Skip to content

improve(test): reduce Telegram policy fixture startup overhead - #143192

Merged
vincentkoc merged 1 commit into
mainfrom
perf/telegram-policy-preflight-20260909
Sep 9, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
perf/telegram-policy-preflight-20260909

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Related: #139428 (#139428)

What Problem This Solves

The Telegram inherited-policy E2E fixture repeats development-runner freshness checks for each CLI operation even though E2E setup already prepares the runtime. Those checks add overhead to both policy cases.

Why This Change Was Made

Launch the prepared CLI through the existing signal-forwarding run-with-env wrapper and explicitly preserve OPENCLAW_DEV_SOURCE_ROOT. Use a file URL for the preload so Windows paths and special characters are handled correctly. The change is confined to one test file.

Both cases retain fresh state, all ten auth/help/repair/Gateway operations, packaged plugins, the working directory, verbose output, timeouts, HTTP assertions and cleanup. No production, helper, dependency, configuration or workflow changes.

User Impact

No product behavior changes. Developers get lower startup overhead in this focused E2E test without removing its policy-inheritance or real-dispatch coverage.

Evidence

  • Original, initial candidate and closing-original full-file runs each passed 2/2, with zero skipped and all ten fixture operations.
  • Case totals were 127.310s / 100.887s / 108.136s. Candidate was 7.249s lower than closing original, with 6.242s attributable to the measured auth/help operations. This is one bounded comparison, not a whole-CI estimate; repair warm-up, worker preparation and outer invocation variance are not claimed as runner savings.
  • After making the preload a portable file URL, one additional final-source full-file run passed 2/2, zero skipped, with all ten operations and verified recorded cleanup. Loader probes covered the Windows drive-letter rejection and an actual filename containing spaces, # and %.
  • Separate diagnostic runs verified selected inner CLI environments, actual compiled core/Telegram module bytes, and observed process-group/port release before and after owned-root deletion. These instrumented runs are correctness evidence, not performance measurements.
  • Opposite account policies failed both original policy assertions with the intended downstream effects. Original and candidate startup-failure controls rejected at the existing onListening boundary and released their observed processes, ports and roots with unchanged deadlines.
  • Required one-file check-changed passed, including formatting, root test typechecking, script guards and targeted lint. Affected formatting, root types and file lint passed again after the preload URL correction. Fresh full local P2 review of the final diff was scoped-clean.

Proof used the existing prebuilt E2E contract with matching complete private-QA, AI and runtime-overlay artifacts. Normal worker preparation remained enabled. Transport/provider endpoints were fixture-owned mocks, not a live Telegram account.

All local measurements and loader probes ran on Linux; no native Windows E2E execution was performed.

@vincentkoc vincentkoc self-assigned this Sep 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 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.

@vincentkoc
vincentkoc marked this pull request as ready for review September 9, 2026 14:44
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 9, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Sep 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 10:53 AM ET / 14:53 UTC.

ClawSweeper review

What this changes

The Telegram policy test launches the prepared CLI through the existing environment and signal-forwarding wrapper to avoid repeated development-build checks.

Merge readiness

✅ Ready for maintainer review

This remains a useful, bounded test-performance improvement. Current main and the latest release retain the repeated development-runner path; no introduced correctness defect was found.

Priority: P3
Reviewed head: 5522be843f4d5026beb6f709c33b523b13566690

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with preserved behavioral assertions, useful bounded validation, and no actionable defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored test-only PR is exempt from the external-contributor proof gate; its body reports final-source Gateway fixture runs and cleanup controls on Linux, with no native Windows run claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored test-only PR is exempt from the external-contributor proof gate; its body reports final-source Gateway fixture runs and cleanup controls on Linux, with no native Windows run claimed.
Evidence reviewed 8 items Introduced change and retained coverage: The verified merge-base-to-head diff changes only the fixture launch prefix and adds the file-URL import. Both policy cases, downstream rejection checks, reply assertions, deadlines, packaged-plugin selection, and cleanup remain intact.
Existing runtime preparation contract: E2E preparation builds the private-QA runtime and AI artifacts before workers, or honors the existing prebuilt-artifact contract. The fixture can therefore reuse prepared output without repeating development-runner freshness checks for each CLI operation.
Environment and lifecycle preservation: The existing wrapper parses assignment arguments without a shell, inherits the fixture environment, forwards termination signals, and manages child-process groups. Explicit OPENCLAW_DEV_SOURCE_ROOT retains checkout plugin selection previously supplied by the development runner.
Findings None None.
Security None None.

How this fits together

The E2E fixture starts an isolated Gateway with simulated Telegram and provider endpoints. It checks that inherited group policies reject forbidden messages before downstream work and deliver admitted replies.

flowchart LR
  A[E2E runtime preparation] --> B[Prepared CLI artifacts]
  B --> C[Environment and signal wrapper]
  C --> D[Isolated Gateway]
  E[Simulated Telegram messages] --> D
  D --> F[Policy rejection or admission]
  F --> G[Provider and delivery assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +9. Total +9 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 10 1 +9
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 10 1 +9

Review metrics

Metric Value Why it matters
Bounded startup comparison 7.249s lower; 6.242s attributed to auth/help The reported comparison supports a focused startup benefit without claiming whole-suite or CI savings.

Technical review

Best possible solution:

Reuse the prepared runtime through existing launch infrastructure while retaining independent policy, delivery, and process-cleanup coverage.

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

Not applicable as a product bug: source confirms repeated development-runner invocations, and the PR supplies bounded timing comparisons; this read-only review ran no tests.

Is this the best way to solve the issue?

Yes. Reusing the existing wrapper is a narrow approach supported by E2E runtime preparation, without changing assertions or adding production infrastructure.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a test-startup optimization with no production behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored test-only PR is exempt from the external-contributor proof gate; its body reports final-source Gateway fixture runs and cleanup controls on Linux, with no native Windows run claimed.

Label justifications:

  • P3: This is a test-startup optimization with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored test-only PR is exempt from the external-contributor proof gate; its body reports final-source Gateway fixture runs and cleanup controls on Linux, with no native Windows run claimed.

Evidence

What I checked:

  • Introduced change and retained coverage: The verified merge-base-to-head diff changes only the fixture launch prefix and adds the file-URL import. Both policy cases, downstream rejection checks, reply assertions, deadlines, packaged-plugin selection, and cleanup remain intact. (test/e2e/qa-lab/runtime/telegram-inherited-policy-gateway.e2e.test.ts:145, 5522be843f4d)
  • Existing runtime preparation contract: E2E preparation builds the private-QA runtime and AI artifacts before workers, or honors the existing prebuilt-artifact contract. The fixture can therefore reuse prepared output without repeating development-runner freshness checks for each CLI operation. (scripts/lib/vitest-build-prerequisites.mts:212, 5522be843f4d)
  • Environment and lifecycle preservation: The existing wrapper parses assignment arguments without a shell, inherits the fixture environment, forwards termination signals, and manages child-process groups. Explicit OPENCLAW_DEV_SOURCE_ROOT retains checkout plugin selection previously supplied by the development runner. (scripts/run-with-env.mts:121, 5522be843f4d)
  • Current main still uses the original launch path: Fetched main retains scripts/run-node.mjs in this fixture. The reviewed launch helpers and prerequisite owner also match current main. (test/e2e/qa-lab/runtime/telegram-inherited-policy-gateway.e2e.test.ts:144, 7a1ff2c65841)
  • Latest-release comparison: The supplied latest release, v2026.9.3, also retains the development-runner prefix; this optimization is not already present there. (test/e2e/qa-lab/runtime/telegram-inherited-policy-gateway.e2e.test.ts:144, 1391f7cd2d40)
  • Reported validation and bounded timing evidence: The supplied complete PR body reports final-source 2/2 passing cases, all ten fixture operations, cleanup observations, opposite-policy sensitivity controls, startup-failure controls, and portable-loader probes. Its bounded comparison reports 7.249 seconds below the closing original run, with 6.242 seconds attributed to auth/help operations. These are contributor-reported Linux observations, not independently executed review results or whole-suite savings. (5522be843f4d)

Likely related people:

  • Peter Steinberger: 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.

@vincentkoc
vincentkoc merged commit 119fe69 into main Sep 9, 2026
177 checks passed
@vincentkoc
vincentkoc deleted the perf/telegram-policy-preflight-20260909 branch September 9, 2026 15:13
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 9, 2026
…er-ownership-20260909

* origin/main: (147 commits)
  fix(cli): reject blank account selectors before command startup (#143088)
  fix(update): repair young runs after recorded drivers exit (#143136)
  test(telegram): close model callback fixture connections (#143197)
  improve(test): reduce Telegram policy fixture startup overhead (#143192)
  test(ci): stabilize systemd manager shim timing (#143134)
  fix(test): retire chat preview Escape listeners during teardown (#143191)
  test(memory-wiki): share visibility test callbacks (#143181)
  fix(ci): accept native iOS keychain filenames (#142968)
  fix(ci): show publication observations in FRV status (#143171)
  fix(github): point the stuck-FAQ auto-response at a live anchor (#143194)
  docs: correct verified accuracy defects in CLI, tools, and automation pages (#143179)
  refactor(tests): remove duplicate Mistral cache-cost test (#143172)
  fix(doctor): complete canonical model-reference migration (#142284)
  fix(ci): reject stale and empty timing sample cohorts (#143182)
  fix(ui): remove first-reply confetti from chat (#143167)
  docs: split help/faq into 13 topic pages (#143150)
  refactor(docs): require caller-owned route indexes (#143164)
  fix(android): distinguish connection status from chat readiness (#143128)
  refactor: share agent-turn execution test defaults (#143166)
  fix(cli): print immutable-config refusals without crash framing (#143140)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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