Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): a negative or fractional round cap is rejected, not coerced into ~max=0

[._.]/ Adam Eivye4c5f67424e6
diff --git a/client/src/components/cos/ReviewerPicker.jsx b/client/src/components/cos/ReviewerPicker.jsx
index d587d2f9ba..6ad404c938 100644
--- a/client/src/components/cos/ReviewerPicker.jsx
+++ b/client/src/components/cos/ReviewerPicker.jsx
@@ -98,18 +98,24 @@ export default function ReviewerPicker({
optionalReviewers: isOptional(token) ? withoutToken(token) : [...optionalTokens, token]
});
- // Blank clears the cap entirely (back to slashdo's built-in default); any other
- // value is clamped to 0..MAX_REVIEWER_MAX_ROUNDS so the input can't offer a
- // budget the server would drop.
+ // Blank clears the cap entirely (back to slashdo's built-in default). The two
+ // out-of-range directions are deliberately NOT symmetric, because only one of
+ // them can change what the value MEANS:
+ // - A negative or non-integer entry is REJECTED (the emit is skipped, so the
+ // controlled input snaps back). Coercing it would land on `0`, which is
+ // slashdo's "loop until clean" — turning a typo into an unlimited loop, the
+ // exact absent-vs-0 collapse the server's normalizer refuses.
+ // - A value above the ceiling clamps DOWN to it. That can only ever shrink a
+ // budget, never make it unlimited, and it matches the input's `max`.
const setMaxRounds = (token, raw) => {
if (raw === '') {
emit({ reviewerMaxRounds: maxRoundsWithout(token) });
return;
}
- const parsed = Number.parseInt(raw, 10);
- if (!Number.isInteger(parsed)) return;
- const clamped = Math.min(Math.max(parsed, 0), MAX_REVIEWER_MAX_ROUNDS);
- emit({ reviewerMaxRounds: { ...maxRoundsWithout(token), [token]: clamped } });
+ const parsed = Number(raw);
+ if (!Number.isInteger(parsed) || parsed < 0) return;
+ const capped = Math.min(parsed, MAX_REVIEWER_MAX_ROUNDS);
+ emit({ reviewerMaxRounds: { ...maxRoundsWithout(token), [token]: capped } });
};
// The `~opt` non-blocking toggle rendered on every reviewer/username chip.
diff --git a/client/src/components/cos/ReviewerPicker.test.jsx b/client/src/components/cos/ReviewerPicker.test.jsx
index 379ebe5cca..0959371002 100644
--- a/client/src/components/cos/ReviewerPicker.test.jsx
+++ b/client/src/components/cos/ReviewerPicker.test.jsx
@@ -192,11 +192,19 @@ describe('ReviewerPicker', () => {
expect(onChange).toHaveBeenLastCalledWith(expect.objectContaining({ reviewerMaxRounds: { ollama: 10 } }));
});
- it('clamps a negative cap to 0 rather than dropping the entry silently', () => {
+ it('rejects a negative cap rather than clamping it to 0 (which would mean unlimited)', () => {
const onChange = vi.fn();
render(<ReviewerPicker reviewers={['ollama']} onChange={onChange} />);
fireEvent.change(screen.getByLabelText('Max review rounds for Ollama'), { target: { value: '-2' } });
- expect(onChange).toHaveBeenLastCalledWith(expect.objectContaining({ reviewerMaxRounds: { ollama: 0 } }));
+ // Clamping to 0 would silently turn a typo into slashdo's "loop until clean".
+ expect(onChange).not.toHaveBeenCalled();
+ });
+
+ it('rejects a fractional cap rather than truncating it', () => {
+ const onChange = vi.fn();
+ render(<ReviewerPicker reviewers={['ollama']} onChange={onChange} />);
+ fireEvent.change(screen.getByLabelText('Max review rounds for Ollama'), { target: { value: '1.5' } });
+ expect(onChange).not.toHaveBeenCalled();
});
it('prunes the cap entry when its reviewer is removed', async () => {