Skip to content

Handle empty omp tier sections in the fast toggles - #291

Merged
DocksDocks merged 10 commits into
mainfrom
284-handle-empty-omp-tier-sections-in-the-fast-toggles
Dec 1, 2026
Merged

DocksDocks merged 10 commits into
mainfrom
284-handle-empty-omp-tier-sections-in-the-fast-toggles

Conversation

@DocksDocks

@DocksDocks DocksDocks commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

Plan run: #284 Handle empty omp tier sections in the fast toggles

Pull request: #291. Checks: Full CI passed (run 46737133961, attempt 1, head 24e1320f). Reviewed head: 24e1320f.

What changed

  • docks-kit --fast and --ultrafast toggle a tier that omp reads as null (tier:, tier: null, tier: ~, tier: !!null, an alias of a null) and keep the comments (cli/src/engine-native/ompFastMode.ts).
  • Each toggle reads config.yml with omp's reader (Bun.YAML.parse) before and after the rewrite, and refuses with no write when another setting would change as omp reads it: exact values, key order, and object sharing (ompFastMode.ts).
  • A legacy serviceTier that sets omp's OpenAI tier refuses, with the migration steps.
  • The toggle path is Effect code: a TierToggleError with a tagged reason, an OmpYamlReader service, FileSystem reads, and scoped home and folder locks (cli/src/engine-native/syncDispatch.ts homeAndFolderLocks, cli/src/commands/root.ts).
  • A change by another writer during the check refuses with ConfigChanged. A lock that cannot be opened or a failed read or write exits 1 with its error. Diagnostics show terminal controls as escapes.
  • Version 0.32.1, changelog, cli/docs/flags.md, three skill notes, talk bundle, payload, mutation golden.

Decisions and corrections

  • Plan rounds 6 to 14: the guard compares omp's own reading instead of refusing YAML forms one by one.
  • User request during the run: move the toggle path to Effect now and the rest of engine-native later (plan Move the engine-native layer to Effect #290).
  • Exit codes: a refusal and an invalid DOCKS_KIT_SYNC_LOCK_WAIT_MS exit 2; a held lock, a lock that cannot be opened, and a failed read or write exit 1 (before, the last three exited 2).

Delegated decisions

  • Worktree while the checkout was clean: a worktree under the agent worktree folder, because Replace the free-model wrapper with top-level fast tier flags #283 and Handle empty OMP tier sections in the fast toggles #284 ran in parallel. Rejected: the main checkout, which two plans shared. Reversibility: remove the worktree. Record: none.
  • Version: the next patch over the landing base (0.32.1 over 0.32.0). Rejected: a minor bump, because no flag or command is added. Reversibility: one commit. Record: Research decision "a patch bump".
  • Legacy serviceTier: refuse while it sets the OpenAI tier. Rejected: copying omp's migration rules, which can change in any omp release. Reversibility: one commit. Record: Research decision "Choice: (a)".
  • The concurrent-writer window: refuse every change observed up to the last check; accept the residual window after it. Rejected: a lock shared with omp, which omp does not offer as a contract. Reversibility: one commit. Record: code-review rejections of rounds 4 to 8.

Reviews

Plan review passed in round 14. Code review passed in round 8.
Open findings, round 8 (pass), not repaired:

  • MEDIUM, a retarget between the final realPath and its lstat: the same check-then-act class as the rejections of rounds 4 to 7; it closes only with a lock shared with omp.
  • LOW, ENOTDIR when a parent folder is replaced during the second read: the run exits 1 instead of 2; it needs that race, and the file is untouched.
  • LOW, no fixture that triggers a folder at the second read: the handler is covered by type checks only.

Verification

  • fast (bunx vitest run --reporter=verbose cli/test/unit/ompFastMode.test.ts cli/test/unit/rootFlags.test.ts): exit 0, 80 passed.
  • tidy (tidy.test.ts, folderLockCreate.test.ts): exit 0, 55 passed.
  • ci-tools (bun cli/scripts/verify-ci-tools.ts): exit 0.
  • gen (bun run check:generated): exit 0. golden (bun run golden:mutation): OK, 13 cases.
  • dry (./docks-kit sync --dry-run): exit 0. smoke (bun run smoke:package): exit 0. talk (omp-smoke.ts): talk tool: offered, warnings: 0.
  • gate (bun run check): exit 0, 6450 passed, 12 skipped; both golden suites OK.

Limits and failures

  • Local checks ran on Linux x64 only; Full CI covers Ubuntu, macOS, and Windows. The write-failure test is skipped on Windows and as root.
  • One local gate run failed only the timing cases of ompTriggerBackstop.test.ts while the machine was loaded; this change touches no trigger rule, the file alone passed, and the next gate passed.

Kept resources

  • After Merge now: none.
  • After Leave pull request open: the worktree issue-284 and the local and remote branch 284-handle-empty-omp-tier-sections-in-the-fast-toggles.

After merge

Checklist

  • bun run check passes
  • Tested locally end to end (fast, tidy, ci-tools, gen, golden, dry, smoke, talk, gate)
  • Code review passed

Closes #284

- Treat `tier:`, `tier: null`, and `tier: ~` as an empty mapping and keep the
  comment of the old value.
- Refuse a null tier that carries a YAML anchor, with no write, because omp
  reads config.yml with Bun's YAML parser, which binds repeated anchor names
  differently.
- Bump to 0.31.4; rebuild the talk bundle, the payload, and the mutation
  golden.

Refs #284

Verified: bunx vitest run --reporter=verbose cli/test/unit/ompFastMode.test.ts; bun run check:generated; bun run golden:mutation; bun .agents/skills/verify/scripts/omp-smoke.ts; ./docks-kit sync --dry-run; bun run smoke:package; bun run check
- Treat only an untagged null tier as empty: Bun's YAML reader, which omp
  uses, reads `!<tag:yaml.org,2002:null> null` as a string.
- Escape control characters and line separators of an anchor name in the
  anchored-null refusal.
- Test the refusals through the omp command with an unchanged config.yml,
  and keep the value comment through both toggles of each null form.

Refs #284

Verified: bunx vitest run cli/test/unit/ompFastMode.test.ts; bun run check:types; bun run lint; bun run format
- Classify tier and take the previous tier from omp's reading (Bun's YAML
  parser), so every tier that omp reads as null toggles.
- Re-read the rewrite and refuse it with no write when omp would read any
  other setting differently: values compared exactly, mapping keys in order,
  and object sharing kept.
- Refuse a legacy serviceTier that sets omp's OpenAI tier.
- Drop the anchor and tag special cases and the anchor display.

Refs #284

Verified: bunx vitest run --reporter=verbose cli/test/unit/ompFastMode.test.ts; bun run check:generated; bun run golden:mutation; bun run check
- Resolve the version to 0.32.1, the next patch over 0.32.0.
- Move the toggle tests from the removed `docks-kit omp` command to the
  root `--fast` flag; rebuild the talk bundle, the payload, and the
  mutation golden.

Refs #284

Verified: bunx vitest run cli/test/unit/ompFastMode.test.ts cli/test/unit/rootFlags.test.ts; bun run check:generated; bun run golden:mutation; bun run check:types
- Report each refusal as a TierToggleError with a tagged reason; read
  config.yml through FileSystem and omp's reader through the OmpYamlReader
  service, which main.ts provides.
- Hold the home and folder locks as scoped Effects: each try and its
  release run without interruption, only the sleep between tries can be
  interrupted, and each taken lock goes on a held lock, a failure, or an
  interrupt.
- Exit 2 for a refusal or an invalid lock wait, and 1 for a held lock, a
  lock that cannot be opened, or a failed read or write.
- Cover each reason, the write failure, the lock lifetime, and a spawned
  tidy --apply under a held lock.

Refs #284

Verified: bunx vitest run --reporter=verbose cli/test/unit/ompFastMode.test.ts cli/test/unit/rootFlags.test.ts cli/test/unit/tidy.test.ts cli/test/unit/folderLockCreate.test.ts; bun cli/scripts/verify-ci-tools.ts; bun run check:generated; bun run golden:mutation; ./docks-kit sync --dry-run; bun run smoke:package; bun .agents/skills/verify/scripts/omp-smoke.ts; bun run check
- Bound the lock wait on the monotonic clock, try no lock after the bound,
  and prepare each lock folder once.
- Name the lock and keep its cause on a lock failure; add the native cause
  to a failed read.
- Keep the comments of an aliased null tier; show an undocumented previous
  tier as `another value`.
- Move errorMessage to errorText.ts.
- Test the CLI boundary (invalid wait, folder at the lock path, config.yml
  as a folder), the interrupt with a held-lock precondition, the aged tidy
  fixture, the symlink after a failed write, and the ConfigMissing tag.
- Correct the docs, changelog, and the tidy-context source range.

Refs #284

Verified: bunx vitest run --reporter=verbose cli/test/unit/ompFastMode.test.ts cli/test/unit/rootFlags.test.ts cli/test/unit/tidy.test.ts cli/test/unit/folderLockCreate.test.ts; bun cli/scripts/verify-ci-tools.ts; bun run check:generated; bun run golden:mutation; ./docks-kit sync --dry-run; bun run smoke:package; bun run check
- Resolve a linked config.yml once, read it and its link again before the
  write, and refuse with ConfigChanged when another writer changed either;
  a file that goes away under the locks is ConfigMissing.
- End the lock wait on the monotonic deadline in nanoseconds, with no try
  after it.
- Compare the two readings with an explicit work list, so a long alias
  chain cannot exhaust the stack.
- Show controls and bidirectional marks in diagnostics and paths as
  escapes; use Predicate.isError in errorMessage.
- Tighten the interrupt, read-failure, unresolved-alias, and cleanup tests;
  correct the docs and comments.

Refs #284

Verified: bunx vitest run cli/test/unit/ompFastMode.test.ts cli/test/unit/folderLockCreate.test.ts cli/test/unit/rootFlags.test.ts cli/test/unit/tidy.test.ts; bun run check; bun run smoke:package; bun cli/scripts/verify-ci-tools.ts
- Refuse at once when the link names another file; else compare the file
  type, device, inode, time, and raw bytes, so an atomic replace or a byte
  order mark during the check refuses with ConfigChanged.
- Drop the second existence probe under the locks; compare scalar children
  inline in the reading walk.
- Assert the ConfigChanged reason and the lock failure cause; register
  test folders before resolving them.

Refs #284

Verified: bunx vitest run cli/test/unit/ompFastMode.test.ts cli/test/unit/folderLockCreate.test.ts cli/test/unit/rootFlags.test.ts; bun run check; bun run smoke:package
- Refuse a changed link or file identity before the second read, read,
  then check the identity once more, so a replace or a retarget during that
  read refuses with ConfigChanged.
- Keep the inode and time in the byte order mark test, so only the byte
  comparison can catch it; assert SQLite's cause on a lock failure.

Refs #284

Verified: bunx vitest run cli/test/unit/ompFastMode.test.ts cli/test/unit/folderLockCreate.test.ts cli/test/unit/rootFlags.test.ts; bun run check
- A second read that fails checks the identity: a file that became a folder
  is ConfigChanged (exit 2), else the read error stands.
- Compare the identity and the bytes separately, the bytes once.
- Pin a whole-second time and a same-length edit in the change tests, so
  only the byte comparison can catch them.

Refs #284

Verified: bunx vitest run cli/test/unit/ompFastMode.test.ts cli/test/unit/folderLockCreate.test.ts cli/test/unit/rootFlags.test.ts; bun run check
@DocksDocks DocksDocks linked an issue Dec 1, 2026 that may be closed by this pull request
@DocksDocks
DocksDocks marked this pull request as ready for review December 1, 2026 20:23
@DocksDocks
DocksDocks merged commit a08384b into main Dec 1, 2026
10 checks passed
@DocksDocks
DocksDocks deleted the 284-handle-empty-omp-tier-sections-in-the-fast-toggles branch December 1, 2026 20:40
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.

Handle empty OMP tier sections in the fast toggles

1 participant