Skip to content

Add vendor-neutral GSTACK_SPAWNED_SESSION marker for spawned mode - #2381

Open
harikanthl wants to merge 1 commit into
garrytan:mainfrom
harikanthl:spawned-session-generic-marker
Open

Add vendor-neutral GSTACK_SPAWNED_SESSION marker for spawned mode#2381
harikanthl wants to merge 1 commit into
garrytan:mainfrom
harikanthl:spawned-session-generic-marker

Conversation

@harikanthl

Copy link
Copy Markdown

What

Adds GSTACK_SPAWNED_SESSION as a vendor-neutral way to opt a session into gstack's spawned/autonomous mode (auto-choose the recommended option, no AskUserQuestion, end with a completion report).

Why

Today spawned mode is reachable only via OPENCLAW_SESSION. Any AI orchestrator that runs gstack headlessly — e.g. a harness spawning claude -p workers — needs the exact same behavior, because gstack-session-kind otherwise classifies those sessions as interactive (the degrade-safe default) and the skills stall at the first AskUserQuestion gate with no human to answer. Setting another tool's env var (OPENCLAW_SESSION) to get there is a semantic hack.

Change

Recognized in the same two places as OPENCLAW_SESSION, mirroring the existing pattern:

  • bin/gstack-session-kind — top-precedence spawned signal, alongside OPENCLAW_SESSION.
  • scripts/resolvers/preamble/generate-preamble-bash.ts — emits SPAWNED_SESSION: true when either marker is set.
  • scripts/resolvers/preamble/generate-spawned-session-check.ts — docs the new knob in the spawned-session prose.

OPENCLAW_SESSION behavior is unchanged. Regenerated the SKILL.md docs so the freshness check passes.

Testing

  • bun test test/gstack-session-kind.test.ts — added a case for GSTACK_SPAWNED_SESSION → spawned (incl. top-precedence over headless/host markers). 10/10 pass.
  • bun test test/auq-error-fallback-hook.test.ts — 13/13 pass (unchanged).

…ed mode

Spawned/autonomous mode (auto-choose, no AskUserQuestion, completion report)
was reachable only via OPENCLAW_SESSION. Any orchestrator that runs gstack
headlessly (e.g. `claude -p` workers) needs the same behavior, but setting
another tool's env var is a semantic hack.

Add GSTACK_SPAWNED_SESSION as a vendor-neutral opt-in, recognized in the same
two places as OPENCLAW_SESSION:
- bin/gstack-session-kind: top-precedence spawned signal (alongside OPENCLAW).
- preamble emission: SPAWNED_SESSION: true when either marker is set.

OPENCLAW_SESSION keeps working unchanged. Adds a session-kind test; regenerates
SKILL.md docs (freshness check).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Jul 29, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

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.

1 participant