Absolutize ResolverScenario root, drop its Dir.chdir, retire stay_serial! on resolver_test #502
Labels
No labels
P0
P1
P2
P3
bug
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#502
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
3f9c4a7removed 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).
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).
Folded in per user 2026-08-24: also drop the stay_serial! on TeaTrackerFetchBodyTest (tea_tracker_test.rb:172), made likely-redundant by the
3f9c4a7chdir fix.Work started on branch worktree-ticket-502 via /os-sdlc:implement (session ccd9c3d0, started 2026-08-24T17:51:29-04:00).
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).
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
7e526f8and1974facon 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
1974facinstead.