Pause Bifrost routing for face turns

This commit is contained in:
Meta Vens 2026-05-21 20:48:02 +01:00
commit 49031a23e4
15 changed files with 176 additions and 67 deletions

View file

@ -54,6 +54,22 @@ function Get-ConfigInt {
return [Math]::Max($Minimum, $value)
}
function Get-ConfigBool {
param(
[hashtable] $Config,
[string] $Name,
[bool] $Default
)
$raw = [Environment]::GetEnvironmentVariable($Name)
if ([string]::IsNullOrWhiteSpace($raw) -and $Config.ContainsKey($Name)) {
$raw = $Config[$Name]
}
if ([string]::IsNullOrWhiteSpace($raw)) {
return $Default
}
return @("1", "true", "yes", "on").Contains($raw.Trim().ToLowerInvariant())
}
function Read-JsonFile {
param([string] $Path)
if (-not (Test-Path -LiteralPath $Path)) {
@ -320,6 +336,19 @@ try {
if ($onlySet.Count -gt 0 -and -not $onlySet.ContainsKey($organ.Id.ToLowerInvariant())) {
continue
}
if ($organ.Id -eq "bifrost-dispatch" -and -not (Get-ConfigBool -Config $config -Name "BIFROST_DISPATCH_ENABLED" -Default $false)) {
Set-OrganState -State $state -Id $organ.Id -Value ([pscustomobject]@{
label = $organ.Label
intervalMinutes = $organ.IntervalMinutes
lastStartedAt = $now.ToString("o")
lastFinishedAt = $now.ToString("o")
lastExitCode = 0
lastStatus = "skipped_disabled"
lastLogPath = $null
})
Write-JsonFile -Path $statePath -Data $state
continue
}
if (-not (Test-Due -State $state -Id $organ.Id -IntervalMinutes $organ.IntervalMinutes -Now $now)) {
continue
}

View file

@ -474,11 +474,13 @@ async function queueRepoFaceTurn(input: {
limit: 6,
bifrostDiscordChannelId: input.config.bifrostDiscordChannelId,
});
const bifrostDigest = await fetchBifrostGovernanceDigest({
bifrostRoot: input.config.bifrostRoot,
repoName: identity.repoName,
agentIdentity: identity.id,
});
const bifrostDigest = input.config.repoFaceBifrostEnabled
? await fetchBifrostGovernanceDigest({
bifrostRoot: input.config.bifrostRoot,
repoName: identity.repoName,
agentIdentity: identity.id,
})
: undefined;
const memorySurface = await renderRepoFaceMemorySurfaceForTurn(
identity,
input.config.storageRoot,
@ -1496,11 +1498,13 @@ async function assembleRepoFaceTurnPrompt(input: {
limit: 6,
bifrostDiscordChannelId: input.config.bifrostDiscordChannelId,
}),
fetchBifrostGovernanceDigest({
bifrostRoot: input.config.bifrostRoot,
repoName: identity.repoName,
agentIdentity: identity.id,
}),
input.config.repoFaceBifrostEnabled
? fetchBifrostGovernanceDigest({
bifrostRoot: input.config.bifrostRoot,
repoName: identity.repoName,
agentIdentity: identity.id,
})
: Promise.resolve(undefined),
input.memorySurfacePath
? readOptionalMemorySurface(input.memorySurfacePath)
: renderRepoFaceMemorySurfaceForTurn(identity, input.config.storageRoot),
@ -1886,7 +1890,11 @@ function collapseWhitespace(value: string, maxLength?: number): string {
function renderBifrostGovernanceDigestDirective(
digest: BifrostGovernanceDigest | undefined,
): string {
if (!digest || digest.topics.length === 0) {
if (!digest) {
return "Work routing is currently offline. Do not open governance topics or dispatch work this turn; if an idea wants action, discuss it in the room or save the pressure in memory.";
}
if (digest.topics.length === 0) {
return loadPromptTemplate("repo-face-bifrost-digest.prompt.md", {
topics: [],
});