Skip to content

Fix state handling, harden shared scripts, make branch flow dynamic (2.1.1)#2

Open
Cofy-ME wants to merge 2 commits into
PiLastDigit:masterfrom
Cofy-ME:fix/state-handling-dynamic-branching
Open

Fix state handling, harden shared scripts, make branch flow dynamic (2.1.1)#2
Cofy-ME wants to merge 2 commits into
PiLastDigit:masterfrom
Cofy-ME:fix/state-handling-dynamic-branching

Conversation

@Cofy-ME

@Cofy-ME Cofy-ME commented Jul 15, 2026

Copy link
Copy Markdown

Summary

Robustness fixes for the shared Codex scripts plus two workflow improvements, found while reviewing and exercising the skills. Includes a proposed 2.1.1 version bump and a backfilled CHANGELOG.md — feel free to drop that commit if you prefer to handle versioning yourself.

Bug fixes

  • STATE_DIR export footgun: codex-implement, codex-code-review, and codex-ask relied on export STATE_DIR=... before calling the shared scripts, but agent harnesses run each command in a fresh shell. A forgotten export made resume.sh silently resume the plan-review thread for the same plan path — reviewer model, read-only sandbox, implement prompt. Each skill now ships tiny wrapper scripts (start/resume/reset/show) that pin their own STATE_DIR and delegate; all SKILL.md docs call the wrappers and the export choreography is gone. codex-implement/start.sh also pins unconditionally now.
  • State-key mismatch for free-form labels: TRIP-3-release re-derived the review state key inline with an unconditional realpath, which disagrees with target_key() for non-path targets (unplanned-work labels) — a converged Codex review got silently treated as "skipped". New key.sh exposes the shared derivation and TRIP-3 uses it.
  • load_prompt corruption and hang: the awk -v/gsub substitution mangled values containing & or backslashes (implementer notes like "Fixed X & Y" injected the literal placeholder text), and could loop forever if a value quoted its own placeholder. Rewritten with ENVIRON + literal splice.
  • Missing state/.gitignore for codex-implement and codex-askgit add -A during release committed thread IDs, reports, and event logs.
  • Stale v1 references: week-formula location, synthesize template's version-step pointer, tutorial step renumbering list (was incomplete and inconsistent).

Workflow changes

  • Dynamic base branch: TRIP-2/TRIP-3/TRIP-hotfix now work from any active branch. The base is recorded at branch creation (branch.<name>.trip-base git config) and release/hotfix merge back into it — no more [MAIN_BRANCH] placeholder. Verified end-to-end in a scratch repo, including git auto-removing the config entry on branch -d.
  • Explicit push: release and hotfix now list available branches and ask which to push (base branch recommended) unless one was specified, and push origin <branch> explicitly instead of a bare git push. Hotfix also enforces --ff-only like release.

Tests

tests/workflow-regression.sh covers the script-level fixes: literal-safe substitution, self-referencing placeholder termination (under timeout), shared key derivation for labels, wrapper state isolation (run against a sandboxed copy of the tree), and state .gitignore presence.

Docs: README requirements note (Bash, Codex CLI, jq, GNU coreutils), unified ARCHI token thresholds, typo fixes.

🤖 Generated with Claude Code

Cofy-ME and others added 2 commits July 15, 2026 12:02
- Add per-skill wrapper scripts (start/resume/reset/show) for
  codex-implement, codex-code-review, and codex-ask so STATE_DIR is
  pinned by the script itself instead of shell-export choreography
- Add key.sh and use it in TRIP-3-release to reuse the shared
  target_key derivation (fixes wrong state lookup for free-form labels)
- Rewrite load_prompt substitution: literal-safe (&, backslashes) and
  terminating when a value quotes its own placeholder
- Add missing state/.gitignore for codex-implement and codex-ask
- Make TRIP-2/TRIP-3/TRIP-hotfix base-branch agnostic via a
  branch.<name>.trip-base config entry recorded at branch creation
- Ask which branch to push (listing available branches) in
  TRIP-3-release and TRIP-hotfix unless one was specified
- Fix stale v1 references (week formula location, synthesize version
  step, tutorial step renumbering), unify ARCHI token thresholds,
  add requirements note and typo fixes in README
- Add tests/workflow-regression.sh covering the script-level fixes

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 15, 2026 12:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants