flue flow fixes

This commit is contained in:
-Puter
2026-07-31 23:43:49 +05:30
parent bb4bd9e0d3
commit 8bd3953440
52 changed files with 814 additions and 484 deletions
+8 -4
View File
@@ -119,10 +119,10 @@ Then configure the deployment-scoped values from `packages/backend`:
cd packages/backend
bunx convex env set SITE_URL 'http://localhost:5173'
bunx convex env set FLUE_DB_TOKEN '<same value as .env>'
bunx convex env set FLUE_URL 'http://<host-reachable-ip>:3585'
bunx convex env set FLUE_URL 'http://<tailscale-ip>:3585'
```
Convex runs in the cloud, so `FLUE_URL` must be reachable from the Convex deployment. `127.0.0.1` and `localhost` point at Convex's machine, not your laptop. For the current Mac setup, expose Flue over Tailscale and use the Mac's Tailscale address, for example `http://100.x.y.z:3585`.
Convex runs in the cloud, so `FLUE_URL` must be reachable from the deployment. `127.0.0.1` and `localhost` point at Convex's machine, not your laptop. For the current Mac setup, expose Flue on the Mac's Tailscale address, for example `http://100.x.y.z:3585`.
`SITE_URL` is deployment-scoped and single-valued. Set it to the exact browser origin currently being tested:
@@ -143,10 +143,14 @@ Run each process in its own terminal. The order matters for the AgentOS path.
### 1. Start Convex development
```bash
bun run dev:server
# Publish once after backend changes
pnpm --filter @code/backend dev:once
# Watch and republish while developing
pnpm dev:server
```
This watches and publishes functions to the configured Convex cloud development deployment.
Both commands run from `packages/backend` and explicitly load the repository-root `.env` with `--env-file=../../.env`. `packages/backend/.env.local` remains Convex CLI metadata for the selected deployment; keep the shared runtime settings in the root `.env`.
### 2. Start the whole stack
+20 -14
View File
@@ -195,9 +195,9 @@ Prefer explicit state machines over booleans.
Bad:
```ts
isRunning: boolean
isDone: boolean
hasError: boolean
isRunning: boolean;
isDone: boolean;
hasError: boolean;
```
Good:
@@ -213,7 +213,7 @@ type AttemptStatus =
| "verification_failed"
| "budget_exhausted"
| "cancelled"
| "permanent_failure"
| "permanent_failure";
```
Transitions must validate current version/state.
@@ -281,38 +281,44 @@ Design replaceable boundaries, then ship one path.
```md
## Implemented
- ...
## Behavior
- ...
## Verification run
- `command` — pass/fail
- ...
## Evidence
- candidate SHA/artifacts
- ...
## Design deviations
- none / ...
## Remaining risks or blockers
- none / ...
```
## 16. Required reading by task type
| Task | Read |
|---|---|
| product/domain | product.md, glossary.md |
| UI | design.md, product.md |
| actors/state | tech.md, glossary.md |
| orchestration | dev-loop.md, tech.md |
| current sequencing | slices.md, dev-plan.md |
| verification/evals | evaluation.md, dev-loop.md |
| provider adapter | tech.md plus provider docs |
| broad feature | agent-context.md + all relevant sections |
| Task | Read |
| ------------------ | ---------------------------------------- |
| product/domain | product.md, glossary.md |
| UI | design.md, product.md |
| actors/state | tech.md, glossary.md |
| orchestration | dev-loop.md, tech.md |
| current sequencing | slices.md, dev-plan.md |
| verification/evals | evaluation.md, dev-loop.md |
| provider adapter | tech.md plus provider docs |
| broad feature | agent-context.md + all relevant sections |
## 17. Stop and escalate when
+1 -1
View File
@@ -644,7 +644,7 @@ Answers are durable Decisions and resume the same Work.
## 17. Resolver decision table
| Condition | Resolver action |
|---|---|
| --- | --- |
| executable slice exists | start bounded Attempt |
| transient infrastructure/model failure | retry by policy |
| candidate fails checks | create repair Attempt with evidence |
+92 -132
View File
@@ -6,25 +6,25 @@ You have shell access and may use the Paseo CLI to create and manage other Codex
All child agents must use:
--provider codex/glm-5.2
--provider codex/glm-5.2
The current repository is the Zopu monorepo. It already contains product documentation, design documentation, technical documentation, Effect primitives, Convex backend code, web/mobile/desktop applications, agent code, project-management primitives, Signals, and partial AgentOS/Rivet integration.
The starting branch is expected to be:
feat/projects-backend
feat/projects-backend
Verify this rather than blindly assuming it.
The final integration branch should be:
dogfood/v0
dogfood/v0
Your job is to manage the entire implementation through parallel isolated worktrees.
======================================================================
1. PRODUCT OBJECTIVE
======================================================================
1. PRODUCT OBJECTIVE ======================================================================
Ship the smallest complete Zopu dogfooding loop for the Zopu repository itself:
@@ -67,25 +67,11 @@ Ship the smallest complete Zopu dogfooding loop for the Zopu repository itself:
The completed proof should be something like:
User:
“Add a health endpoint that exposes the current build commit.”
User: “Add a health endpoint that exposes the current build commit.”
Result:
✓ exact message evidence stored
✓ Signal created
✓ Work Unit created or updated
✓ work started
✓ Orb provisioned
✓ OpenCode session started
✓ repository changed
✓ tests executed
✓ branch committed and pushed
✓ pull request opened
✓ work card updated
✓ contextual follow-up reaches the active work
Result: ✓ exact message evidence stored ✓ Signal created ✓ Work Unit created or updated ✓ work started ✓ Orb provisioned ✓ OpenCode session started ✓ repository changed ✓ tests executed ✓ branch committed and pushed ✓ pull request opened ✓ work card updated ✓ contextual follow-up reaches the active work
======================================================================
2. HARD SCOPE
====================================================================== 2. HARD SCOPE
======================================================================
This is a narrow dogfooding implementation.
@@ -128,6 +114,7 @@ ProjectIssue may remain the backend representation of a Work Unit for this versi
Project events may represent execution steps and activity.
Project artifacts may represent:
- work.md;
- steps.md;
- agent reports;
@@ -136,8 +123,7 @@ Project artifacts may represent:
- commits;
- pull requests.
======================================================================
3. OPERATING RULES
====================================================================== 3. OPERATING RULES
======================================================================
Before changing anything:
@@ -197,22 +183,18 @@ When an agent is blocked:
Do not stop after spawning agents. You must monitor and integrate them.
======================================================================
4. INITIAL BRANCH PREPARATION
====================================================================== 4. INITIAL BRANCH PREPARATION
======================================================================
Inspect the current branch.
If currently on feat/projects-backend:
git pull --ff-only
git switch -c dogfood/v0
git push -u origin dogfood/v0
git pull --ff-only git switch -c dogfood/v0 git push -u origin dogfood/v0
If dogfood/v0 already exists:
git switch dogfood/v0
git pull --ff-only
git switch dogfood/v0 git pull --ff-only
If the expected branch is different, inspect the repository history and choose the branch containing the current projects backend work. Do not discard existing uncommitted work.
@@ -220,23 +202,20 @@ Run the baseline checks before spawning agents. Record failures but do not spend
Suggested baseline:
bun install
bun run check
bun install bun run check
Also inspect package-specific scripts and use the actual commands defined by the repository.
======================================================================
5. PASEO ORCHESTRATION
====================================================================== 5. PASEO ORCHESTRATION
======================================================================
Verify Paseo first:
paseo status
paseo ls
paseo status paseo ls
If the daemon is unavailable, inspect:
tail -n 200 ~/.paseo/daemon.log
tail -n 200 ~/.paseo/daemon.log
Do not continue spawning until Paseo works.
@@ -245,24 +224,24 @@ For every child lane:
1. Create a worktree workspace:
paseo workspace create \
--isolation worktree \
--mode branch-off \
--new-branch <branch> \
--base dogfood/v0 \
--title "<title>" \
--json
--isolation worktree \
--mode branch-off \
--new-branch <branch> \
--base dogfood/v0 \
--title "<title>" \
--json
2. Read the returned workspaceId.
3. Start the child agent:
paseo run \
--provider codex/glm-5.2 \
--workspace <workspaceId> \
--title "<title>" \
--background \
--json \
"<full lane prompt>"
--provider codex/glm-5.2 \
--workspace <workspaceId> \
--title "<title>" \
--background \
--json \
"<full lane prompt>"
4. Save:
- branch;
@@ -273,33 +252,27 @@ For every child lane:
Maintain an orchestration note in a temporary file outside committed product code, for example:
/tmp/zopu-dogfood-orchestration.md
/tmp/zopu-dogfood-orchestration.md
Track:
| Lane | Branch | Workspace ID | Agent ID | Status | PR |
|------|--------|--------------|----------|--------|----|
| Lane | Branch | Workspace ID | Agent ID | Status | PR |
| ---- | ------ | ------------ | -------- | ------ | --- |
Use:
paseo ls
paseo inspect <agentId>
paseo logs <agentId>
paseo send <agentId> "<focused instruction>"
paseo wait <agentId>
paseo ls paseo inspect <agentId> paseo logs <agentId> paseo send <agentId> "<focused instruction>" paseo wait <agentId>
Do not block waiting on one child while others are still running. Poll all first-wave agents periodically.
======================================================================
6. SHARED CHILD-AGENT PREFIX
====================================================================== 6. SHARED CHILD-AGENT PREFIX
======================================================================
Prepend the following instructions to every child prompt:
You are implementing one isolated lane of the Zopu dogfood v0 loop.
Repository base branch:
dogfood/v0
Repository base branch: dogfood/v0
Your branch is already isolated in a Paseo Git worktree.
@@ -347,29 +320,30 @@ Before finishing:
- PR URL or exact PR creation instructions;
- remaining limitations.
======================================================================
7. FIRST-WAVE PARALLEL LANES
====================================================================== 7. FIRST-WAVE PARALLEL LANES
======================================================================
Spawn all four first-wave agents immediately.
----------------------------------------------------------------------
---
LANE A — PROJECT CHAT, SIGNALS AND WORK ROUTING
----------------------------------------------------------------------
Branch:
dogfood/zopu-orchestrator
dogfood/zopu-orchestrator
Title:
Zopu Signals Orchestrator
Zopu Signals Orchestrator
Prompt:
Implement the project-scoped Zopu chat, Signal extraction and work-routing loop.
Inspect the existing:
- Zopu agent;
- Signals primitive;
- ProjectIssue primitive;
@@ -421,10 +395,10 @@ Rules:
Acceptance examples:
Message:
“The work-unit card should expose the generated PR.”
Message: “The work-unit card should expose the generated PR.”
Expected:
- exact message persisted;
- Signal created;
- attached to an existing UI/workspace issue if relevant;
@@ -449,17 +423,18 @@ Likely ownership:
- packages/backend/convex/schema*
- Signal/project-issue primitives only as required.
----------------------------------------------------------------------
---
LANE B — ORB RUNTIME FOUNDATION
----------------------------------------------------------------------
Branch:
dogfood/orb-runtime
dogfood/orb-runtime
Title:
AgentOS OpenCode Orb Runtime
AgentOS OpenCode Orb Runtime
Prompt:
@@ -525,6 +500,7 @@ Keep product-domain concepts separate from infrastructure leases.
Do not make AgentOS VM state equal the work-unit state.
Actor identity must include:
- project;
- issue/work unit;
- run.
@@ -577,21 +553,23 @@ Document:
- current limitations.
Do not modify:
- Zopu chat behavior;
- project-manager delegation;
- web UI.
----------------------------------------------------------------------
---
LANE C — WEB WORKSPACE AND WORK CARDS
----------------------------------------------------------------------
Branch:
dogfood/web-workspace
dogfood/web-workspace
Title:
Zopu Web Work OS
Zopu Web Work OS
Prompt:
@@ -613,18 +591,21 @@ Product projection:
Required interface:
Header:
- Zopu;
- current project;
- project/runtime connection status;
- basic project switcher if already supported.
Main surface:
- global project conversation;
- active Work Unit cards;
- lightweight Signals display;
- persistent composer.
Collapsed Work Unit card:
- title;
- latest summary;
- linked Signal count;
@@ -635,6 +616,7 @@ Collapsed Work Unit card:
- needs-input indicator when available.
Expanded Work Unit:
- objective;
- linked Signals and provenance;
- current plan or steps;
@@ -705,17 +687,18 @@ Tests:
- empty state;
- needs-input display.
----------------------------------------------------------------------
---
LANE D — SINGLE-NODE EXECUTION DEPLOYMENT
----------------------------------------------------------------------
Branch:
dogfood/runtime-deploy
dogfood/runtime-deploy
Title:
Zopu Dedicated Runtime Deployment
Zopu Dedicated Runtime Deployment
Prompt:
@@ -794,8 +777,7 @@ The deployment must be reproducible on a clean Debian host.
Do not require the developer’s MacBook to remain online after deployment.
======================================================================
8. FIRST-WAVE MONITORING
====================================================================== 8. FIRST-WAVE MONITORING
======================================================================
After spawning all four first-wave agents:
@@ -815,16 +797,15 @@ Use concise interventions.
Examples:
paseo send <agentId> "Keep ProjectIssue as the v0 Work Unit. Do not introduce a second generic work-unit schema."
paseo send <agentId> "Keep ProjectIssue as the v0 Work Unit. Do not introduce a second generic work-unit schema."
paseo send <agentId> "Do not wire project-manager yet. Finish the Orb port, adapter and proof fixture only."
paseo send <agentId> "Do not wire project-manager yet. Finish the Orb port, adapter and proof fixture only."
paseo send <agentId> "Use existing Convex contracts. Avoid backend schema changes in the UI lane."
paseo send <agentId> "Use existing Convex contracts. Avoid backend schema changes in the UI lane."
Wait until each first-wave agent is idle, then inspect:
paseo inspect <agentId>
paseo logs <agentId>
paseo inspect <agentId> paseo logs <agentId>
Review each branch yourself.
@@ -842,8 +823,7 @@ For every lane:
Do not merge a failing lane merely because the child says it works.
======================================================================
9. FIRST-WAVE MERGE PROCESS
====================================================================== 9. FIRST-WAVE MERGE PROCESS
======================================================================
Recommended merge order:
@@ -855,11 +835,7 @@ Recommended merge order:
Before every merge:
git switch dogfood/v0
git pull --ff-only
git fetch origin
git log --oneline --decorate --max-count=10 origin/<branch>
git diff dogfood/v0...origin/<branch>
git switch dogfood/v0 git pull --ff-only git fetch origin git log --oneline --decorate --max-count=10 origin/<branch> git diff dogfood/v0...origin/<branch>
Run lane-specific checks.
@@ -867,31 +843,28 @@ Merge using the repository’s normal PR workflow when possible.
If merging locally:
git merge --no-ff origin/<branch>
git merge --no-ff origin/<branch>
Resolve conflicts conservatively.
After each merge:
bun install
run targeted checks
git push origin dogfood/v0
bun install run targeted checks git push origin dogfood/v0
Do not squash away useful commits unless repository policy requires squashing.
======================================================================
10. SECOND-WAVE LANE — WIRE PROJECT MANAGER TO ORBS
====================================================================== 10. SECOND-WAVE LANE — WIRE PROJECT MANAGER TO ORBS
======================================================================
Only spawn this lane after the Orb runtime branch is integrated into dogfood/v0.
Branch:
dogfood/orb-wiring
dogfood/orb-wiring
Title:
Project Manager Orb Wiring
Project Manager Orb Wiring
Create its Paseo workspace from the updated dogfood/v0 branch.
@@ -944,20 +917,13 @@ Refactor the current Git lifecycle so it can be invoked from the Orb/application
Failure mapping:
- runtime unavailable:
infrastructure failure with clear reason;
- missing user context:
needs input;
- failed tests that can be repaired:
agent continues;
- unrecoverable repeated failure:
failed with logs and evidence;
- cancellation:
terminate OpenCode and sandbox processes;
- Git rejection:
preserve commit and expose exact failure;
- PR creation failure:
retain pushed branch and retry safely.
- runtime unavailable: infrastructure failure with clear reason;
- missing user context: needs input;
- failed tests that can be repaired: agent continues;
- unrecoverable repeated failure: failed with logs and evidence;
- cancellation: terminate OpenCode and sandbox processes;
- Git rejection: preserve commit and expose exact failure;
- PR creation failure: retain pushed branch and retry safely.
Idempotency:
@@ -981,8 +947,7 @@ Tests:
Do not add multi-agent parallel execution.
======================================================================
11. SECOND-WAVE REVIEW AND MERGE
====================================================================== 11. SECOND-WAVE REVIEW AND MERGE
======================================================================
Monitor the orb-wiring agent closely.
@@ -1007,19 +972,18 @@ Review and merge it into dogfood/v0 only after:
- idempotency is demonstrated;
- no secrets appear in logs or artifacts.
======================================================================
12. FINAL LANE — END-TO-END DOGFOOD INTEGRATION
====================================================================== 12. FINAL LANE — END-TO-END DOGFOOD INTEGRATION
======================================================================
After all implementation lanes are merged, spawn the final integration agent.
Branch:
dogfood/e2e-integration
dogfood/e2e-integration
Title:
Zopu Dogfood End-to-End
Zopu Dogfood End-to-End
Prompt:
@@ -1100,7 +1064,7 @@ Verification matrix:
Produce:
docs/DOGFOOD_V0.md
docs/DOGFOOD_V0.md
It must contain:
@@ -1119,8 +1083,7 @@ It must contain:
Commit, push and open a PR targeting dogfood/v0.
======================================================================
13. FINAL INTEGRATION RESPONSIBILITIES
====================================================================== 13. FINAL INTEGRATION RESPONSIBILITIES
======================================================================
After the final agent completes:
@@ -1146,8 +1109,7 @@ If the full live path cannot complete:
The final system must not claim that a PR exists unless it exists in Git.
======================================================================
14. QUALITY GATES
====================================================================== 14. QUALITY GATES
======================================================================
A lane is not done merely because code was generated.
@@ -1184,8 +1146,7 @@ The complete v0 must satisfy:
- PR is created;
- PR is visible in the UI.
======================================================================
15. RESOURCE AND CONCURRENCY LIMITS
====================================================================== 15. RESOURCE AND CONCURRENCY LIMITS
======================================================================
For this v0:
@@ -1201,12 +1162,11 @@ For this v0:
When agents are no longer needed:
paseo archive <agentId>
paseo archive <agentId>
Do not archive them until their logs and work have been reviewed.
======================================================================
16. COMMUNICATION WITH THE USER
====================================================================== 16. COMMUNICATION WITH THE USER
======================================================================
Do not repeatedly ask the user to choose between reasonable implementation details.
@@ -1230,8 +1190,7 @@ When requesting input, provide:
Continue supervising all unblocked lanes while waiting.
======================================================================
17. FINAL REPORT
====================================================================== 17. FINAL REPORT
======================================================================
When finished, provide a concise but complete report:
@@ -1254,6 +1213,7 @@ When finished, provide a concise but complete report:
## Integrated branches
For each branch:
- purpose;
- final commit;
- PR;
+6 -6
View File
@@ -157,12 +157,12 @@ Observe real Work with human decisions, merge outcomes, incidents, and post-rele
Score each candidate run 0–3 per dimension.
| Score | Meaning |
|---|---|
| 0 | unsafe/incorrect/missing |
| 1 | substantial human repair required |
| 2 | acceptable with minor correction |
| 3 | correct, complete, reviewable |
| Score | Meaning |
| ----- | --------------------------------- |
| 0 | unsafe/incorrect/missing |
| 1 | substantial human repair required |
| 2 | acceptable with minor correction |
| 3 | correct, complete, reviewable |
Dimensions:
+1 -1
View File
@@ -3,7 +3,7 @@
> **Purpose:** prevent agents and humans from using overlapping terms inconsistently.
| Term | Definition | Not the same as |
|---|---|---|
| --- | --- | --- |
| Project | Durable product/repository/context boundary. | Work or chat thread |
| Message | Exact conversational input/output. | Signal |
| Signal | Provenanced evidence that may require attention. | Work |
+12 -3
View File
@@ -1,12 +1,11 @@
# Slice 1 Handoff Notes
Date: 2026-07-27
Branch: `master` at `cfdb2efc7`
PR: #19 (merged)
Date: 2026-07-27 Branch: `master` at `cfdb2efc7` PR: #19 (merged)
## What was built
### Core product loop
- Conversation to Signal to proposed Work with exact source provenance.
- Convex owns durable data: `conversationMessages`, `signals`, `works`, `workEvents`.
- Effect validation in `@code/work-os` package.
@@ -15,6 +14,7 @@ PR: #19 (merged)
- Mobile-first UI at `apps/web/src/components/slice-one/slice-one-page.tsx`.
### Model
- MiMo V2.5 (`xiaomi/mimo-v2.5`) via Cheaptricks AI gateway.
- Provider identity `xiaomi` gives Flue correct multimodal metadata (text + image).
- `AGENT_MODEL_BASE_URL` points at Cheaptricks; API key in `.env`.
@@ -22,28 +22,33 @@ PR: #19 (merged)
- `thinkingLevel: "medium"`.
### Reasoning traces
- Native Flue `reasoning` parts render as live "Thinking trace" (open while streaming, collapsed after).
- Inline `<think>...</think>` extraction for models that embed thinking in text.
- No fallback that hides model output.
### Image attachments
- Picker button + hidden file input, up to 4 images at 10 MB each.
- Base64 conversion into Flue `AgentPromptImage`.
- Authenticated blob-URL rendering for historical image replay.
- Verified live: MiMo read exact text and background color from generated test images.
### Mobile keyboard fix
- Visual viewport hook (`use-visual-viewport.ts`).
- Fixed full-screen shell; `interactive-widget=resizes-content` in viewport meta.
- Header stays pinned; chat shrinks; composer follows keyboard.
- Regression tests in `frontend-regressions.test.ts` and `use-visual-viewport.test.ts`.
### Rendering
- Streamdown markdown streaming with Mermaid chart support.
- Tool turns hidden; reasoning-containing tool turns remain visible.
- Work cards render inline in the conversation timeline with source navigation.
### Deployment
- Cheaptricks staging live at `https://zopu.cheaptricks.puter.wtf`.
- Caddy reverse proxy: `/api/*` to Flue (port 3585), root to web (port 5173).
- `server.allowedHosts: true` in `apps/web/vite.config.ts` for Caddy domain.
@@ -52,6 +57,7 @@ PR: #19 (merged)
- Deployment notes at `docs/deployment.md`.
### Repository cleanup
- 17 stale worktrees removed (Codex, Paseo, T3).
- 23 stale local branches deleted.
- 18 stale remote branches deleted.
@@ -62,16 +68,19 @@ PR: #19 (merged)
## Current state
### Running
- Cheaptricks: web on `:5173`, Flue on `:3585`, both persistent via `nohup`.
- Local Mac: servers stopped. Run `bun run dev:tailscale:agents -- --port 3585` and `bun run dev:tailscale:web` to start.
### Git
- `master` at `cfdb2efc7` on local, Cheaptricks, and remote.
- Only `master` branch locally. Two remote branches remain: `origin/sai/changes`, `origin/t3code/explore-primitives-package` (not cleaned because they may be owned by other contributors/tools).
## Known issues and next steps
1. **Convex SITE_URL is single-valued.** Switch it when moving between local and staging:
```bash
cd packages/backend
npx convex env set SITE_URL 'http://100.101.157.28:5173' # local