Commit Graph
806 Commits
Author SHA1 Message Date
ZacharyZhang-NY db3cd3c8b8 fix(budget): add Fireworks model pricing and auto-unpause after limit increase
Three fixes for the non-functional budget system:

1. Fireworks models hardcoded cost {input: 0, output: 0}, making all
   Fireworks/Fire Pass runs report $0 and budget enforcement useless.
   Added per-model pricing to FIREWORKS_CURATED_MODELS with a fallback
   for unknown models. Pi-ai known providers (Anthropic, OpenAI, etc.)
   already had correct per-model pricing via getModels().

2. saveAgent IPC handler passed the form's submitted status through
   without checking whether the agent was budget-paused and the new
   budget exceeds spent. Now auto-resolves paused → idle when the user
   raises budget_monthly_usd above spent_monthly_usd.

3. checkAutoResolve in budget-enforcement-service resolved policy
   incidents but never touched agents.status. Added
   unpauseBudgetBlockedAgents() that scans for paused agents whose
   legacy budget now has headroom and flips them to idle.
2026-04-29 20:31:48 -04:00
ZacharyZhang-NY b3da6dbf8a fix(messaging): preserve conversation channel in agent replies
Agents always replied with channel="direct" regardless of the original
message's channel, creating new DM conversations instead of replying
in the existing group chat (department/company/project/incident).

Root cause: three layers of the system guided agents toward direct-only
replies:
1. Prompt instructions (wake-reasons, IC/manager operating instructions)
   hardcoded channel="direct" and toAgentId=fromAgentId for all replies
2. Standup API omitted toAgentId from unread messages, removing context
   about who the original message was addressed to
3. Inbox projection contained no reply-routing metadata, so the agent's
   LLM had no signal about which channel to respond in

Fixes:
- routes-agents-standup.ts: include toAgentId in unread message payload
- wake-reasons/en.ts: differentiate direct vs group channel reply format
- operating-en.ts: same channel-preserving guidance for IC and manager
- inbox-projection.ts: embed reply-to routing context in message header
  so the LLM sees channel + target alongside the message body
2026-04-29 20:25:18 -04:00
ZacharyZhang-NY 1e36259c5d fix(orchestration): enforce approval gates on heartbeat and recovery paths
The heartbeat path (canRunAgent → startAgentHeartbeatRun) only checked
isAgentPendingApproval (hire gate), completely bypassing plan_review,
draft_review, strategy_review and other blocking approval types. Agents
in Co-Founder mode continued running despite pending approvals.

Root cause: task-runner.prepareTaskRun had the full getBlockingApproval
check, but heartbeat runs never went through prepareTaskRun — they
created runs directly, skipping the approval gate entirely.

Three fixes:
- heartbeat.canRunAgent: add getBlockingApproval(companyId, agentId, null)
  for agent-level blocking approvals
- heartbeat.startAgentHeartbeatRun: add getBlockingApproval with task id
  after task resolution, before run creation
- task-runner.resumeQueuedRuns: add getBlockingApproval check so app
  restart does not dispatch runs past pending approvals

Also replaced the hardcoded type list in hasPendingReviewApprovalForAgent
with a dynamic join on approval_policies.blocks_execution, eliminating
the sync risk when new blocking approval types are added.
2026-04-29 20:17:33 -04:00
ZacharyZhang-NY c9deca5454 fix(database): project only live active runs 2026-04-29 00:10:23 -04:00
ZacharyZhang-NY 7504df170e fix(worker): harden run completion boundary 2026-04-29 00:04:00 -04:00
ZacharyZhang-NY e34503df68 fix(orchestration): drain queued recovery blockers 2026-04-28 23:47:02 -04:00
ZacharyZhang-NY 7dbaaf0022 fix(worker): recover tasks after worker crash 2026-04-28 23:37:24 -04:00
ZacharyZhang-NY d3e108ec18 fix(scheduler): respect heartbeat eligibility for task cadence 2026-04-28 23:21:25 -04:00
ZacharyZhang-NY d9fd231be3 fix(approvals): make revision requests checkoutable 2026-04-28 23:17:12 -04:00
ZacharyZhang-NY 49ea508ee1 fix(scheduler): drain pending wakeup requests 2026-04-28 20:26:29 -04:00
ZacharyZhang-NY 749ad3a231 fix(scheduler): wake agents with assigned todo work 2026-04-28 20:16:08 -04:00
ZacharyZhang-NY bdfada7549 update 2026-04-24 23:08:12 -04:00
ZacharyZhang-NY 7359aa0a48 release: 0.4.179 2026-04-24 11:31:43 -04:00
ZacharyZhang-NY 369c296f3b update 2026-04-24 10:48:25 -04:00
ZacharyZhang-NY 31aac7c0de fix(messages): normalize escaped markdown newlines 2026-04-24 10:35:11 -04:00
ZacharyZhang-NY 6ce7e63c71 fix(renderer): simplify sidebar and reset page errors 2026-04-24 10:08:07 -04:00
ZacharyZhang-NY eabd304a45 fix(database): normalize baseline schema ddl 2026-04-24 09:39:44 -04:00
ZacharyZhang-NY 4582bdbee5 fix(api): enforce utf8 request bodies 2026-04-24 03:42:00 -04:00
ZacharyZhang-NY 6b228864de fix(auth): persist agent token signing key 2026-04-24 03:35:20 -04:00
ZacharyZhang-NY 38e2807f6c refactor(errors): route fatal app errors 2026-04-24 03:31:39 -04:00
ZacharyZhang-NY ead9475b71 refactor(scheduler): unify cadence phases 2026-04-24 03:26:17 -04:00
ZacharyZhang-NY 8d98151027 refactor(heartbeat): collapse skip decisions 2026-04-24 03:13:57 -04:00
ZacharyZhang-NY 1383805d66 refactor(renderer): split snapshot state sections 2026-04-24 02:48:28 -04:00
ZacharyZhang-NY 236714e17a test(eval): add task-level prompt section harness 2026-04-24 02:16:19 -04:00
ZacharyZhang-NY 2cdf26f9fa refactor(prompt): split stable prefix from volatile tail 2026-04-24 01:57:08 -04:00
ZacharyZhang-NY 227fd7faf2 refactor(ipc): validate write payloads in preload 2026-04-24 01:31:29 -04:00
ZacharyZhang-NY 3609456ca5 refactor(services): combine runtime orchestration ownership 2026-04-24 01:10:54 -04:00
ZacharyZhang-NY fd86fc6668 refactor(artifacts): reconcile workspace artifacts at completion 2026-04-24 00:58:07 -04:00
ZacharyZhang-NY 2ddc67cc3d refactor(shutdown): coordinate worker drain handshake 2026-04-24 00:44:06 -04:00
ZacharyZhang-NY 9ee1425a71 refactor(approvals): move execution policy into database 2026-04-24 00:33:56 -04:00
ZacharyZhang-NY f8eb57ad8c refactor(database): move task runtime ownership to leases 2026-04-24 00:18:51 -04:00
ZacharyZhang-NY 1f4af89be0 refactor(database): squash schema migrations to v56 baseline 2026-04-24 00:00:13 -04:00
ZacharyZhang-NY 67ccfc1160 fix: enforce work product taxonomy 2026-04-23 22:44:41 -04:00
ZacharyZhang-NY fa53d15822 test: make onboarding e2e deterministic 2026-04-23 22:32:56 -04:00
ZacharyZhang-NY d2e94959e0 fix: make run log creation atomic 2026-04-23 22:14:01 -04:00
ZacharyZhang-NY 4cb61399b1 fix: make navigation sections reachable 2026-04-23 22:02:23 -04:00
ZacharyZhang-NY 88c905c381 fix: make artifact projection durable 2026-04-23 21:50:49 -04:00
ZacharyZhang-NY 84c00e0011 fix: validate and compact session entries 2026-04-23 21:21:59 -04:00
ZacharyZhang-NY c850d70bfc fix: enforce work product primary invariant 2026-04-23 21:08:07 -04:00
ZacharyZhang-NY 6c757f2081 fix: enforce work product external url policy 2026-04-23 20:54:39 -04:00
ZacharyZhang-NY c779fc2858 fix: make onboarding bootstrap atomic 2026-04-23 20:43:44 -04:00
ZacharyZhang-NY d21edb244f fix: guard run completion boundary 2026-04-23 20:34:31 -04:00
ZacharyZhang-NY 245586a9aa test(runtime): guard pi package contracts 2026-04-23 19:47:55 -04:00
ZacharyZhang-NY c26e7420fb fix(browser): queue browser action dispatch failures 2026-04-23 19:39:29 -04:00
ZacharyZhang-NY 04c4059159 test(eval): add semantic rubric gate 2026-04-23 19:31:31 -04:00
ZacharyZhang-NY 84d80f02aa fix(prompt): generate approval type docs from schema 2026-04-23 19:20:20 -04:00
ZacharyZhang-NY 850a2ca218 fix(prompt): document filesystem task lock contract 2026-04-23 19:15:23 -04:00
ZacharyZhang-NY b520de9a51 fix(ipc): steer desktop messages into live runs 2026-04-23 19:12:32 -04:00
ZacharyZhang-NY a1dd361f51 fix(thread): make wait-state side effects atomic 2026-04-23 19:08:06 -04:00
ZacharyZhang-NY f8a90f4402 fix(checkpoint): fail closed on pause queries 2026-04-23 18:58:06 -04:00