Skip to content

fix(qqbot): support QQBOT_DATA_DIR environment variable#77274

Closed
Phymath wants to merge 0 commit into
openclaw:mainfrom
Phymath:fix/qqbot-data-dir
Closed

fix(qqbot): support QQBOT_DATA_DIR environment variable#77274
Phymath wants to merge 0 commit into
openclaw:mainfrom
Phymath:fix/qqbot-data-dir

Conversation

@Phymath

@Phymath Phymath commented May 4, 2026

Copy link
Copy Markdown

Summary

Allow users to customize QQBot data directory by setting QQBOT_DATA_DIR environment variable. Falls back to ~/.openclaw/qqbot when not set.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause (if applicable)

For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write N/A. If the cause is unclear, write Unknown.

  • Root cause:
  • Missing detection / guardrail:
  • Contributing context (if known):

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write N/A.

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
  • Scenario the test should lock in:
  • Why this is the smallest reliable guardrail:
  • Existing test that already covers this (if any):
  • If no new test is added, why not:

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Diagram (if applicable)

For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write N/A.

Before:
[user action] -> [old state]

After:
[user action] -> [new state] -> [result]

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: qqbot size: XS labels May 4, 2026
@clawsweeper

clawsweeper Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

Summary
The PR changes QQBot data-path helpers to honor QQBOT_DATA_DIR, adds regression coverage, documents the env var, and records the user-facing fix in the changelog.

Reproducibility: yes. Source inspection gives a high-confidence path: set QQBOT_DATA_DIR, then current-main diagnostics and persistence still call helpers that always resolve under getHomeDir()/.openclaw/qqbot.

Next step before merge
The remaining blockers are narrow and mechanical: rebase the changelog entry onto current main and harden blank env-var parsing.

Security
Cleared: Cleared: the diff adds no dependency, workflow, install script, network, or secret-handling surface; it only reads an operator-provided env var for QQBot storage.

Review findings

  • [P2] Rebase the changelog entry onto current main — CHANGELOG.md:456
  • [P3] Treat blank data-dir overrides as unset — extensions/qqbot/src/engine/utils/platform.ts:41-43
Review details

Best possible solution:

Land a rebased QQBot-owned helper fix with regression tests, docs, and an Unreleased changelog bullet, keeping storage override behavior inside the plugin boundary.

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

Yes. Source inspection gives a high-confidence path: set QQBOT_DATA_DIR, then current-main diagnostics and persistence still call helpers that always resolve under getHomeDir()/.openclaw/qqbot.

Is this the best way to solve the issue?

Yes for the implementation direction, but not for the current merge state. Centralizing the override in the QQBot path helpers is the narrow fix; the branch needs the stale changelog hunk rebased before it can merge.

Full review comments:

  • [P2] Rebase the changelog entry onto current main — CHANGELOG.md:456
    GitHub reports this branch as dirty, and git apply --check fails because the CHANGELOG.md hunk is anchored to older entries. Move the QQBot bullet into the current Unreleased section so the branch can merge.
    Confidence: 0.97
  • [P3] Treat blank data-dir overrides as unset — extensions/qqbot/src/engine/utils/platform.ts:41-43
    The helper checks the raw env var before normalization. With QQBOT_DATA_DIR=' ', normalizePath() returns an empty string and path joining can resolve relative to the process cwd instead of falling back to ~/.openclaw/qqbot.
    Confidence: 0.82

Overall correctness: patch is incorrect
Overall confidence: 0.88

Acceptance criteria:

  • pnpm test extensions/qqbot/src/engine/utils/platform.test.ts
  • pnpm exec oxfmt --check --threads=1 extensions/qqbot/src/engine/utils/platform.ts extensions/qqbot/src/engine/utils/platform.test.ts docs/channels/qqbot.md CHANGELOG.md
  • pnpm check:changed

What I checked:

  • Current main hard-codes QQBot storage: getQQBotDataPath() still joins getHomeDir(), .openclaw, and qqbot, so data-path callers ignore QQBOT_DATA_DIR on current main. (extensions/qqbot/src/engine/utils/platform.ts:42, 89db1e5440f5)
  • Diagnostics advertises the missing override: runDiagnostics() reports dataDir from getQQBotDataDir() and tells Windows users with Chinese characters or spaces in the home path to set QQBOT_DATA_DIR, making the bug source-reproducible. (extensions/qqbot/src/engine/utils/diagnostics.ts:62, 89db1e5440f5)
  • PR implements the intended plugin-owned fix: The PR head adds a QQBot data-base helper that reads process.env.QQBOT_DATA_DIR, routes getQQBotDataPath() and getQQBotDataDir() through it, and adds tests/docs/changelog coverage. (extensions/qqbot/src/engine/utils/platform.ts:39, 5bd4911a16aa)
  • Branch is currently dirty: GitHub reports mergeable_state: dirty, and git apply --check against current main fails on the CHANGELOG.md hunk while the code/docs hunks continue to check. (CHANGELOG.md:456, 5bd4911a16aa)
  • Linked issue has matching reproduction: The linked issue reports Windows QQBot diagnostics still showing the Chinese home-directory path after setting QQBOT_DATA_DIR=D:\qqbot; a prior ClawSweeper comment also kept that issue open as source-reproducible.

Likely related people:

  • steipete: Recent history includes QQBot helper export trimming and adjacent QQBot docs/config hardening around the affected storage and diagnostics surfaces. (role: recent QQBot helper and docs maintainer; confidence: high; commits: a607661a71d8, 0ce0509856d9, c850d1bb0ddf; files: extensions/qqbot/src/engine/utils/platform.ts, extensions/qqbot/src/engine/utils/diagnostics.ts, docs/channels/qqbot.md)
  • vincentkoc: Recent file history shows QQBot platform and docs maintenance, including the platform helper import and channel docs surfaces touched by this PR. (role: recent adjacent maintainer; confidence: medium; commits: 3c8de6eb7243, 85520f664d02, 9ae93179e2ea; files: extensions/qqbot/src/engine/utils/platform.ts, docs/channels/qqbot.md)
  • cxyhhhhh: The affected QQBot engine utility and diagnostics files trace back to the self-contained QQBot engine architecture work. (role: introduced engine architecture; confidence: medium; commits: 5e72e39c1852; files: extensions/qqbot/src/engine/utils/platform.ts, extensions/qqbot/src/engine/utils/diagnostics.ts, extensions/qqbot/src/engine/utils/data-paths.ts)

Remaining risk / open question:

  • The branch is currently dirty against current main because its CHANGELOG.md hunk no longer applies.
  • Targeted QQBot tests were not run in this read-only review, so CI or a repair pass should provide execution proof.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 89db1e5440f5.

@Phymath
Phymath force-pushed the fix/qqbot-data-dir branch from 5d5eac5 to 2fedd40 Compare May 4, 2026 12:12
@Phymath
Phymath force-pushed the fix/qqbot-data-dir branch from 2fedd40 to 5bd4911 Compare May 4, 2026 14:08
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 6, 2026
@Phymath Phymath closed this May 6, 2026
@Phymath
Phymath force-pushed the fix/qqbot-data-dir branch from 41cf599 to c73f774 Compare May 6, 2026 03:12
@openclaw-barnacle openclaw-barnacle Bot added size: XS and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. size: S labels May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: qqbot docs Improvements or additions to documentation size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:路径错误

1 participant