Repository navigation
qa-lab: add Matrix live transport QA lane - #64489
Conversation
|
@greptile review |
|
@codex review |
Greptile SummaryThis PR adds a Docker-backed Matrix live QA lane to Confidence Score: 5/5Safe to merge; all remaining findings are P2 style/cleanup suggestions that do not affect correctness. The Matrix live lane implementation is thorough: Docker health parsing, readiness gating, shared live-lane contract, and status-helper propagation are all handled correctly. The two findings are a small dead-code block and a minor sleep-style inconsistency — neither affects runtime behavior. extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.ts — two P2 suggestions on lines 252 and 527–535 Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.ts
Line: 527-535
Comment:
**Unreachable cleanup-error branch**
When `cleanupErrors.length > 0`, lines 435–441 already push a `"Matrix cleanup"` check with `status: "fail"` into `checks`. That makes `failedChecks.length > 0`, so the guard at line 515 throws first — this block is never reached. It's dead code and can be removed.
```suggestion
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.ts
Line: 252
Comment:
**Inconsistent sleep: global `setTimeout` vs imported `sleep`**
The file imports `import { setTimeout as sleep } from "node:timers/promises"` at the top, but `waitForMatrixChannelReady` uses the global callback-based `setTimeout` here. Prefer the already-imported promise-based alias for consistency.
```suggestion
await sleep(pollMs);
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "qa-lab: drop live transport finder cruft" | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Adds a real, Docker-backed Matrix “live transport” QA lane to qa-lab, while refactoring Telegram’s live lane to share a common live-transport scenario contract and improving runtime status propagation needed for readiness gating.
Changes:
- Introduces a Matrix live QA lane (Docker Tuwunel harness + driver client + scenario suite + CLI command + docs).
- Adds shared live-transport scenario selection/coverage helpers and standardizes Telegram live lane around them (including improved cleanup + artifact error formatting).
- Extends runtime status snapshots to preserve transport connectivity metadata used by readiness checks; refactors shared Docker helper utilities.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/plugin-sdk/status-helpers.ts |
Extends runtime account status snapshots with connectivity/health metadata fields. |
src/plugin-sdk/status-helpers.test.ts |
Adds coverage to ensure connectivity metadata is preserved in snapshots. |
extensions/qa-lab/src/qa-gateway-config.ts |
Adds includeQaChannel toggle so live-lane gateway children can omit qa-channel. |
extensions/qa-lab/src/qa-gateway-config.test.ts |
Tests default inclusion and explicit omission of qa-channel. |
extensions/qa-lab/src/mock-openai-server.ts |
Updates directive parsing to prefer the latest “exact marker/reply exactly” instruction. |
extensions/qa-lab/src/mock-openai-server.test.ts |
Verifies latest-directive behavior with multi-turn inputs. |
extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.ts |
Refactors Telegram live lane to shared gateway harness + shared scenario contract + improved cleanup/artifact errors. |
extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.test.ts |
Adds coverage checks against the shared live-transport baseline contract. |
extensions/qa-lab/src/live-transports/shared/live-transport-scenarios.ts |
New shared scenario contract/types + selection + coverage/missing helpers. |
extensions/qa-lab/src/live-transports/shared/live-transport-scenarios.test.ts |
Tests selection, error messaging, ordering, and coverage/missing computations. |
extensions/qa-lab/src/live-transports/shared/live-lane-helpers.ts |
New shared helpers for cleanup issue aggregation + standardized artifact error formatting. |
extensions/qa-lab/src/live-transports/shared/live-gateway.runtime.ts |
New shared live-lane gateway harness (gateway child + optional mock provider + aggregated shutdown errors). |
extensions/qa-lab/src/live-transports/shared/live-gateway.runtime.test.ts |
Tests mock wiring, frontier wiring, and aggregated shutdown error behavior. |
extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.ts |
New Matrix live lane runner (harness + provisioning + readiness gating + scenarios + artifacts). |
extensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.test.ts |
Tests config injection, artifact redaction, readiness gating logic, and summary shaping. |
extensions/qa-lab/src/live-transports/matrix/matrix-live-scenarios.ts |
New Matrix scenario definitions + execution logic + standard-contract coverage reporting. |
extensions/qa-lab/src/live-transports/matrix/matrix-live-scenarios.test.ts |
Tests default scenario set, prompt shape, unknown IDs, and baseline contract coverage. |
extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.ts |
New Docker-backed Tuwunel harness runtime (compose generation, health waiting, host/container URL fallback). |
extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.test.ts |
Tests compose/manifest writing, startup flow, empty health fallback, and container-IP fallback. |
extensions/qa-lab/src/live-transports/matrix/matrix-driver-client.ts |
New Matrix driver client for provisioning + sync polling + message/thread/reaction primitives + event normalization. |
extensions/qa-lab/src/live-transports/matrix/matrix-driver-client.test.ts |
Tests mention formatting, normalization, reaction send, UIAA auth progression, and provisioning behavior. |
extensions/qa-lab/src/gateway-child.ts |
Threads includeQaChannel into gateway config construction. |
extensions/qa-lab/src/docker-up.runtime.ts |
Refactors Docker-up runtime to use shared docker helper utilities and safer URL fallback. |
extensions/qa-lab/src/docker-runtime.ts |
New shared Docker utilities (exec, host-port selection, health checks, compose service URL resolution, health parsing). |
extensions/qa-lab/src/cli.ts |
Adds pnpm openclaw qa matrix command wiring + options. |
extensions/qa-lab/src/cli.runtime.ts |
Adds runtime dispatch for Matrix QA lane and updates Telegram import path to new location. |
extensions/qa-lab/src/cli.runtime.test.ts |
Tests Matrix command path resolution + provider-mode defaulting behavior. |
docs/help/testing.md |
Documents Matrix live lane + shared transport contract and current coverage matrix. |
docs/concepts/qa-e2e-automation.md |
Adds Matrix live lane guidance and explains the shared contract/coverage model. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🔒 Aisle Security AnalysisWe found 5 potential security issue(s) in this PR:
1. 🟡 Telegram bot token may be logged in cleartext on SSRF-block events
Description
Vulnerable code: logWarn(
`security: blocked URL fetch (${context}) target=${parsedUrl.origin}${parsedUrl.pathname} reason=${err.message}`,
);RecommendationRedact sensitive data from logged URLs (or avoid logging paths entirely). Suggested fix (redact before logging): import { redactSensitiveText } from "../../logging/redact.js";
// ...
const target = `${parsedUrl.origin}${parsedUrl.pathname}`;
logWarn(
`security: blocked URL fetch (${context}) target=${redactSensitiveText(target)} reason=${redactSensitiveText(err.message)}`,
);Even better: log only hostname (and maybe a hash of the path) for security events: logWarn(`security: blocked URL fetch (${context}) host=${parsedUrl.hostname} reason=${redactSensitiveText(err.message)}`);2. 🟡 Arbitrary file write via unvalidated outputDir in runMatrixQaLive()
Description
Vulnerable code: const outputDir =
params.outputDir ??
path.join(repoRoot, ".artifacts", "qa-e2e", `matrix-${Date.now().toString(36)}`);
await fs.mkdir(outputDir, { recursive: true });Downstream sinks include RecommendationValidate Example fix (reuse the repo-relative resolver): import { resolveRepoRelativeOutputDir } from "../../cli-paths.js";
const repoRoot = path.resolve(params.repoRoot ?? process.cwd());
const resolvedOutputDir =
resolveRepoRelativeOutputDir(repoRoot, params.outputDir) ??
path.join(repoRoot, ".artifacts", "qa-e2e", `matrix-${Date.now().toString(36)}`);
await fs.mkdir(resolvedOutputDir, { recursive: true });Also consider rejecting paths containing symlinks that escape the repo root if you need stronger guarantees. 3. 🟡 Arbitrary file write via unvalidated outputDir in runTelegramQaLive()
Description
Vulnerable code: const outputDir =
params.outputDir ??
path.join(repoRoot, ".artifacts", "qa-e2e", `telegram-${Date.now().toString(36)}`);
await fs.mkdir(outputDir, { recursive: true });Downstream sinks include RecommendationValidate Example fix (reuse the repo-relative resolver): import { resolveRepoRelativeOutputDir } from "../../cli-paths.js";
const repoRoot = path.resolve(params.repoRoot ?? process.cwd());
const resolvedOutputDir =
resolveRepoRelativeOutputDir(repoRoot, params.outputDir) ??
path.join(repoRoot, ".artifacts", "qa-e2e", `telegram-${Date.now().toString(36)}`);
await fs.mkdir(resolvedOutputDir, { recursive: true });If symlink escape is a concern, resolve/realpath and re-check containment before writing. 4. 🟡 Docker Compose YAML injection via unquoted Matrix QA image override
Description
Vulnerable code: return `services:
matrix-qa-homeserver:
image: ${params.image}
...
`;RecommendationTreat the image reference as untrusted input and prevent YAML/compose injection. Options:
function assertSafeImageRef(image: string) {
if (!/^[a-z0-9./:_-]+(@sha256:[a-f0-9]{64})?$/.test(image)) {
throw new Error(`Invalid Docker image reference`);
}
}
import yaml from "yaml";
const composeObj = {
services: {
[MATRIX_QA_SERVICE]: {
image,
ports: [`127.0.0.1:${homeserverPort}:${MATRIX_QA_INTERNAL_PORT}`],
environment: { /* ... */ },
volumes: ["./data:/var/lib/tuwunel"],
},
},
};
await fs.writeFile(composeFile, yaml.stringify(composeObj), { mode: 0o600 });Additionally, consider pinning to a digest (e.g., 5. 🟡 Docker Compose YAML injection via unescaped Matrix QA harness parameters
DescriptionThe Matrix QA harness writes a Impact:
Key issues:
Vulnerable code: return `services:\n ${MATRIX_QA_SERVICE}:\n image: ${params.image}\n...
TUWUNEL_REGISTRATION_TOKEN: "${params.registrationToken}"\n TUWUNEL_SERVER_NAME: "${params.serverName}"\n`;Data flow:
RecommendationAvoid hand-rolling YAML with string interpolation for untrusted values. Preferred fix: build a JS object and serialize with a YAML library that correctly quotes/escapes strings. import yaml from "yaml";
const doc = {
services: {
[MATRIX_QA_SERVICE]: {
image: params.image,
ports: [`127.0.0.1:${params.homeserverPort}:${MATRIX_QA_INTERNAL_PORT}`],
environment: {
TUWUNEL_ADDRESS: "0.0.0.0",
TUWUNEL_ALLOW_ENCRYPTION: "false",
TUWUNEL_ALLOW_FEDERATION: "false",
TUWUNEL_ALLOW_REGISTRATION: "true",
TUWUNEL_DATABASE_PATH: "/var/lib/tuwunel",
TUWUNEL_PORT: String(MATRIX_QA_INTERNAL_PORT),
TUWUNEL_REGISTRATION_TOKEN: params.registrationToken,
TUWUNEL_SERVER_NAME: params.serverName,
},
volumes: ["./data:/var/lib/tuwunel"],
},
},
};
await fs.writeFile(composeFile, yaml.stringify(doc), { encoding: "utf8", mode: 0o600 });Additional hardening (recommended):
Analyzed PR: #64489 at commit Last updated on: 2026-04-10T23:41:10Z |
a288019 to
d6d41d4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6d41d4efe
ℹ️ 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".
|
Bot/check triage: Fixed:
Rejected / no PR action:
Targeted validation run:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 398b136eb8
ℹ️ 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".
|
Follow-up bot/security triage on the latest head: Fixed:
Rejected / no PR action under
Targeted validation for this follow-up:
|
7c69070 to
e859084
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b473af743c
ℹ️ 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".
2fccaa1 to
93ce6e1
Compare
93ce6e1 to
ae9bb37
Compare
|
Merged via squash.
Thanks @gumadeiras! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae9bb37751
ℹ️ 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".
Merged via squash. Prepared head SHA: ae9bb37 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: ae9bb37 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: ae9bb37 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: ae9bb37 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: ae9bb37 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: ae9bb37 Co-authored-by: gumadeiras <[email protected]> Co-authored-by: gumadeiras <[email protected]> Reviewed-by: @gumadeiras
Consolidate image traversal, request observation ownership, bus waiters, Slack response classification, Node selection and WebSocket decoding. Retire the generic Windows executable export after its Node caller moved; keep trusted taskkill/PowerShell paths and all environment validation. Remove duplicate planner validation and unsupported private lifecycle guards. Keep external evidence validation, security authority, resource limits and ordinary write-capable shutdown settlement. Also preserve WhatsApp audio preflight when enabling message actions and avoid recording a POSIX pipe-drain failure during the normal TERM grace. Best-effort tradeoffs accepted: - Bus cloning trusts its private typed event union. 0ebeee8 added the unsupported-kind throw only for lint; fabricated internal kinds now fail naturally, and a new typed variant must update this owner at compile time. - Overlapping private QA driver transitions are unsupported; callers await them. #113855 introduced synthetic interleavings, not a human incident. - Canonical smoke selection is trusted instead of revalidated; #114055 was an ownership cutover. A future selector defect belongs at that owner. - Wire image inputs are parsed JSON trees. #71311 introduced no human cyclic-input incident; unsupported internal cyclic objects are best effort. - Fabricated cyclic/BigInt tool outputs now fail clearly instead of becoming empty evidence. 195e721 added stabilization, not a human incident. - Reinstalling the private AIMock mount is unsupported. bdc9c60 added speculative guards; the actual owner installs it once before start. - Obsolete repeated observer disposal after port reuse can remove the newer QA lookup. 6386dc4 was an affinity repair, not a disposal incident; normal unique-port ownership and stop ordering prevent that lifecycle. - Local non-federated Matrix joins fail immediately on setup errors; #64489 added initial coverage, not a reported transient-join incident. Rerun the QA command after an unusual setup fault. - Artifact publication is trusted after its awaited atomic writer. #92606 added suite execution, not a missing-write incident; deletion afterward is reported by normal readers. - Native browser JSON needs no branded rawJSON surrogate workaround. #140882 added that generality without a human incident; a future branded producer must own its serialization contract. - Insertion-only pending caches clear directly on settlement. #113926 and #128379 supplied no human successor-eviction incident; no replacement can precede these finalizers. Real close-time successor checks stay. - Re-registering the identical private borrowed-relay handle is unsupported. #128379/#133706 introduced no such incident; the owner creates fresh handles and current authority and distinct-successor comparisons remain. - Inconclusive Linux process snapshots conservatively stay alive until the next check. #132230/#131643 used controlled fault injection, not a human actual-use incident. Final unconfirmed settlement retains state for retry.
…0889) Consolidate image traversal, request observation ownership, bus waiters, Slack response classification, Node selection and WebSocket decoding. Retire the generic Windows executable export after its Node caller moved; keep trusted taskkill/PowerShell paths and all environment validation. Remove duplicate planner validation and unsupported private lifecycle guards. Keep external evidence validation, security authority, resource limits and ordinary write-capable shutdown settlement. Also preserve WhatsApp audio preflight when enabling message actions and avoid recording a POSIX pipe-drain failure during the normal TERM grace. Best-effort tradeoffs accepted: - Bus cloning trusts its private typed event union. f993a27 added the unsupported-kind throw only for lint; fabricated internal kinds now fail naturally, and a new typed variant must update this owner at compile time. - Overlapping private QA driver transitions are unsupported; callers await them. openclaw#113855 introduced synthetic interleavings, not a human incident. - Canonical smoke selection is trusted instead of revalidated; openclaw#114055 was an ownership cutover. A future selector defect belongs at that owner. - Wire image inputs are parsed JSON trees. openclaw#71311 introduced no human cyclic-input incident; unsupported internal cyclic objects are best effort. - Fabricated cyclic/BigInt tool outputs now fail clearly instead of becoming empty evidence. 5929e9a added stabilization, not a human incident. - Reinstalling the private AIMock mount is unsupported. e98e098 added speculative guards; the actual owner installs it once before start. - Obsolete repeated observer disposal after port reuse can remove the newer QA lookup. ace0e05 was an affinity repair, not a disposal incident; normal unique-port ownership and stop ordering prevent that lifecycle. - Local non-federated Matrix joins fail immediately on setup errors; openclaw#64489 added initial coverage, not a reported transient-join incident. Rerun the QA command after an unusual setup fault. - Artifact publication is trusted after its awaited atomic writer. openclaw#92606 added suite execution, not a missing-write incident; deletion afterward is reported by normal readers. - Native browser JSON needs no branded rawJSON surrogate workaround. openclaw#140882 added that generality without a human incident; a future branded producer must own its serialization contract. - Insertion-only pending caches clear directly on settlement. openclaw#113926 and openclaw#128379 supplied no human successor-eviction incident; no replacement can precede these finalizers. Real close-time successor checks stay. - Re-registering the identical private borrowed-relay handle is unsupported. openclaw#128379/openclaw#133706 introduced no such incident; the owner creates fresh handles and current authority and distinct-successor comparisons remain. - Inconclusive Linux process snapshots conservatively stay alive until the next check. openclaw#132230/openclaw#131643 used controlled fault injection, not a human actual-use incident. Final unconfirmed settlement retains state for retry.
Summary
qa-labhad no real Matrix live transport lane, so transport regressions around readiness, mention gating, sender allowlists, reply shape, reactions, and restart/resume could slip past the syntheticqa-channelsuite.qa-channellane's role.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
qa-lab, and the shared live-transport seams were too weak for one. The work exposed missing coverage and weak abstractions around Docker health parsing, per-actor Matrix sync state, live-lane startup/cleanup, and lane-specific CLI ownership.Regression Test Plan (if applicable)
extensions/qa-lab/src/docker-up.runtime.test.tsextensions/qa-lab/src/live-transports/matrix/matrix-driver-client.test.tsextensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.test.tsextensions/qa-lab/src/live-transports/matrix/matrix-live-scenarios.test.tsextensions/qa-lab/src/live-transports/matrix/matrix-live.runtime.test.tsextensions/qa-lab/src/live-transports/shared/live-gateway.runtime.test.tssrc/plugin-sdk/status-helpers.test.tsdocker compose ps --format jsonparsing, actor-scoped Matrix/synccursors, Matrix canary/thread/top-level/reaction/restart/allowlist behavior, and shared live-lane status propagation.User-visible / Behavior Changes
pnpm openclaw qa matrixlive transport lane with a disposable local Matrix homeserver harness and Matrix-specific artifacts.extensions/qa-lab/src/live-transports/*with shared live-lane option/runtime helpers.channels.statusnow preserves richer runtime connectivity metadata for channel runtimes that expose it.Diagram (if applicable)
Security Impact (required)
Yes, explain risk + mitigation:Repro + Verification
Environment
ghcr.io/matrix-construct/tuwunel:v1.5.1mock-openaiSteps
pnpm checkpnpm test extensions/qa-lab/src/docker-up.runtime.test.ts extensions/qa-lab/src/live-transports/matrix/matrix-harness.runtime.test.tstimeout 420 pnpm openclaw qa matrix --provider-mode mock-openai --output-dir .artifacts/qa-e2e/matrix-final-20260410-1923Expected
Actual
pnpm checkpassed on the PR head.2files,11tests).pnpm openclaw qa matrix --provider-mode mock-openaipassed on the PR head (10/10).Evidence
Attach at least one:
Human Verification (required)
pnpm checkon the PR head--format jsonarray parsinglive-frontierMatrix runReview Conversations
Compatibility / Migration
OPENCLAW_QA_MATRIX_TUWUNEL_IMAGEto override the pinned homeserver image.Risks and Mitigations
qa-lablive-transport seams, so regressions could spill into Telegram or future live lanes.