Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d0b984d
feat: balance dispatch by quota run rate
alimohammad-123 Jul 19, 2026
f3a212c
feat: balance dispatch by quota run rate
alimohammad-123 Jul 19, 2026
4dc0e9a
no-mistakes(review): Captain, prevent quota account data from enterin…
alimohammad-123 Jul 19, 2026
9b65efd
no-mistakes(test): Captain, make composer glyph parsing locale-safe
alimohammad-123 Jul 19, 2026
0c2664d
no-mistakes(document): Document quota tuning schema constraints
alimohammad-123 Jul 19, 2026
e4fc97b
merge: recover validated no-mistakes head
alimohammad-123 Jul 19, 2026
af144a4
feat: balance dispatch by quota run rate
alimohammad-123 Jul 19, 2026
3e25d72
no-mistakes(review): Captain, prevent quota account data from enterin…
alimohammad-123 Jul 19, 2026
276bfd6
no-mistakes(test): Captain, make composer glyph parsing locale-safe
alimohammad-123 Jul 19, 2026
47883c5
no-mistakes(document): Document quota tuning schema constraints
alimohammad-123 Jul 19, 2026
0d60470
no-mistakes(review): Captain, preserve concurrent quota history updates
alimohammad-123 Jul 19, 2026
71d3eb9
no-mistakes(review): Captain, bound quota history lock acquisition
alimohammad-123 Jul 19, 2026
f5d6a2d
no-mistakes(document): Remove stale quota rollout wording
alimohammad-123 Jul 19, 2026
3193b25
merge: preserve validated no-mistakes head
alimohammad-123 Jul 19, 2026
a5a0cd9
no-mistakes(review): Exclude code-review windows from general quota s…
alimohammad-123 Jul 19, 2026
4622c4b
no-mistakes(test): Captain: stabilize secondmate seed rollback cleanup
alimohammad-123 Jul 19, 2026
8557d4c
no-mistakes(test): Stabilize watcher stale-absorb test synchronization
alimohammad-123 Jul 19, 2026
ed0d00c
no-mistakes(test): Captain: stabilize bootstrap timeout fixture synch…
alimohammad-123 Jul 19, 2026
5aa87f2
ci: preserve no-mistakes signature rechecks
alimohammad-123 Jul 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/no-mistakes-required.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:

concurrency:
group: no-mistakes-required-${{ github.event.pull_request.number }}
cancel-in-progress: true
cancel-in-progress: false

jobs:
check:
Expand Down
4 changes: 2 additions & 2 deletions bin/backends/herdr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ FM_BACKEND_HERDR_IDLE_RE=${FM_BACKEND_HERDR_IDLE_RE:-'^Type a message\.\.\.$'}
# Known bare (unbordered) prompt glyphs a composer row may start with: ❯
# (claude) and β€Ί (codex) only. Generic shell-style glyphs > $ % # are still
# recognized after a bordered composer row has already been structurally found.
FM_BACKEND_HERDR_BARE_PROMPT_RE=${FM_BACKEND_HERDR_BARE_PROMPT_RE:-'^[❯›]'}
FM_BACKEND_HERDR_BARE_PROMPT_RE=${FM_BACKEND_HERDR_BARE_PROMPT_RE:-'^(❯|β€Ί)'}
# Pi allows a multi-line composer between its horizontal separators. Bound the
# structural candidate so two unrelated transcript rules with an arbitrarily
# large region between them can never be promoted into a composer.
Expand Down Expand Up @@ -903,7 +903,7 @@ EOF
fi
# Delegate the empty/pending/unknown decision to the shared owner. The bare
# shape only ever starts with an AGENT glyph (FM_BACKEND_HERDR_BARE_PROMPT_RE
# is '^[❯›]'), so a bare shell prompt never reaches here - it stays 'unknown'
# is '^(❯|β€Ί)'), so a bare shell prompt never reaches here - it stays 'unknown'
# via the no-composer-row path above, exactly as before.
fm_composer_classify_content "$bordered" "$stripped" "$FM_BACKEND_HERDR_IDLE_RE"
}
Expand Down
71 changes: 71 additions & 0 deletions bin/fm-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,76 @@ crew_dispatch_validate() {
| map(select(. as $p | effort_ok($p.h; $p.e) | not))
| map("\(.h):\(.e)")
| unique;
def nonnegative_number($value): ($value | type) == "number" and $value >= 0;
def positive_integer($value):
($value | type) == "number" and $value > 0 and ($value | floor) == $value;
def nonnegative_integer($value):
($value | type) == "number" and $value >= 0 and ($value | floor) == $value;
def quota_balanced_error:
(.quotaBalanced? // {}) as $quota
| if has("quotaBalanced") and ((.quotaBalanced | type) != "object") then
"quotaBalanced must be an object"
elif (($quota | keys_unsorted) - ["providers","reservePercent","runRate","staleClearMargin"] | length) > 0 then
"quotaBalanced has unknown fields"
elif $quota.reservePercent? != null
and ((nonnegative_number($quota.reservePercent) | not) or $quota.reservePercent > 100) then
"quotaBalanced.reservePercent must be between 0 and 100"
elif $quota.staleClearMargin? != null and (nonnegative_number($quota.staleClearMargin) | not) then
"quotaBalanced.staleClearMargin must be non-negative"
elif $quota.runRate? != null and (($quota.runRate | type) != "object") then
"quotaBalanced.runRate must be an object"
elif ((($quota.runRate? // {}) | keys_unsorted)
- ["historyMaxAgeSeconds","minimumObservationSeconds","recentWeight"] | length) > 0 then
"quotaBalanced.runRate has unknown fields"
elif $quota.runRate.minimumObservationSeconds? != null
and (positive_integer($quota.runRate.minimumObservationSeconds) | not) then
"quotaBalanced.runRate.minimumObservationSeconds must be a positive integer"
elif $quota.runRate.historyMaxAgeSeconds? != null
and (positive_integer($quota.runRate.historyMaxAgeSeconds) | not) then
"quotaBalanced.runRate.historyMaxAgeSeconds must be a positive integer"
elif $quota.runRate.recentWeight? != null
and ((nonnegative_number($quota.runRate.recentWeight) | not) or $quota.runRate.recentWeight > 1) then
"quotaBalanced.runRate.recentWeight must be between 0 and 1"
elif $quota.providers? != null and (($quota.providers | type) != "object") then
"quotaBalanced.providers must be an object"
elif ((($quota.providers? // {}) | keys_unsorted)
- ["claude","codex","copilot","cursor","grok"] | length) > 0 then
"quotaBalanced.providers has an unsupported provider"
elif [($quota.providers? // {})[] | select(type != "object")] | length > 0 then
"each quotaBalanced provider must be an object"
elif [($quota.providers? // {})[]
| select(((keys_unsorted - ["reservePercent","windows"]) | length) > 0)] | length > 0 then
"quotaBalanced provider has unknown fields"
elif [($quota.providers? // {})[] | .reservePercent? // empty
| select((nonnegative_number(.) | not) or . > 100)] | length > 0 then
"quotaBalanced provider reservePercent must be between 0 and 100"
elif [($quota.providers? // {})[]
| select(.windows? != null and ((.windows | type) != "array"))] | length > 0 then
"quotaBalanced provider windows must be an array"
elif [($quota.providers? // {})[] | .windows[]? | select(type != "object")] | length > 0 then
"each quotaBalanced window must be an object"
elif [($quota.providers? // {})[] | .windows[]?
| select(((keys_unsorted - ["durationSeconds","extraResets","scope"]) | length) > 0)] | length > 0 then
"quotaBalanced window has unknown fields"
elif [($quota.providers? // {})[] | .windows[]?
| select(positive_integer(.durationSeconds?) | not)] | length > 0 then
"quotaBalanced window durationSeconds must be a positive integer"
elif [($quota.providers? // {})[] | .windows[]?
| select(nonnegative_integer(.extraResets?) | not)] | length > 0 then
"quotaBalanced window extraResets must be a non-negative integer"
elif [($quota.providers? // {})[] | .windows[]?
| select(.scope != "session" and .scope != "weekly")] | length > 0 then
"quotaBalanced window scope must be session or weekly"
elif [($quota.providers? // {})[] | .windows[]?
| select((.durationSeconds == 18000 and .scope != "session")
or (.durationSeconds == 604800 and .scope != "weekly"))] | length > 0 then
"quotaBalanced window scope must match canonical 5-hour or 7-day duration"
elif [($quota.providers? // {})[]
| [(.windows // [])[] | [.scope, .durationSeconds]]
| group_by(.)[] | select(length > 1)] | length > 0 then
"quotaBalanced provider windows must not duplicate scope and durationSeconds"
else ""
end;
if type != "object" then "top-level value must be an object"
elif has("rules") and (.rules | type) != "array" then "rules must be an array"
elif [(.rules // [])[]? | select(type != "object")] | length > 0 then "each rule must be an object"
Expand All @@ -692,6 +762,7 @@ crew_dispatch_validate() {
"unknown select: " + ([ (.rules // [])[]? | .select? // empty | select(. != "quota-balanced") ] | unique | join(", "))
elif has("default") and (.default | type) != "object" then "default must be an object"
elif has("default") and ((.default.harness? | type) != "string" or (.default.harness | length) == 0) then "default needs harness when present"
elif (quota_balanced_error | length) > 0 then quota_balanced_error
else
([(.rules // [])[]? | use_profiles(.use?)[]?.harness] + [.default?.harness?]
| map(select(. != null))
Expand Down
8 changes: 6 additions & 2 deletions bin/fm-composer-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,12 @@ fm_composer_classify_content() { # <bordered> <content> [idle_re] [idle_case] [
fi
# Strip a leading prompt glyph, then re-judge the remainder.
case "$content" in
'❯ '*|'β€Ί '*|'> '*|'$ '*|'% '*|'# '*) content=${content#??} ;;
'❯'*|'β€Ί'*|'>'*|'$'*|'%'*|'#'*) content=${content#?} ;;
'❯ '*) content=${content#'❯ '} ;;
'β€Ί '*) content=${content#'β€Ί '} ;;
'❯'*) content=${content#'❯'} ;;
'β€Ί'*) content=${content#'β€Ί'} ;;
'> '*|'$ '*|'% '*|'# '*) content=${content#??} ;;
'>'*|'$'*|'%'*|'#'*) content=${content#?} ;;
esac
content="${content#"${content%%[![:space:]]*}"}"
content="${content%"${content##*[![:space:]]}"}"
Expand Down
Loading