Repository navigation
Conversation
session-start-hook.sh set _REMEMBER_PHASE=deferred at three deferred-fork sites (before_session_start dispatch, _remember_deferred_phase, the start-cache publish) but never exported it, so the assignment stayed inside the subshell that made it and no child process -- a hooks.d/ listener, the recovery save-session.sh fork -- could ever observe it. That defeated the label's own stated purpose: telling a deferred child from a command substitution by pid alone needs the child's own environment. Adds tests/test_remember_phase_export_700.py, pinning the before_session_start dispatch site end to end via a full plugin copy and a stub hooks.d listener (red before the fix, green after -- confirmed by stashing scripts/session-start-hook.sh and re-running). The other two sites get the identical mechanical fix, verified by reading rather than a separate end-to-end harness. Co-Authored-By: Max <noreply>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #700.
scripts/session-start-hook.shassigned_REMEMBER_PHASE=deferredat three deferred-forksites but never exported it, so no child process forked from any of those subshells could ever
observe it -- defeating the stated purpose in the comment on
_remember_deferred_phase: "atrace cannot tell a deferred child from a command substitution by pid alone."
The issue offered three honest fixes (delete, export, or log at transitions) and called picking
between them "a design call." This PR picks export, because it is literally what the
existing comment already says it wants, and is the smallest, most mechanical fix of the three.
What changed
All three sites get the identical fix in kind:
scripts/session-start-hook.sh:419(before_session_start deferred dispatch subshell):_REMEMBER_PHASE=deferred->export _REMEMBER_PHASE=deferredscripts/session-start-hook.sh:940(_remember_deferred_phase(), waslocal):local _REMEMBER_PHASE=deferred->local -x _REMEMBER_PHASE=deferredscripts/session-start-hook.sh:1955(deferred start-cache-context publish subshell):_REMEMBER_PHASE=deferred->export _REMEMBER_PHASE=deferredEach site got an inline comment citing #700.
Tests
Added
tests/test_remember_phase_export_700.py, an end-to-end test of site 1 (thebefore_session_start dispatch) using a full plugin copy and a stub
hooks.d/before_session_start/listener that dumps whether
_REMEMBER_PHASEreached its own environment. Sites 2 and 3 got theidentical mechanical fix, verified by reading rather than a separate end-to-end harness --
building recovery-fork and cache-publish fixtures was judged not worth it for a low-severity,
no-behavior-change issue.
RED (stashing the fix, rerunning):
GREEN (unstashing, rerunning):
1 passed in 0.58s.Narrowed regression check:
tests/test_dispatch_timeout_286.py,tests/test_git_restore_hook_253.py,tests/test_git_restore_no_resource_when_disabled_663.py,tests/test_capture_gap_notice.py,tests/test_hook_stdout_labelling_280.py-- 74 passed. Full suite was not run locally, perthis repo's CI-is-source-of-truth policy.
Docs / changelog
No README.md change needed -- this is a purely internal tracing detail with no user-facing
mention before or after.
changelog.d/700.fixed.mdadded, naming #700.Review
Two concurrent reviewers (Explore, oss:auditor) spawned against the commit, both told not to
mutate the tree; both returned NO FINDINGS. One below-bar note from the auditor, not corrected
post-hoc: the new test module's own docstring says "left at its shipped default (false, per
config.example.json)" when in fact the fixture's
config_intodefault parameter supplies thefalse value, not a read of config.example.json -- a minor imprecision in the test's own prose,
not in the production fix, and it does not affect the test's correctness.
Adjacent (not filed, not fixed, out of scope for #700)
(
_REMEMBER_LAZY_PYTHON,_REMEMBER_CTX_FILE/_REMEMBER_CTX_OK,_REMEMBER_HOOK_ELAPSED_S)-- not verified as defects, not traced further, out of scope since _REMEMBER_PHASE is write-only: nothing reads it, and it is not exported #700 names only
_REMEMBER_PHASE.(
nohup run-consolidation.sh ... & disown, ~line 2038) that sets no_REMEMBER_PHASEatall -- a pre-existing, unrelated gap, not a regression, and a different question than _REMEMBER_PHASE is write-only: nothing reads it, and it is not exported #700
asked.
[AI-generated]