Absolutize ResolverScenario root, drop its Dir.chdir, retire stay_serial! on resolver_test #502

Closed
opened 2026-08-24 21:45:02 +00:00 by jared · 4 comments
Owner

Context

tests/support/resolver_scenario.rb:44 wraps resolution in Dir.chdir(@dir) {
OsSdlc::Evidence::Resolver.new(@root).resolve(...) } because the scenario
passes a relative root: "." (lines 20/24/28/33) and Resolver never
absolutizes @root (resolver.rb:35-37 stores it as given; resolver.rb:79/82
File.join onto it; resolver.rb:100-102/177-179 pass it to ast-grep
explicitly). The chdir is process-global, so resolver_test.rb:6 carries
stay_serial!, which drains the whole parallel executor per test
(test_helper.rb:97-114). This is a serialization cost, not a correctness bug
today; the correctness bug from the same investigation (tea_tracker.rb:67)
is fixed separately.

Tasks

[ ] Change ResolverScenario#resolve to Resolver.new(File.expand_path(@root,
@dir)).resolve(*Array(tokens)) and drop the Dir.chdir wrapper.
[ ] Check the risk: resolver output may embed paths that tests assert as
relative; absolutizing the root may change emitted path forms — adjust tests
only if assertions prove path-form-sensitive.
[ ] Remove stay_serial! from tests/evidence/resolver_test.rb:6.

  • Also remove stay_serial! from TeaTrackerFetchBodyTest (tests/runner/tea_tracker_test.rb:172) — likely redundant since commit 3f9c4a7 removed the last process-wide Dir.chdir from lib/; verify with repeated parallel runs before dropping.

Acceptance criteria

[ ] No Dir.chdir remains in tests/support/resolver_scenario.rb.
[ ] Resolver tests green under the parallel executor.
[ ] 10 consecutive full parallel suite runs green (minus the 4 pre-existing
ChangeInterpreterAgentTest baseline failures).

  • TeaTrackerFetchBodyTest runs under the parallel executor with no ENOENT recurrence.

Origin

• Trigger: 2026-08-24 chdir-race investigation after a transient ~96-failure
ENOENT run of ruby tests/all.rb.
• Improvised this session: none (root cause tea_tracker.rb:67 fixed in its
own commit; this shard deferred).
• Chain: whole-executor drain per resolver test ← stay_serial! guard on
resolver_test.rb:6 ← process-global Dir.chdir in resolver_scenario.rb:44 ←
relative root: "." never absolutized by Resolver ← DESIGN
(tests/support/resolver_scenario.rb; #488 thread-safety audit chose
stay_serial! as the guard).
• Root candidate: this ticket.

User-approved capture 2026-08-24 (skeptic gate not required). Change-
interpreter reviewed the shard plan this session; the resolver-root
precondition is pinned (relative root confirmed).

## Context tests/support/resolver_scenario.rb:44 wraps resolution in Dir.chdir(@dir) { OsSdlc::Evidence::Resolver.new(@root).resolve(...) } because the scenario passes a relative root: "." (lines 20/24/28/33) and Resolver never absolutizes @root (resolver.rb:35-37 stores it as given; resolver.rb:79/82 File.join onto it; resolver.rb:100-102/177-179 pass it to ast-grep explicitly). The chdir is process-global, so resolver_test.rb:6 carries stay_serial!, which drains the whole parallel executor per test (test_helper.rb:97-114). This is a serialization cost, not a correctness bug today; the correctness bug from the same investigation (tea_tracker.rb:67) is fixed separately. ## Tasks [ ] Change ResolverScenario#resolve to Resolver.new(File.expand_path(@root, @dir)).resolve(*Array(tokens)) and drop the Dir.chdir wrapper. [ ] Check the risk: resolver output may embed paths that tests assert as relative; absolutizing the root may change emitted path forms — adjust tests only if assertions prove path-form-sensitive. [ ] Remove stay_serial! from tests/evidence/resolver_test.rb:6. - [ ] Also remove stay_serial! from TeaTrackerFetchBodyTest (tests/runner/tea_tracker_test.rb:172) — likely redundant since commit 3f9c4a7 removed the last process-wide Dir.chdir from lib/; verify with repeated parallel runs before dropping. ## Acceptance criteria [ ] No Dir.chdir remains in tests/support/resolver_scenario.rb. [ ] Resolver tests green under the parallel executor. [ ] 10 consecutive full parallel suite runs green (minus the 4 pre-existing ChangeInterpreterAgentTest baseline failures). - [ ] TeaTrackerFetchBodyTest runs under the parallel executor with no ENOENT recurrence. ## Origin • Trigger: 2026-08-24 chdir-race investigation after a transient ~96-failure ENOENT run of ruby tests/all.rb. • Improvised this session: none (root cause tea_tracker.rb:67 fixed in its own commit; this shard deferred). • Chain: whole-executor drain per resolver test ← stay_serial! guard on resolver_test.rb:6 ← process-global Dir.chdir in resolver_scenario.rb:44 ← relative root: "." never absolutized by Resolver ← DESIGN (tests/support/resolver_scenario.rb; #488 thread-safety audit chose stay_serial! as the guard). • Root candidate: this ticket. User-approved capture 2026-08-24 (skeptic gate not required). Change- interpreter reviewed the shard plan this session; the resolver-root precondition is pinned (relative root confirmed).
Author
Owner

Folded in per user 2026-08-24: also drop the stay_serial! on TeaTrackerFetchBodyTest (tea_tracker_test.rb:172), made likely-redundant by the 3f9c4a7 chdir fix.

Folded in per user 2026-08-24: also drop the stay_serial! on TeaTrackerFetchBodyTest (tea_tracker_test.rb:172), made likely-redundant by the 3f9c4a7 chdir fix.
Author
Owner

Work started on branch worktree-ticket-502 via /os-sdlc:implement (session ccd9c3d0, started 2026-08-24T17:51:29-04:00).

Work started on branch worktree-ticket-502 via /os-sdlc:implement (session ccd9c3d0, started 2026-08-24T17:51:29-04:00).
Author
Owner

BLOCKED: os-sdlc implementation_failed at node programmer-repair, reason bound_exhausted:programmer-repair/fail (repair retry budget exhausted). Gate details: last two gate runs landed on the 4 pre-existing ChangeInterpreterAgentTest baseline failures; the gate classifies them as red. Additional anomaly: dispatch 14's SubagentStart handoff and gate history referenced the resolver Dir.chdir shard, not this ticket's session/subagent time-tracking work — suspected pipeline.db state cross-talk between the worktree implementation and prior main-checkout state. Branch: worktree-ticket-502 (kept).

BLOCKED: os-sdlc implementation_failed at node programmer-repair, reason bound_exhausted:programmer-repair/fail (repair retry budget exhausted). Gate details: last two gate runs landed on the 4 pre-existing ChangeInterpreterAgentTest baseline failures; the gate classifies them as red. Additional anomaly: dispatch 14's SubagentStart handoff and gate history referenced the resolver Dir.chdir shard, not this ticket's session/subagent time-tracking work — suspected pipeline.db state cross-talk between the worktree implementation and prior main-checkout state. Branch: worktree-ticket-502 (kept).
Author
Owner

Resolution

Done: ResolverScenario#resolve now passes an absolute root (File.expand_path(@root, @dir)) with no Dir.chdir wrapper; Resolver joins @root onto ast-grep paths and spawns with chdir: @root; stay_serial! removed from ResolverTest and TeaTrackerFetchBodyTest. Root-caused and fixed the getcwd cascade: overlapping block-form Dir.chdir on parallel workers (rubocop ConfigLoader) corrupted cwd restores — test_helper now serializes Dir.chdir behind a reentrant Monitor and ChdirGuard uses a thread-local flag.

Evidence: Commits 7e526f8 and 1974fac on branch worktree-ticket-502. 10 consecutive ruby tests/all.rb runs each ended '1082 runs, 2792 assertions, 4 failures, 0 errors' — exactly the pre-existing ChangeInterpreterAgentTest baseline; plus 3 more green runs after the residual cleanups. No Dir.chdir remains in tests/support/resolver_scenario.rb.

Follow-ups: #503 (skeptic verdict CREATE): harden stay_serial! executor shutdown/start cycle — observed 1 fatal deadlock hang in 22 runs. A second candidate (bundling resolver chdir hardening + tmpdir leak) got skeptic verdict DROP and was applied directly in 1974fac instead.

## Resolution **Done:** ResolverScenario#resolve now passes an absolute root (File.expand_path(@root, @dir)) with no Dir.chdir wrapper; Resolver joins @root onto ast-grep paths and spawns with chdir: @root; stay_serial! removed from ResolverTest and TeaTrackerFetchBodyTest. Root-caused and fixed the getcwd cascade: overlapping block-form Dir.chdir on parallel workers (rubocop ConfigLoader) corrupted cwd restores — test_helper now serializes Dir.chdir behind a reentrant Monitor and ChdirGuard uses a thread-local flag. **Evidence:** Commits 7e526f8 and 1974fac on branch worktree-ticket-502. 10 consecutive ruby tests/all.rb runs each ended '1082 runs, 2792 assertions, 4 failures, 0 errors' — exactly the pre-existing ChangeInterpreterAgentTest baseline; plus 3 more green runs after the residual cleanups. No Dir.chdir remains in tests/support/resolver_scenario.rb. **Follow-ups:** #503 (skeptic verdict CREATE): harden stay_serial! executor shutdown/start cycle — observed 1 fatal deadlock hang in 22 runs. A second candidate (bundling resolver chdir hardening + tmpdir leak) got skeptic verdict DROP and was applied directly in 1974fac instead.
jared closed this issue 2026-08-25 01:02:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#502
No description provided.