brainiac-fizzy 0.0.20 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b22cbc7ee87173e942ed06f8c2c913017a58d305938267e72acfb4c4c5e25e84
4
- data.tar.gz: b2408edb59cf13713cd2931233c64d84a9a02a638fb3e3ef88ec155bf03c9397
3
+ metadata.gz: 55c60df15ffb87640dfbfce7a3dd64033bdf14a6c551e2269fb252468a96e4bb
4
+ data.tar.gz: cc1eb7dad2215000df5fd608f12a54ee0246e5474f19b03dcc3a98716d3d76f8
5
5
  SHA512:
6
- metadata.gz: 5b751238e7115a6d3f375878eb2f68fb4c5b95b004587edd826f8652108fe771598ab9940b85a0f4d567d2a356753148cdd50fe9b1cf02f5752739773c259213
7
- data.tar.gz: 8438490f58ee985aa9953a20d0727c36ffde30abd5b677f343a295d2eb80d68a759efc0772f0175bdf426fd811c79560082ef1b72ef128b42addb6901ee49436
6
+ metadata.gz: 1fa2208a211311ce53f677da3ff14786f154b506c457659ee026afc08f9495d78737282361f737d2fabc3a4474d3f11bc9f8c0e2e8a06aae90b8e8a1b63a9256
7
+ data.tar.gz: fb6d51f31357250bd28c0f3d58d6115fc379afafa117316b17095e6576068a45e5a0524232acc997c9eaef5a56c2d762d42b04e57dede7b19e6c813642720ae6
@@ -44,7 +44,7 @@ def handle_card_assigned(payload, board_key: nil)
44
44
  "creating worktree: #{branch} (model: #{detect_model(project_config, tags: tags) || "default"})"
45
45
 
46
46
  react_to_assignment(card_number, repo_path, assigned_agent)
47
- worktree_path = setup_assigned_worktree(repo_path, branch, card_internal_id, card_number, project_key, assigned_agent)
47
+ worktree_path = setup_assigned_worktree(repo_path, branch, card_internal_id, card_number, project_key, assigned_agent, board_key: board_key)
48
48
 
49
49
  initial_cli = detect_cli_provider(tags: tags)
50
50
  initial_model = detect_model(project_config, tags: tags)
@@ -110,14 +110,17 @@ def react_to_assignment(card_number, repo_path, agent_name)
110
110
  end
111
111
  end
112
112
 
113
- def setup_assigned_worktree(repo_path, branch, card_internal_id, card_number, project_key, agent_name)
113
+ def setup_assigned_worktree(repo_path, branch, card_internal_id, card_number, project_key, agent_name, board_key: nil)
114
114
  debounced_repo_fetch(repo_path)
115
115
  worktree_path = File.join(File.dirname(repo_path), "#{File.basename(repo_path)}--#{branch}")
116
116
  worktree_path = create_or_reuse_worktree(repo_path: repo_path, branch: branch, worktree_path: worktree_path)
117
117
 
118
+ source_data = { "card_internal_id" => card_internal_id, "card_number" => card_number }
119
+ source_data["board_key"] = board_key if board_key
120
+
118
121
  register_work_item(
119
122
  branch: branch, worktree: worktree_path, project: project_key, agent: agent_name,
120
- source: :fizzy, source_data: { "card_internal_id" => card_internal_id, "card_number" => card_number }
123
+ source: :fizzy, source_data: source_data
121
124
  )
122
125
  worktree_path
123
126
  end
@@ -499,9 +499,12 @@ def setup_new_mention_worktree(ctx, card_number, card_title)
499
499
  repo_path = ctx.project_config["repo_path"]
500
500
  worktree_path, branch = resolve_or_create_worktree(ctx, card_number, card_title, repo_path)
501
501
 
502
+ source_data = { "card_internal_id" => ctx.card_internal_id, "card_number" => card_number }
503
+ source_data["board_key"] = ctx.board_key if ctx.board_key
504
+
502
505
  register_work_item(
503
506
  branch: branch, worktree: worktree_path, project: ctx.project_key, agent: ctx.agent_name,
504
- source: :fizzy, source_data: { "card_internal_id" => ctx.card_internal_id, "card_number" => card_number }
507
+ source: :fizzy, source_data: source_data
505
508
  )
506
509
 
507
510
  [worktree_path, branch]
@@ -111,14 +111,14 @@ module Brainiac
111
111
  project_config)
112
112
  Thread.new do
113
113
  wait_for_process_or_timeout(pid, timeout: 60)
114
- sleep 2 # Brief pause to let any comment propagate
114
+ sleep 5 # Wait for Fizzy API propagation before checking
115
115
 
116
116
  unless agent_commented_on_card?(card_number, agent_name, repo_path: repo_path, since: session_started_at)
117
117
  post_fallback_comment(card_number, branch, agent_name, project_config)
118
118
  end
119
119
  rescue Errno::ECHILD
120
120
  # Process already reaped by session manager — check for comment
121
- sleep 2
121
+ sleep 5
122
122
  unless agent_commented_on_card?(card_number, agent_name, repo_path: repo_path, since: session_started_at)
123
123
  post_fallback_comment(card_number, branch, agent_name, project_config)
124
124
  end
@@ -48,6 +48,17 @@ module Brainiac
48
48
  agent_name: ctx[:agent_name],
49
49
  since: ctx[:source_context]&.dig(:dispatched_at))
50
50
 
51
+ # Retry once after a short delay to account for Fizzy API propagation.
52
+ # The agent may have posted its comment just before exiting, and the API
53
+ # might not return it immediately in a list call.
54
+ if !found_comment
55
+ sleep 5
56
+ found_comment = Helpers.append_fizzy_comment_footer(card_number,
57
+ project_config: ctx[:project_config],
58
+ agent_name: ctx[:agent_name],
59
+ since: ctx[:source_context]&.dig(:dispatched_at))
60
+ end
61
+
51
62
  # If the agent didn't post any comment during this session, re-dispatch to summarize from memory.
52
63
  # Uses dispatched_at from source_context to only check for comments made during THIS session,
53
64
  # not previous sessions on the same card.
@@ -130,6 +141,7 @@ module Brainiac
130
141
  card_agent = card_info["agent"]
131
142
  env = Helpers.fizzy_env_for(card_agent)
132
143
  repo_path = ctx[:repo_path]
144
+ board_key = card_info.dig("sources", "fizzy", "board_key") || Config.board_key_for_project(ctx[:project_config])
133
145
 
134
146
  # Post PR link comment
135
147
  pr_url = ctx[:pr_url]
@@ -143,7 +155,8 @@ module Brainiac
143
155
  # Move card to UAT
144
156
  Helpers.move_card_to_column(card_number, "uat",
145
157
  project_config: ctx[:project_config],
146
- agent_name: card_agent)
158
+ agent_name: card_agent,
159
+ board_key: board_key)
147
160
  record_self_move(card_number)
148
161
 
149
162
  # Clear deployment tracking
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Fizzy
6
- VERSION = "0.0.20"
6
+ VERSION = "0.0.22"
7
7
  end
8
8
  end
9
9
  end
@@ -171,6 +171,27 @@ module Brainiac
171
171
  LOG.info "[Fizzy:Deploy] #{env_key} marked deploying via API"
172
172
  { status: "deploying", env: env_key }.to_json
173
173
  end
174
+
175
+ app.post "/api/deployments/:env/failed" do
176
+ content_type :json
177
+ env_key = params["env"]
178
+ config = DEPLOYMENTS_CONFIG["environments"] || {}
179
+ halt 404, { error: "Unknown environment: #{env_key}" }.to_json unless config.key?(env_key)
180
+ request.body.rewind
181
+ payload = begin
182
+ JSON.parse(request.body.read)
183
+ rescue StandardError
184
+ {}
185
+ end
186
+ state = load_deployment_state
187
+ state[env_key] ||= {}
188
+ state[env_key]["last_deploy_status"] = "failed"
189
+ state[env_key]["last_deploy_at"] = Time.now.iso8601
190
+ save_deployment_state(state)
191
+ DEPLOYMENT_STATE.replace(state)
192
+ LOG.info "[Fizzy:Deploy] #{env_key} marked failed via API"
193
+ { status: "failed", env: env_key }.to_json
194
+ end
174
195
  end
175
196
 
176
197
  public
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainiac-fizzy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis