Skip to content

fix(qa): isolate packaged mock auth bootstrap - #126247

Merged
vincentkoc merged 3 commits into
mainfrom
fix/telegram-qa-auth-bootstrap
Aug 20, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
fix/telegram-qa-auth-bootstrap

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes a package-backed Telegram QA failure where the installed candidate auth CLI attempted to mutate the runner-owned immutable canonical config before Gateway startup.

Current-main workflow run https://github.com/openclaw/openclaw/actions/runs/32348061162 failed fast at this boundary with inherited Bash startup state and a config permission failure. The prior reservation hang is separately resolved by #126370; this change preserves its reserveQaGatewayPort(net.createServer()) release lifecycle.

Why This Change Was Made

The QA harness records only generic mock-auth profile selection in the canonical config. Packaged candidate auth commands receive a regular, non-symlink 0600 scratch config under the SUT state directory while sharing the Gateway's single OPENCLAW_STATE_DIR and SQLite auth store. The Gateway remains pinned to the immutable canonical config.

buildQaRuntimeEnv removes BASH_ENV, BASHOPTS, ENV, SHELLOPTS, and exported BASH_FUNC_* functions after caller runtime patches and before any launcher or runtime child is created. The late privileged-launcher cleanup is removed. Strict mode, process identity checks, environment-key attestation, and the current Gateway port-reservation lifecycle remain intact.

User Impact

Release maintainers can run the package-backed Telegram QA lane without mock-auth bootstrap violating the SUT config ownership boundary or inherited shell startup state aborting the privileged launcher. Product CLI, auth, config, filesystem, SQLite schema, and release behavior are unchanged.

Evidence

  • Exact head: dac4bf581a7a0ed98f7b1be1b7a9f744f0a61357
  • Original Blacksmith Testbox tbx_01m0cf6nbp7p8bsa8yvmbd2pyz: workflow 16/16, Gateway child 87/87
  • Original Testbox run: https://github.com/openclaw/openclaw/actions/runs/32228623755
  • Focused local fallback after Testbox network failure:
    • workflow tests: 15 passed, 2 skipped
    • Gateway child tests: 87 passed, 1 Linux-only skipped
  • Local exact-head ClawSweeper found the exported Bash-function boundary on 9ef352a64121f99de681a0b428992aafca72fcdc; dac4bf581a7a0ed98f7b1be1b7a9f744f0a61357 scrubs the prefix and adds adjacent unit plus Linux Bash coverage.
  • Exact-head CI: all required checks passed, including the Linux QA smoke profiles and security/process boundaries.
  • pnpm exec oxfmt --check on all six PR paths
  • git diff --check
  • Local check-changed passed formatting, guards, contract tests, plugin boundaries, and dead-export scans, then stopped in extension typecheck on unrelated existing extensions/acpx, extensions/cua-computer, and packages/terminal-core dependency-type errors. No dependency reconciliation or unrelated edits were made; exact-head clean-checkout CI is required.

Exact-head Package Acceptance proof

  • Run: https://github.com/openclaw/openclaw/actions/runs/32424682627
  • Workflow and proof harness SHA: 754ba927782bfda73f113295a1411eafa2017890
  • Package source SHA: dac4bf581a7a0ed98f7b1be1b7a9f744f0a61357
  • Resolver and package integrity: passed
  • Telegram child job: created and passed with advisory=false
  • Scenario: telegram-commands-command, mock-openai, 1 passed / 0 failed
  • Runtime invariants: Gateway ready; startup-script and exported-function markers absent; exactly two packaged auth calls; scratch auth config mode 0600; canonical config unchanged; packaged auth and Gateway shared one SQLite auth store
  • Broad lanes: npm 12 install.sh and both Docker acceptance jobs skipped
  • Summary gate: passed
  • Scope caveat: this is focused Package Acceptance runtime proof of the package-backed Telegram path, not execution of the modified release Telegram workflow.

ClawSweeper rank-up move disposition

  • Exact-head required CI completed green.
  • The optional modified release-workflow rerun was not executed. Maintainer-approved scope uses the focused Package Acceptance run above to exercise the final package-backed auth, Gateway, environment, and SQLite boundaries without interacting with release or publication workflows.

Change Size

  • Production runtime: +62/-18 to establish the packaged auth/config boundary and scrub parent shell startup controls plus exported functions at the child-environment owner
  • Workflow: +22/-6 to enforce and attest the isolated launcher contract
  • Tests: +109/-17

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc vincentkoc self-assigned this Aug 19, 2026
@vincentkoc
vincentkoc force-pushed the fix/telegram-qa-auth-bootstrap branch from 2b5a67f to 648bd40 Compare August 19, 2026 07:55
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. 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 Aug 19, 2026
@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 4:30 PM ET / 20:30 UTC.

ClawSweeper review

What this changes

The PR gives packaged mock-auth bootstrap a writable isolated config while retaining the Gateway’s canonical config, and removes inherited shell-startup controls from QA child environments.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No discrete patch defect found. Keep this maintainer-authored PR open while exact-head CI completes and the final shell-environment hardening receives package-backed workflow proof.

Priority: P2
Reviewed head: dac4bf581a7a0ed98f7b1be1b7a9f744f0a61357

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation and focused tests are solid, but the provided package run predates the final environment-hardening commit.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: This maintainer-authored internal QA PR is not subject to the external-contributor proof gate; supplied package evidence is useful but predates the final head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal QA PR is not subject to the external-contributor proof gate; supplied package evidence is useful but predates the final head.
Evidence reviewed 7 items Current-main failure mechanism: The real API-key command writes both the agent auth store and the active config, so directing packaged bootstrap at the runner-owned canonical config can fail at its write boundary.
Current-main workflow boundary: Current main exports the canonical temp-root config to the SUT after making it runner-owned mode 0640; it has no bootstrap-config exception.
Proposed owner-boundary repair: The branch copies the canonical configuration into a mode-0600 state-local bootstrap file, gives only the packaged auth command that path, and verifies the canonical file was unchanged before Gateway launch.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child.test.ts

Result: FAIL (partial) — step 2 expect_output lets an explicit packaged command own mock auth state before gateway spawn: expected terminal output was not visible within 30 seconds: "lets an explicit packaged command own mock auth state before gateway spawn"

node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126247-C8Lbo9/target$ node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child.test.ts
node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child.test.ts
[test] starting test/vitest/vitest.extension-qa.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-126247-C8Lbo9/target

 ✓  extension-qa  extensions/qa-lab/src/gateway-child.test.ts (88 tests) 7791ms
     ✓ cleans up temp QA gateway roots when node path resolution fails before startup  542ms
     ✓ cleans staged QA runtime roots when 'bundled plugin staging cannot copy ro…'  1652ms
     ✓ stages live env API-key profiles for isolated QA workers  504ms
     ✓ stages direct live OpenAI API-key aliases for isolated QA workers  351ms
     ✓ stages configured OpenAI API keys for live QA runs  644ms
     ✓ stages configured OpenAI env secret refs for default OpenAI live QA runs  536ms
     ✓ stages configured OpenAI env markers for live QA runs  445ms
     ✓ stages placeholder mock auth profiles per agent dir so mock-openai runs can resolve credentials  320ms

 Test Files  1 passed (1)
      Tests  88 passed (88)
   Start at  20:31:01
   Duration  28.29s (transform 17.14s, setup 767ms, import 19.45s, tests 7.79s, environment 0ms)

[test] passed 1 Vitest shard in 32.78s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126247-C8Lbo9/target$ node scripts/run-vitest.mjs extensions/qa-lab/src/gateway-child.test.ts



























Assertions:

  • FAIL expect_output: lets an explicit packaged command own mock auth state before gateway spawn
  • FAIL expect_output: scrubs inherited shell startup env before the workflow allowlist runs

How this fits together

QA Lab starts an isolated Gateway and, for packaged candidates, invokes the candidate CLI to seed mock credentials. The bootstrap needs shared QA state but must not write the runner-owned Gateway configuration or inherit privileged shell startup behavior.

flowchart LR
  A[QA test runner] --> B[QA child environment]
  B --> C[Packaged auth bootstrap]
  C --> D[Writable bootstrap config]
  C --> E[Shared QA auth state]
  B --> F[Gateway launcher]
  F --> G[Immutable canonical config]
  E --> F
Loading

Before merge

  • Resolve merge risk (P1) - The final head has not been observed in the modified package-backed Telegram release workflow; the supplied package run predates the shell-startup commits.
  • Resolve merge risk (P1) - Production runtime grows by +62/-18 to establish a separate config owner and environment scrubber; the distinct packaged-CLI write boundary explains why no clear net-neutral absorption was found.
  • Complete next step (P2) - The protected maintainer PR has no mechanical repair finding; maintainers should require current-head workflow proof and completed exact-head CI before merge.
Agent review details

Security

None.

PR surface

Source +44, Tests +92, Config +16. Total +152 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 62 18 +44
Tests 2 109 17 +92
Docs 0 0 0 0
Config 1 22 6 +16
Generated 0 0 0 0
Other 0 0 0 0
Total 6 193 41 +152

Review metrics

Metric Value Why it matters
Production versus test LOC plugin runtime +62/-18; workflow +22/-6; tests +109/-17 The added production surface establishes a new config-ownership and child-environment boundary; tests cover both the bootstrap and Bash-import paths.
QA config ownership 1 immutable canonical config retained; 1 writable bootstrap config added The bootstrap exception must remain limited to the auth CLI so the Gateway cannot silently switch to a mutable configuration.

Merge-risk options

Maintainer options:

  1. Require current-head release-workflow proof (recommended)
    Run the package-backed Telegram release workflow on the current head and retain evidence that the bootstrap config is writable while the canonical Gateway config remains immutable.
  2. Accept fixture-only coverage
    Merge based on the focused fixture and Bash-process tests, accepting that the complete privileged launcher path was not rerun after the final hardening commit.

Technical review

Best possible solution:

Before merge, run the modified release Telegram QA path on the current head and show that both bootstrap writes use the SUT-owned config while the Gateway starts from the unchanged canonical config.

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

Yes, source-reproducible: current main's API-key command updates the active config, while the release workflow gives the SUT a runner-owned canonical config; the supplied failed workflow trace corroborates that path.

Is this the best way to solve the issue?

Yes, with an evidence gap: the fix redirects only bootstrap writes to a SUT-owned config, preserves the Gateway config and shared auth store, and should be confirmed in the current-head release workflow.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a4178c7eb15a.

Labels

Label justifications:

  • P2: This is a bounded release-maintainer QA workflow failure rather than a product-runtime outage.
  • merge-risk: 🚨 automation: The PR changes the release Telegram workflow and package-backed QA launch contract.
  • merge-risk: 🚨 security-boundary: The PR changes privileged-launcher environment sanitization and permits one narrowly scoped writable config path.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal QA PR is not subject to the external-contributor proof gate; supplied package evidence is useful but predates the final head.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Merged history includes prior QA child-environment isolation work, and this branch continues that same owner boundary. (role: recent QA child contributor; confidence: high; commits: 83649466fa16, dac4bf581a7a; files: extensions/qa-lab/src/gateway-child.ts, extensions/qa-lab/src/gateway-child-env.ts)
  • steipete: Introduced the retained Gateway port-reservation lifecycle in the same startup path. (role: adjacent lifecycle contributor; confidence: high; commits: 7e353d750abe; files: extensions/qa-lab/src/gateway-child.ts, extensions/qa-lab/src/gateway-port-reservation.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Run the modified package-backed Telegram release workflow on dac4bf5.
  • Wait for exact-head required CI to complete green.

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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-08-19T08:01:27.314Z sha 648bd40 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-20T11:24:47.988Z sha 408ede7 :: needs changes before merge. :: [P1] Sanitize Bash startup variables before launching the wrapper
  • reviewed 2026-08-20T15:59:15.343Z sha 0b3af59 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-20T16:42:00.738Z sha 0b3af59 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-20T19:37:11.531Z sha 9ef352a :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc force-pushed the fix/telegram-qa-auth-bootstrap branch from 648bd40 to 408ede7 Compare August 20, 2026 11:17
@vincentkoc
vincentkoc marked this pull request as ready for review August 20, 2026 11:18
@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 Aug 20, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 20, 2026
Punchcard-Session: frost-orchard-lantern-ze
(cherry picked from commit 648bd40)
@vincentkoc
vincentkoc force-pushed the fix/telegram-qa-auth-bootstrap branch from 0b3af59 to 9ef352a Compare August 20, 2026 19:31
@vincentkoc
vincentkoc merged commit fa71a6f into main Aug 20, 2026
181 checks passed
@vincentkoc
vincentkoc deleted the fix/telegram-qa-auth-bootstrap branch August 20, 2026 22:51
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 21, 2026
* fix(qa): isolate packaged mock auth config

Punchcard-Session: frost-orchard-lantern-ze
(cherry picked from commit 648bd40)

* fix(qa): scrub inherited shell startup env

* fix(qa): block exported Bash functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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