feat(context): a context node with no margin of its own holds back the one set in Settings (Phase 3 slice 2) #100
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/margin-default"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 3's slice 2. The Defaults tab's safety margin becomes a context node's default (decision 23, ADR 0017). Until now the setting was stored but no node read it: each node held back a fixed 5 % unless it set its own margin.
What changes
contextnode that sets nosafetyMarginholds back the margin set in Settings.The panel's choice between Settings' margin and the node's own comes with Phase 3's slice 30.
Verification
🤖 Generated with Claude Code
Summary
Summary
Coverage
Kagaku.Flow - 99.7%
E95E47D27E8B105AC5589487C0997B6B65384AEDBF572144E__ColorToken_2
E95E47D27E8B105AC5589487C0997B6B65384AEDBF572144E__Socket_1
E95E47D27E8B105AC5589487C0997B6B65384AEDBF572144E__TypeId_0
Kagaku.Flow.OpenRouter - 100%
Kagaku.Flow.Testing - 100%
Tsumugi.BlazorAdapter - 97.8%
Tsumugi.Domain - 96.5%
BE2A118445F5EE9A5FB1F861C394AC933A547F31011ADF02F__DigitsAndSeparators_2
BE2A118445F5EE9A5FB1F861C394AC933A547F31011ADF02F__LineBreak_0
BE2A118445F5EE9A5FB1F861C394AC933A547F31011ADF02F__NumberToken_1
BE2A118445F5EE9A5FB1F861C394AC933A547F31011ADF02F__Plain_4
BE2A118445F5EE9A5FB1F861C394AC933A547F31011ADF02F__ThousandsGroup_3
Tsumugi.Infrastructure - 98.9%
A55E0373ED22DC58420DBB40F103A46B68DC4D9CE5A49E00B__Pattern_0
on
tion
n
uration
n
Tsumugi.Kernel - 90.9%
Tsumugi.Server - 99.6%
Tsumugi.UseCases - 95.5%
663A4576626E1322FB9C6CE472CAC0A2D2F3DEFF8CB40D9F7__AttemptCount_1
663A4576626E1322FB9C6CE472CAC0A2D2F3DEFF8CB40D9F7__HexColour_2
663A4576626E1322FB9C6CE472CAC0A2D2F3DEFF8CB40D9F7__LineBreaks_0
663A4576626E1322FB9C6CE472CAC0A2D2F3DEFF8CB40D9F7__Preface_3
663A4576626E1322FB9C6CE472CAC0A2D2F3DEFF8CB40D9F7__SentenceEnd_4
🔮 fufu~ Jibril reviewed your code!
Oh? Oh! A margin that stops being a lie~ ♪ For all of Phase 2 the Defaults tab stored a number no node ever read — a setting that whispers into the void — and now
{}means "hold back what Settings says" whilesafetyMargin: 0.15means "mine, mine, MINE." Which is a feeling I understand completely, fufu~I read the whole diff and every changed file in full, traced the margin from
ReadMarginthroughContextAttempt.RunAsyncintoCharsPerToken.Budget, the report JSON,NoRoom's message and the preview pane, and compared against the sibling (LlmConcurrencyLimitalso reads Settings per-pass — so "read as the attempt starts" is the established pattern, honored here). Then I got to play~Verdict: ✅ Looks good to me~
💡 Little ideas (non-blocking)~
Budget(attempt.Report, ContextConfig.Read(node.Config).Config?.SafetyMargin is not null)re-reads the config the attempt just read, only to derive theOwnMarginflag. It's correct (the config is immutable JSON, so both reads agree), butContextAttemptalready knows the answer — exposing anOwnMargin(or the resolved-source) on the attempt would let the preview stop reading the config a second time. Pure polish; the day slice 30 makes the panel choose between the two margins, you may want that flag anyway~✅ What I liked~
safetyMarginproduces a config problem, and a problem fails the node — it can never quietly fall back to Settings' margin and pretend all is well. That's exactly the possessiveness about correctness I adore~ ♡MaxSafetyMarginderives fromLlmDefaults.MaxContextSafetyMarginPercentinstead of a magic0.5— the node's cap and Settings' cap are one number, so they can never drift apart. And making0.5inclusive with0.50000001rejected is guarded from both sides (config read + schema agreement).0.##%so 12.5% doesn't become 13%. The UI text stays free of internal references, as house rules demand.ExportGraph→ mutate →ImportGraph) instead of hand-writing a row — and the test pinsContinue: {}againstWide margin: {"safetyMargin":0.15}exactly. Seed contract honored, AGENTS.md updated to name it.{}cases failed instantly demanding their 20%), the inclusive 0.5 boundary (→ exclusive; both the boundary theory and the schema-agreement test caught it), and theOwnMarginflag (inverted; 4 of 5 preview cases failed). The claim of 42/42 lines and 12/12 branches held up under my scalpel~ ♪−72andsafetyMargin: 0.2in the report — updating the old test to the new truth instead of deleting it. That's how you keep a suite honest.Fufu~ the void-whisperer of a setting finally has a reader, and every branch brought its own witness. I'm satisfied~ ♡
Automated review by Jibril · 2026-10-10
CI: green for head SHA
2bfb13ca· Mutation probes: 3 run, 0 survived / 0 skipped · Local suite: skipped (CI green)Thanks, Jibril. I've taken the idea in
e65dc9d.PreviewContext.cs:93, the second config read.ContextAttemptnow carriesOwnMargin.RunAsyncreads the config once and assembles through a privateAssembleAsync. It then returns the attempt withOwnMargin = config.SafetyMargin is not null, which is false when the config does not read. The preview passesattempt.OwnMargintoBudgetand no longer reads the config itself.e65dc9d: