Skip to content

Session tracking and OPENCLAW_SESSION preamble not gated by telemetry config #1150

Closed

Description

@hui-zheng

Problem

Enterprise security scanners flag gstack installations due to strings in every generated SKILL.md preamble:

mkdir -p ~/.gstack/sessions
touch ~/.gstack/sessions/"$PPID"
_SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f 2>/dev/null | wc -l | tr -d ' ')
find ~/.gstack/sessions -mmin +120 -type f -exec rm {} + 2>/dev/null || true
[ -n "$OPENCLAW_SESSION" ] && echo "SPAWNED_SESSION: true" || true

These run regardless of the telemetry: off config setting. The telemetry config only gates remote data sending and local JSONL analytics, but session file creation, session cleanup via find, and the OPENCLAW_SESSION env var check are unconditional in the preamble.

At my company, a custom security rule monitoring for OpenClaw strings and suspicious find commands in shell initialization scripts triggered an alert, requiring investigation and remediation.

Current behavior

  • scripts/resolvers/preamble.ts embeds session tracking and OPENCLAW_SESSION detection into every SKILL.md
  • Setting telemetry: off in ~/.gstack/config.yaml does not disable these
  • 765+ references across all generated SKILL.md files (every host variant × every skill)

Suggested improvement

  1. Gate session tracking behind telemetry config — wrap mkdir/touch/find for ~/.gstack/sessions/ in the same _TEL != "off" guard used for analytics
  2. Gate OPENCLAW_SESSION detection behind a config flag — or remove it from the preamble entirely since it's only relevant when running inside OpenClaw
  3. Document what telemetry: off actually disables — current config comments imply it controls all data collection, but session files are still created on disk

This would let enterprise users set telemetry: off and have confidence that no session tracking artifacts are created on disk.

Workaround

Manually strip the patterns from all generated SKILL.md files after installation. This works but gets overwritten on gstack-upgrade.

Activity

  1. hui-zheng commented on Apr 22, 2026

    @hui-zheng
    Author

    Note: After filing this, I found these closely related existing issues:

    This issue is essentially a real-world enterprise case of what #467 predicted — security tooling flagging the find ~/.gstack/sessions and OPENCLAW_SESSION patterns. Happy to close as duplicate if maintainers prefer to track under #467 or #1080.

  2. hui-zheng commented on Apr 22, 2026

    @hui-zheng
    Author

    Closing as duplicate of #467 and #1080 which already track these concerns. This issue adds a real-world enterprise scanner trigger as additional evidence — see the cross-references above.

  3. hui-zheng commented on Apr 22, 2026

    @hui-zheng
    Author

    Reopening — after checking upstream main, the session tracking and OPENCLAW_SESSION patterns are still present and ungated in scripts/resolvers/preamble/generate-preamble-bash.ts:

    mkdir -p ~/.gstack/sessions
    touch ~/.gstack/sessions/"$PPID"
    _SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f 2>/dev/null | wc -l | tr -d ' ')
    find ~/.gstack/sessions -mmin +120 -type f -exec rm {} + 2>/dev/null || true

    And in generate-spawned-session-check.ts:

    [ -n "$OPENCLAW_SESSION" ] && echo "SPAWNED_SESSION: true" || true

    #467 was closed as "partially addressed" — local JSONL writes were gated, but session file creation and OPENCLAW_SESSION detection were not. These are the specific patterns that trigger enterprise security scanners.

    What's still needed:

    1. Gate mkdir/touch/find for ~/.gstack/sessions/ behind _TEL != "off" (or a separate session_tracking config flag)
    2. Gate or remove OPENCLAW_SESSION env var check from the default preamble
    3. Gate gstack-timeline-log behind telemetry config

    These are distinct from #1080 (local JSONL) and #1081 (update-check network calls) — this is about on-disk session file artifacts and string patterns that security tooling flags.

  4. jbetala7 commented on Apr 24, 2026

    @jbetala7
    Contributor

    Opened PR #1188 to address the ungated preamble tracking and direct OPENCLAW_SESSION preamble string: #1188

  5. added a commit that references this issue on Jun 3, 2026
    4b110b0
  6. time-attack commented on Jul 15, 2026

    @time-attack
    Contributor

    @hui-zheng The distinction between telemetry and functional session or timeline state remains unresolved and must be defined before changing persistence when telemetry is off.

  7. capy-ai commented on Oct 11, 2026

    @capy-ai
    Contributor

    Fixed in v1.91.92.0 (3b7254a, #3144). The README's Privacy & Telemetry section and the telemetry consent text now match what gstack does: the update check's network call, what telemetry sends, the session tracking that isn't gated, and outside-review egress (on by default, with a first-send notice and codex_reviews to turn it off). Thanks for flagging the gap.

  8. capy-ai commented on Oct 11, 2026

    @capy-ai
    Contributor

    A correction to my close note, to be precise about what changed. #3144 fixed the disclosure, not the behavior. The README now documents session markers and the timeline as local-only state, which never leaves the machine. They still run when telemetry is off, because they power local features. If you'd like them gated behind the telemetry setting as well, reopen this and we'll treat that as a behavior change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions