Repository navigation
feat(#497): sequant init --agent codex — .agents/skills symlink, .codex hooks wrapper, doctor, README - #1066
Merged
admarble merged 9 commits intoSep 16, 2026
Conversation
added 5 commits
September 15, 2026 17:45
codex provisioning (symlink+config.toml), doctor checks, README, tests Entire-Checkpoint: 424c8f4691d1
…atibility Entire-Checkpoint: e07a3d10c2f6
…solution Entire-Checkpoint: afea034e57cf
QA on #1059 found `writeCodexSkillsSymlink(dir, true)` throws EEXIST on a real directory at .agents/skills: removeFileOrSymlink is a bare unlink. The throw aborts init before .codex/config.toml is written. Treat a directory as skipped-foreign — recursively deleting a directory the user created is not a cost --force should imply — and report an idempotent re-run as the no-op it is rather than claiming it symlinked anything.
8 tasks
added 4 commits
September 15, 2026 20:24
…at init
AC-8 requires the codex dry run to print $spec 1; the path emitted the Claude
Code prose template (Run the /spec 1 workflow.), which codex never resolves —
so the .agents/skills symlink this issue adds was never exercised. The probe
settled the fix at the driver layer rather than as per-phase driverOverrides
("Prompt is $<phase> <issue> — the skill name, not a rewritten prompt"), so
AgentDriver gains an optional buildSkillPrompt; CodexDriver returns $<skill>
<issue> and AGENTS.md is not prepended to it (codex reads AGENTS.md itself).
The dry run now prints the invocation in the driver's own syntax instead of a
hard-coded slash form, unconditionally — which backend runs what is part of the
plan, the same reasoning as #862 AC-3.
init --agent <name> now persists run.agent, so doctor runs that driver's checks
after the documented setup path; the README's claim that doctor checks codex
auth was previously true only if the user hand-edited settings.json.
The first cut of buildSkillPrompt called getDriver(agent) bare inside getPhasePrompt, which broke two contracts the suite already pinned: #862 AC-3 (a dry run with an unknown driver still prints a plan — getDriver throws on an unknown name) and #863 (every getDriver call on a phase path carries the configured driver settings). The lookup now takes DriverOptions from the execution config and swallows construction failures, leaving the real error to the execution path that follows.
…ng success QA round 3: createSymlink returns false on EPERM/EACCES rather than throwing (the Windows-without-privileges case copyTemplates answers with a copy fallback), and writeCodexSkillsSymlink discarded it — init would print 'Symlinked .agents/skills -> ../.claude/skills' with no symlink on disk and codex skill discovery would fail silently. A copy fallback is not available here: a copied skill tree goes stale the moment .claude/skills changes. New 'unsupported' status, a warning that names the Windows cause, and the Windows limitation noted in the README and the JSDoc, as the issue's Non-goals ask. Also pins the F4 settings fix (init forwards --agent; generateSettingsJsonc emits run.agent) and restores resolveDriverName's JSDoc, which the previous commit left attached to the wrong function.
admarble
deleted the
feature/1059-feat-497-sequant-init-agent-codex-agents-skills-sy
branch
September 16, 2026 05:27
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.
Summary
sequant init --agent codexprovisions a relative.agents/skills -> ../.claude/skillssymlink and a.codex/config.tomlhooks wrapper (fromtemplates/codex/config.toml) pointing at the existing, unmodified.claude/hooks/pre-tool.sh/post-tool.sh.doctorgains a codex block mirroring the opencode block: binary check,CODEX_MIN_VERSIONfloor (imported fromsrc/lib/workflow/drivers/codex.ts, not redefined), and auth check (CODEX_API_KEYorcodex login status).--dangerously-bypass-hook-trustis safe here) and both init output and README state the exacttrust_level = "trusted"TOML needed for project-layer hooks to load.sequant update/sync preserve the symlink in both symlink and copy modes.$spec 1— not the Claude Code prose template, via a new optionalAgentDriver.buildSkillPrompt.run 1 --agent codex --dry-runprints it, andinit --agent <name>persistsrun.agentsodoctorruns that driver's checks.AC Verification
.agents/skillsrelative symlink, idempotentsrc/commands/init.codex.integration.test.ts.codex/config.tomlhooks wrapper from one template;.claude/hooks/*.shunchangedsrc/commands/init.codex.integration.test.ts,templates/codex/config.toml__tests__/pre-tool-hook.integration.test.ts(497 AC-3)CODEX_MIN_VERSION, authsrc/commands/doctor.test.tstrust_level = "trusted"TOMLsrc/commands/init.test.tssequant updatepreserves symlink (symlink + copy modes)src/commands/init.codex.integration.test.tsREADME.mdrun 1 --agent codex --dry-runresolves driver, prints$spec 1src/commands/cli.integration.test.ts(AC's exact command, no--verbose),src/lib/workflow/phase-executor.test.tsMutation-verified gate tests
Re-recorded after QA on #1059 rejected the first AC-3 record: it named no test file (the repo's own
classifyMutationMarkersplitsfailedTeston>and returnedtest_not_in_diff), and it mutated the shared.claude/hooks/pre-tool.shguard rather than the codex fixture the gate actually asserts — which ~30 pre-existing force-push tests already cover. AC-5 had no record at all. Each mutation below started from a clean tree (git status --short | wc -l= 0) and was restored to a clean tree afterwards.Mutation-verified: AC-1 — deleted the
isDirectory()guard inwriteCodexSkillsSymlink;src/commands/init.codex.integration.test.ts > AC-1: --force replaces a stray file but never a real directoryfailed (EEXIST from the bare unlink), 7 other tests in the file still passed; restored.Mutation-verified: AC-3 — dropped
tool_input.commandfrom the recorded codex payload fixture (tool_input: { command }→tool_input: {}), so the envelope no longer carries the command where the hook reads it;__tests__/pre-tool-hook.integration.test.ts > 497 AC-3: blocks git push --force via the codex PreToolUse payload shape (exit 2, HOOK_BLOCKED)failed (exit 0, expected 2) across all threeHOOK_COPIESparameterizations, 3 failed / 3 passed within the AC-3 block and nothing outside it; restored, 6 passed.Mutation-verified: AC-5 — removed the
CODEX_TRUST_LEVEL_TOMLline from init's completion notice; exactlysrc/commands/init.test.ts > prints the exact trust_level TOML requirement when --agent codexfailed (1 failed, 1 passed in the AC-5 block); restored.Mutation-verified: AC-8 — reverted
CodexDriver.buildSkillPromptto the Claude Code slash form (/${skill} ${issue}); exactly the three AC-8 tests failed —src/lib/workflow/phase-executor.test.ts > 1059 AC-8 sends codex the$invocation, not the prose template, its AGENTS.md sibling, and thecli.integration.test.tsdry-run case; restored, suite green.QA round 2 — AC-8 fixed at the driver layer
QA round 2 blocked on AC-8: the codex path emitted
Run the /spec 1 workflow.(the registry's Claude-shaped prose template) and nothing ever emitted$spec 1, so the.agents/skillssymlink this issue exists to create was never exercised. The probe rules out the obvious shape — "DropCODEX_PHASE_PROMPTS/driverOverrides.codex" — because the invocation is one syntax rule for every phase, not eight rewritten prompts. So:AgentDrivergains an optionalbuildSkillPrompt(skill, issue);CodexDriverreturns`$${skill} ${issue}`. Drivers that leave it undefined keep today's template./${phase} ${issue}that described a command codex would never run. Same reasoning as feat: add opencode agent driver — first backend that can inherit the full skill methodology #862 AC-3 for the driver name.--verbose) and asserts$spec 1, plusnot.toContain("/spec 1").The first cut of this broke two contracts the suite already pinned — #862 AC-3 (
getDriverthrows on an unknown name, and a dry run must still print a plan) and #863 (everygetDrivercall on a phase path carries the configured driver settings). Both were caught by their existing tests and fixed in51518732: the lookup takesDriverOptionsfrom the execution config and never throws.QA round 3 — AC_MET_BUT_NOT_A_PLUS, four gaps fixed
createSymlink's return value was discarded. It answers EPERM/EACCES (Windows without privileges) withfalserather than throwing — the case its other consumer,copyTemplates, handles by falling back to a copy.writeCodexSkillsSymlinkreturned"created"regardless, so init would print✔ Symlinked .agents/skills -> ../.claude/skillswith no symlink on disk and codex skill discovery would fail silently. New"unsupported"status and a warning naming the cause. No copy fallback here: a copied skill tree goes stale the moment.claude/skillschanges.writeCodexSkillsSymlink's JSDoc, which the issue's Non-goals explicitly ask for ("note as a limitation, do not solve").init.test.tsmockscreateDefaultSettings, so nothing asserted thatinitCommandforwardsoptions.agent, and nothing covered the new conditional"agent"line. Both are tested now (src/lib/settings.agent-key.test.ts).resolveDriverName's JSDoc restored — the previous commit inserted a new doc block between it and its function.QA also rebased this branch onto
origin/mainmid-review, rewriting seven already-pushed commits. That was undone: the branch was reset to its pushed state andmainmerged in (35dc1109), per the repo's merge-not-rebase rule. Content is identical either way.Mutation-verified: AC-1 (symlink refusal) — dropped the
createSymlinkreturn-value check so the function reported"created"unconditionally; exactlysrc/commands/init.codex.integration.test.ts > AC-1: reportsunsupportedrather than success when the OS refuses the symlinkfailed, the other 8 tests in the file passed; restored.QA follow-ups applied
writeCodexSkillsSymlink(dir, true)threw EEXIST on a real directory at.agents/skills(removeFileOrSymlinkis a bare unlink), aborting init before.codex/config.tomlwas written. A directory is now reported asskipped-foreignand left intact —--forcestill replaces a stray file — with the new AC-1 test above.Symlinked .agents/skills -> ..., claiming work it had not done; it now reports the no-op.[Unreleased]gained the init/doctor/README entry.init --agent <name>now persistsrun.agentin.sequant/settings.json(createDefaultSettings(agent)), sodoctorruns the configured driver's checks after the documented setup path. Verified by hand in a scratch repo: a plaininit --agent codexnow yields both thecodex CLIandcodex authchecks, which were previously absent — the README's claim that doctor checks codex auth was true only if the user hand-edited settings.json.Documented, not fixed (out of this issue's scope):
templates/codex/has no directtemplateDestinationnull-routing test;getCodexVersion/isCodexAuthenticatedcallexecSyncwithout a timeout (the same pattern as the pre-existinggetOpencodeVersion); AC-2's literal grep now returns 3 rather than 1, the extra hits being a JSDoc comment describing the check and the test asserting it (the substantive "one real TOML template" requirement holds, and the test filters to/templates/first); and AC-6's stated verify command-t "497 AC-6"selects #1058's tests — this issue's are named1059 AC-6, so the correct command isnpx vitest run src/commands/init.codex.integration.test.ts.Test plan
npm run buildnpm run lintnpm test(full suite, foreground, re-run after the round-3 fixes) — 318 files, 6432 passed, 0 failed, 1 expected fail, 3 skipped. The three failures the original run called "pre-existing" never recurred.sequant init --agent codex+sequant doctorrun by hand in a scratch repo (F4)Closes #1059