Skip to content

Commit 7351ef3

Browse files
committed
fix: defensive bar-fill width default + optional-chain HEXACO axes for non-HEXACO trait actors
1 parent 2a160aa commit 7351ef3

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/cli/pair-runner.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ function formatActorSummary(
4949
: 'no deaths';
5050
return [
5151
`${label}: ${leader.name} "${leader.archetype}" (${leader.unit})`,
52-
` HEXACO: O${leader.hexaco.openness.toFixed(2)} C${leader.hexaco.conscientiousness.toFixed(2)} E${leader.hexaco.extraversion.toFixed(2)} A${leader.hexaco.agreeableness.toFixed(2)} Em${leader.hexaco.emotionality.toFixed(2)} HH${leader.hexaco.honestyHumility.toFixed(2)}`,
52+
// Optional-chain every HEXACO axis so actors using the ai-agent
53+
// (or any other) trait model — where `leader.hexaco` is undefined
54+
// because the profile lives under `traitProfile` instead — don't
55+
// crash the verdict prompt builder with a TypeError. Falls back
56+
// to 0.50 (the schema default) so the prompt still carries a
57+
// structurally complete HEXACO line for the LLM to reason from.
58+
` HEXACO: O${(leader.hexaco?.openness ?? 0.5).toFixed(2)} C${(leader.hexaco?.conscientiousness ?? 0.5).toFixed(2)} E${(leader.hexaco?.extraversion ?? 0.5).toFixed(2)} A${(leader.hexaco?.agreeableness ?? 0.5).toFixed(2)} Em${(leader.hexaco?.emotionality ?? 0.5).toFixed(2)} HH${(leader.hexaco?.honestyHumility ?? 0.5).toFixed(2)}`,
5359
` Final: Pop ${col?.population ?? '?'}, Morale ${Math.round((col?.morale ?? 0) * 100)}%, Food ${col?.foodMonthsReserve?.toFixed(1) ?? '?'}mo, Power ${col?.powerKw?.toFixed(0) ?? '?'}kW, Modules ${col?.infrastructureModules?.toFixed(1) ?? '?'}, Science ${col?.scienceOutput ?? '?'}`,
5460
` Mortality: ${deathEvents.length} total (${causeSummary})`,
5561
` Innovation: ${toolbox.length} unique tools forged (${fp.innovation || 'n/a'}), citations ${result.totalCitations}`,

src/dashboard/src/components/layout/CostBreakdownModal.module.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,12 @@
468468
}
469469

470470
.perActorBarFill {
471+
// Default width of 0 so the bar is invisible when the React render
472+
// somehow omits the inline `style={{ width: '...%' }}` — without
473+
// this default the gradient would render at the parent's full
474+
// width, which on a 1fr column reads as "100% of total spend" for
475+
// every actor and breaks the relative-spend comparison.
476+
width: 0;
471477
height: 100%;
472478
background: linear-gradient(90deg, var(--green), var(--amber));
473479
border-radius: 4px;

0 commit comments

Comments
 (0)