Skip to content

Fix FBI integration gaps: branch ID, user branch, title pipeline#4

Merged
fdatoo merged 3 commits intomainfrom
fix/fbi-integration-gaps
Apr 30, 2026
Merged

Fix FBI integration gaps: branch ID, user branch, title pipeline#4
fdatoo merged 3 commits intomainfrom
fix/fbi-integration-gaps

Conversation

@fdatoo
Copy link
Copy Markdown
Owner

@fdatoo fdatoo commented Apr 30, 2026

Summary

  • Branch name uses timestamp instead of run IDinsert_run now does a two-step INSERT+UPDATE so branch_name is claude/run-37 not claude/run-1777542730698
  • User-provided branch silently droppedcreate handler now decodes branch, mock, mock_scenario, and force; added 409 branch_in_use check; user-supplied branch is passed through to the DB and container env
  • Claude never renamed branches or set titles — added a preamble.txt injected into every fresh run instructing Claude to write /fbi-state/title and rename claude/run-* branches; also wired up global.txt from settings.global_prompt
  • Title never saved to DBfinalizeBranch.sh now reads /fbi-state/title and includes it in result.json; container_monitor and reattach decode it; mark_finished writes it (and the final branch name) back via COALESCE

Test plan

  • Create a run without a branch — confirm branch_name in DB is claude/run-<id> (small integer), not a timestamp
  • Create a run with branch: "feat/my-feature" — confirm the container starts on that branch and the DB reflects it
  • Create two runs with the same explicit branch — confirm the second gets a 409 branch_in_use; confirm force: true bypasses it
  • Let a run complete — confirm title column is populated (Claude writes to /fbi-state/title per preamble), and branch_name reflects any rename Claude performed
  • Create a mock run — confirm mock=true and mock_scenario are persisted and do_mock_launch is reached

🤖 Generated with Claude Code

- db/runs.gleam: insert_run now does a two-step INSERT+UPDATE so
  branch_name uses the actual auto-increment run ID (claude/run-37)
  instead of the millisecond timestamp (claude/run-1777542730698).
  Added branch/mock/mock_scenario params and branch_in_use() helper.
  mark_finished now updates branch_name and title via COALESCE so
  renames from the agent propagate back to the DB.

- handlers/runs.gleam: create decoder now accepts branch, mock,
  mock_scenario, force; performs 409 branch-in-use check for explicit
  branches; fetches settings.global_prompt and passes it through
  LaunchInput. do_continue likewise passes global_prompt.

- worker.gleam: LaunchInput gains global_prompt field; build_preamble
  now emits preamble.txt (FBI setup instructions: write title to
  /fbi-state/title, rename claude/run-* branch) and global.txt.

- finalizeBranch.sh: reads /fbi-state/title (stripping newlines, capped
  at 200 chars) and includes it as "title" in result.json.

- container_monitor.gleam, reattach.gleam: decode "title" from
  result.json and populate RunOutcome.title instead of always None.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fdatoo fdatoo force-pushed the fix/fbi-integration-gaps branch from e69d9a4 to 3200e1a Compare April 30, 2026 12:40
fdatoo and others added 2 commits April 30, 2026 12:49
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fdatoo fdatoo merged commit c457d70 into main Apr 30, 2026
5 checks passed
@fdatoo fdatoo deleted the fix/fbi-integration-gaps branch April 30, 2026 12:59
fdatoo added a commit that referenced this pull request Apr 30, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant