Problem
The SegmentScopeMode (FULL_TASK vs SEGMENT_SCOPED) is currently computed in lane-runner and injected into the worker prompt as text. But other segment-related signals are not gated by it:
-
TASKPLANE_ACTIVE_SEGMENT_ID env var is set whenever a segmentId exists, regardless of scope mode. In FULL_TASK mode, this leaks segment context cues to the worker environment.
-
request_segment_expansion tool registration is keyed off the env var, not the scope mode. Workers in FULL_TASK mode technically have access to segment expansion tools they should not need.
-
Execution behavior (step filtering, progress counting, exit conditions) branches on stepSegmentMap && currentRepoId && repoStepNumbers — the same conditions that compute isSegmentScoped — but does not reference a single authoritative mode value. This could drift if conditions are updated in one place but not another.
Proposed Fix
- Compute
isSegmentScoped once and store it on the execution unit or lane config
- Gate
TASKPLANE_ACTIVE_SEGMENT_ID env var behind segment-scoped mode
- Gate
request_segment_expansion tool availability behind segment-scoped mode
- Replace scattered
stepSegmentMap && currentRepoId checks with isSegmentScoped references
Priority
Low — the prompt-level fix (SegmentScopeMode flag) is the authoritative signal for worker behavior. These are defense-in-depth improvements to prevent future drift.
Files
extensions/taskplane/lane-runner.ts — scope mode computation and env var setup
extensions/taskplane/execution.ts — tool registration and segment env vars
References
- Sage review of TP-501 fix (v4 spec session)
Problem
The
SegmentScopeMode(FULL_TASK vs SEGMENT_SCOPED) is currently computed in lane-runner and injected into the worker prompt as text. But other segment-related signals are not gated by it:TASKPLANE_ACTIVE_SEGMENT_IDenv var is set whenever asegmentIdexists, regardless of scope mode. In FULL_TASK mode, this leaks segment context cues to the worker environment.request_segment_expansiontool registration is keyed off the env var, not the scope mode. Workers in FULL_TASK mode technically have access to segment expansion tools they should not need.Execution behavior (step filtering, progress counting, exit conditions) branches on
stepSegmentMap && currentRepoId && repoStepNumbers— the same conditions that computeisSegmentScoped— but does not reference a single authoritative mode value. This could drift if conditions are updated in one place but not another.Proposed Fix
isSegmentScopedonce and store it on the execution unit or lane configTASKPLANE_ACTIVE_SEGMENT_IDenv var behind segment-scoped moderequest_segment_expansiontool availability behind segment-scoped modestepSegmentMap && currentRepoIdchecks withisSegmentScopedreferencesPriority
Low — the prompt-level fix (SegmentScopeMode flag) is the authoritative signal for worker behavior. These are defense-in-depth improvements to prevent future drift.
Files
extensions/taskplane/lane-runner.ts— scope mode computation and env var setupextensions/taskplane/execution.ts— tool registration and segment env varsReferences