Repository navigation
feat: boost dispatch candidates outside declared peak hours - #301
Merged
Merged
Conversation
Profiles in config/crew-dispatch.json may declare optional peak_pricing: UTC weekday windows plus a cost multiplier above 1. Outside every declared window, including all weekend, the resolver multiplies the candidate's positive ranking weight (exp of quota-axi spendPriority) by the multiplier before the argmax; inside a window it ranks exactly as with no declaration. Eligibility, floors, exhausted-runway refusals, approvals, and tie handling read the same unadjusted evidence, and an adjusted candidate line shows offpeak=xN. The UTC clock is read once per run, with FM_DISPATCH_CLOCK_UTC pinning it for tests, and malformed declarations exit 2. Bootstrap applies the same validation while typed resolution is active.
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
Profiles declare their provider's peak-price windows once; the resolver boosts that candidate's rank everywhere outside them and leaves ranking untouched inside them.
{ "harness": "omp", "model": "opencode-go/deepseek-v4.1-flash", "provider": "opencode-go", + "peak_pricing": { + "multiplier": 2, + "windows": [ + { "weekdays": ["mon","tue","wed","thu","fri"], "start": "01:00", "end": "04:00" }, + { "weekdays": ["mon","tue","wed","thu","fri"], "start": "06:00", "end": "10:00" } ] } }The ranking weight is
exp(spendPriority).quota-axi's scalar is signed, so a literal multiplication by a boost factor would deepen a negative deficit instead of favoring the candidate;
expis order-preserving, so peak ranking is identical to a run with no declaration.Eligibility, quota floors, exhausted-runway refusals, approvals, and the genuine-tie rule read the same unadjusted evidence.
The UTC clock is read once per run;
FM_DISPATCH_CLOCK_UTCpins it for tests; a malformed declaration exits 2 in the resolver and bootstrap reports the same configuration error.Evidence
Before: the new resolver cases failed on the unfixed code, for example
not ok - off-peak boosts a below-leader weight past the leader (missing: profile '--harness omp --model opencode-go/deepseek-v4.1-flash'); the 0.3 candidate stayed behind the 0.4 candidate.After:
bash tests/fm-dispatch-resolve.test.shexits 0 with every case green, including off-peak and weekend boosts, peak output identical to no declaration, eligibility and adjusted-tie handling, malformed declarations, single midnight-crossing clock sampling, and trailing-newline rejection.Substitute for the cancelled macOS check (firstmate-approved; the captain decides the merge): the
Stock macOS Bash snapshot compatibilityjob was cancelled by the provider twice with no verdict.Its own workflow commands were run under the exact required interpreter, GNU bash 3.2.57:
bash --version->GNU bash, version 3.2.57(1)-release (x86_64-pc-linux-musl)bin/fm-lint.sh --list-files, thenbash -nper file) -> 443 files, PASSbash tests/fm-fleet-snapshot-view.test.sh-> 17 ok (CI expects 17)bash tests/fm-bearings-snapshot.test.sh-> 47 ok (CI expects 47)bin/fm-dispatch-resolve.sh:365-367tries GNUdate -u -dand falls back to BSDdate -u -j -f '%Y-%m-%dT%H:%M:%SZ'; the live path at:369runsdate -u '+%u %H:%M'with no date flags and POSIX/BSDstrftimeformats.bin/fm-lint.sh(pinned ShellCheck 0.11.0): exit 0;bin/fm-doc-audience-check.sh: ok, surfaces=98, local_links=530.Merge Danger
Door: two-way.
The field is optional, absent-field behavior is byte-identical, and reverting the commits restores the previous ranking.
Blast Radius: dispatch ranking only.
No behavior changes until
peak_pricingis added to the privateconfig/crew-dispatch.jsonafter merge.Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-dispatch-resolve.test.sh— exit 0; supplemental fixture-based regression coverage.python3 .tmp-pricing-live/drive.py— exit 0; 47 real resolver/bootstrap CLI executions with isolated synthetic inputs and localhost HTTPS.Inspected resolver-header and configuration-owner documentation; did not run prohibited lint or static-analysis commands.Retained CLI evidence, stopped the HTTPS emulator, removed disposable workspace fixtures, and confirmed a clean worktree.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.