Skip to content

fix(telemetry): gate preamble session tracking#1188

Open
jbetala7 wants to merge 2 commits into
garrytan:mainfrom
jbetala7:oss/fix-1150-telemetry-preamble
Open

fix(telemetry): gate preamble session tracking#1188
jbetala7 wants to merge 2 commits into
garrytan:mainfrom
jbetala7:oss/fix-1150-telemetry-preamble

Conversation

@jbetala7

Copy link
Copy Markdown
Contributor

Fixes #1150

Summary

  • gate preamble session-file tracking, pending-marker handling, and timeline logging behind telemetry != off
  • move spawned-session detection behind a helper so generated SKILL.md files no longer embed the OPENCLAW_SESSION string directly
  • update README wording and add regression tests around telemetry gating and generated skill output

Root cause

The preamble generator still emitted several local tracking side effects unconditionally even though telemetry: off is documented as disabling local analytics, and it embedded the OPENCLAW_SESSION env var name directly into every generated SKILL.md preamble.

Testing

  • bun test test/telemetry.test.ts test/gen-skill-docs.test.ts

jbetala7 and others added 2 commits June 3, 2026 12:13
Session-file tracking (mkdir/touch/find ~/.gstack/sessions), the analytics
pending-marker loop, and timeline-log all ran unconditionally in the preamble
and completion-status resolvers, even with telemetry: off. That contradicts the
documented behavior (telemetry off = no local analytics) and tripped enterprise
security scanners on the OPENCLAW_SESSION string and bare find commands in shell
init.

- Gate session tracking, analytics writes, the pending-finalize loop, and
  timeline-log behind $_TEL != off in both resolvers.
- Extract the OPENCLAW_SESSION check into bin/gstack-spawned-session-status so
  the orchestrator env-var name no longer appears in every generated SKILL.md.
- Leave plan-mode detection untouched (separate concern).
- README: telemetry off now disables local analytics + session artifacts too.
- Tests cover the gating, the helper, and the absent OPENCLAW_SESSION string.

Fixes garrytan#1150

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Regenerated via bun run gen:skill-docs --host all after the preamble/
completion-status resolver change. No hand edits.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jbetala7 jbetala7 force-pushed the oss/fix-1150-telemetry-preamble branch from 76f4c2b to bacd6a4 Compare June 3, 2026 06:43
@jbetala7

jbetala7 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Rebased cleanly onto current main (post #1848) and re-pushed (head bacd6a4d); now MERGEABLE. I also tightened the scope to issue #1150 only:

Verification:

  • bun test test/telemetry.test.ts test/gen-skill-docs.test.ts -> 430 pass / 0 fail
  • bun test test/skill-validation.test.ts -> 329 pass
  • SKILL.md regenerated via gen:skill-docs --host all; extracted preamble passes bash -n; helper verified silent without / emits SPAWNED_SESSION: true with OPENCLAW_SESSION set.

Heads-up on overlap: #1747 proposes echoing the SESSIONS count for CLAUDE.md rules to read. On current main nothing consumes the preamble's _SESSIONS (it's not exported to gstack-telemetry-log, which only runs when telemetry is on), so this gating is safe today. If #1747 lands and makes session count a non-telemetry signal, the two will need a quick reconcile — flagging so they're reviewed together.

garrytan added a commit that referenced this pull request Jun 3, 2026
… 401ing

The report job upserts its E2E summary via the REST /issues/{n}/comments
endpoints (gh api), which GITHUB_TOKEN gates behind the issues permission, not
pull-requests. The job only granted pull-requests:write, so the GET 401'd on
every PR that produced eval artifacts (PRs with no artifacts exit early and never
reach the call, which masked it). Pre-existing; surfaced here because this PR
runs evals. Confirmed identical failure on #1188 and #1621.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session tracking and OPENCLAW_SESSION preamble not gated by telemetry config

1 participant