Skip to content

Commit adc3b9c

Browse files
author
Ambient Code Bot
committed
chore: merge main into alpha (20260330-123045) [conflicts require resolution]
Automated merge of upstream/main into upstream/alpha. Conflict markers are present in files below. A human must resolve these before merging this PR. Commits from main not yet in alpha: 10 merge-base: f1f5bb1 Generated by scripts/rebase-main-to-alpha.sh on 20260330-123045.
2 parents 7c7ea1b + 595d790 commit adc3b9c

17 files changed

Lines changed: 756 additions & 342 deletions

.github/workflows/ci-failure-resolver-with-agent.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
9090
- name: Checkout & label
9191
if: steps.analyze.outputs.action == 'fix'
92-
uses: actions/checkout@v4
92+
uses: actions/checkout@v6
9393
with:
9494
ref: refs/pull/${{ matrix.pr }}/head
9595
fetch-depth: 0

.github/workflows/components-build-deploy.yml

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build and Push Component Docker Images
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, alpha]
66
paths:
77
- '.github/workflows/components-build-deploy.yml'
88
- 'components/manifests/**'
@@ -15,7 +15,7 @@ on:
1515
- 'components/ambient-control-plane/**'
1616
- 'components/ambient-mcp/**'
1717
pull_request:
18-
branches: [main]
18+
branches: [main, alpha]
1919
paths:
2020
- '.github/workflows/components-build-deploy.yml'
2121
- 'components/manifests/**'
@@ -29,11 +29,6 @@ on:
2929
- 'components/ambient-mcp/**'
3030
workflow_dispatch:
3131
inputs:
32-
force_build_all:
33-
description: 'Force rebuild all components'
34-
required: false
35-
type: boolean
36-
default: false
3732
components:
3833
description: 'Components to build (comma-separated: frontend,backend,operator,ambient-runner,state-sync,public-api,ambient-api-server,ambient-control-plane,ambient-mcp) - leave empty for all'
3934
required: false
@@ -107,42 +102,27 @@ jobs:
107102
{"name":"ambient-mcp","context":"./components/ambient-mcp","image":"quay.io/ambient_code/vteam_mcp","dockerfile":"./components/ambient-mcp/Dockerfile"}
108103
]'
109104
110-
FORCE_ALL="${{ github.event.inputs.force_build_all }}"
111105
SELECTED="${{ github.event.inputs.components }}"
112-
EVENT="${{ github.event_name }}"
113-
114-
# Map component names to paths-filter output names
115-
# (ambient-runner uses claude-runner filter)
116-
declare -A FILTER_MAP=(
117-
[frontend]="${{ steps.filter.outputs.frontend }}"
118-
[backend]="${{ steps.filter.outputs.backend }}"
119-
[operator]="${{ steps.filter.outputs.operator }}"
120-
[ambient-runner]="${{ steps.filter.outputs.claude-runner }}"
121-
[state-sync]="${{ steps.filter.outputs.state-sync }}"
122-
[public-api]="${{ steps.filter.outputs.public-api }}"
123-
[ambient-api-server]="${{ steps.filter.outputs.ambient-api-server }}"
124-
)
125-
126-
if [ "$FORCE_ALL" == "true" ]; then
127-
# Force build all
128-
FILTERED="$ALL_COMPONENTS"
129-
elif [ "$EVENT" == "workflow_dispatch" ] && [ -z "$SELECTED" ] && [ "$FORCE_ALL" != "true" ]; then
130-
# Dispatch with no selection and no force — build all
131-
FILTERED="$ALL_COMPONENTS"
132-
elif [ -n "$SELECTED" ]; then
106+
107+
if [ -n "$SELECTED" ]; then
133108
# Dispatch with specific components
134109
FILTERED=$(echo "$ALL_COMPONENTS" | jq -c --arg sel "$SELECTED" '[.[] | select(.name as $n | $sel | split(",") | map(gsub("^\\s+|\\s+$";"")) | index($n))]')
135110
elif [ "$EVENT" == "pull_request" ]; then
136111
# PR — always build all components so every PR image is in quay for deployment
137112
FILTERED="$ALL_COMPONENTS"
138113
else
114+
<<<<<<< HEAD
139115
# Push to main — only changed components
140116
FILTERED="[]"
141117
for comp in $(echo "$ALL_COMPONENTS" | jq -r '.[].name'); do
142118
if [ "${FILTER_MAP[$comp]}" == "true" ]; then
143119
FILTERED=$(echo "$FILTERED" | jq -c --arg name "$comp" --argjson all "$ALL_COMPONENTS" '. + [$all[] | select(.name == $name)]')
144120
fi
145121
done
122+
=======
123+
# Build all components — cache makes unchanged components fast
124+
FILTERED="$ALL_COMPONENTS"
125+
>>>>>>> upstream/main
146126
fi
147127

148128
# Build matrix includes context/dockerfile; merge matrix only needs name/image
@@ -215,23 +195,28 @@ jobs:
215195
cache-from: type=gha,scope=${{ matrix.component.name }}-${{ matrix.arch.suffix }}
216196
cache-to: type=gha,mode=max,scope=${{ matrix.component.name }}-${{ matrix.arch.suffix }}
217197

218-
- name: Build ${{ matrix.component.name }} (${{ matrix.arch.suffix }}) for pull request
198+
- name: Build and push ${{ matrix.component.name }} (${{ matrix.arch.suffix }}) for pull request
219199
if: github.event_name == 'pull_request'
220200
uses: docker/build-push-action@v7
221201
with:
222202
context: ${{ matrix.component.context }}
223203
file: ${{ matrix.component.dockerfile }}
224204
platforms: ${{ matrix.arch.platform }}
225205
push: true
206+
<<<<<<< HEAD
226207
tags: |
227208
${{ matrix.component.image }}:pr-${{ github.event.pull_request.number }}-${{ matrix.arch.suffix }}
228209
${{ matrix.component.image }}:pr-${{ github.event.pull_request.number }}-${{ github.sha }}-${{ matrix.arch.suffix }}
210+
=======
211+
tags: ${{ matrix.component.image }}:pr-${{ github.event.pull_request.number }}-${{ matrix.arch.suffix }}
212+
>>>>>>> upstream/main
229213
build-args: AMBIENT_VERSION=${{ github.sha }}
230214
cache-from: type=gha,scope=${{ matrix.component.name }}-${{ matrix.arch.suffix }}
215+
cache-to: type=gha,mode=max,scope=${{ matrix.component.name }}-${{ matrix.arch.suffix }}
231216

232217
merge-manifests:
233218
needs: [detect-changes, build]
234-
if: github.event_name != 'pull_request' && needs.detect-changes.outputs.has-builds == 'true'
219+
if: needs.detect-changes.outputs.has-builds == 'true'
235220
runs-on: ubuntu-latest
236221
permissions:
237222
contents: read
@@ -251,7 +236,8 @@ jobs:
251236
username: ${{ secrets.QUAY_USERNAME }}
252237
password: ${{ secrets.QUAY_PASSWORD }}
253238

254-
- name: Create multi-arch manifest for ${{ matrix.component.name }}
239+
- name: Create multi-arch manifest for ${{ matrix.component.name }} (main)
240+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
255241
# Suffixes (-amd64, -arm64) must match the arch matrix in the build job above.
256242
# Arch-suffixed tags remain in the registry after merging. Clean these up
257243
# via Quay tag expiration policies or a periodic job.
@@ -263,6 +249,23 @@ jobs:
263249
${{ matrix.component.image }}:${{ github.sha }}-amd64 \
264250
${{ matrix.component.image }}:${{ github.sha }}-arm64
265251
252+
- name: Create multi-arch manifest for ${{ matrix.component.name }} (alpha)
253+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/alpha'
254+
run: |
255+
docker buildx imagetools create \
256+
-t ${{ matrix.component.image }}:alpha \
257+
-t ${{ matrix.component.image }}:${{ github.sha }} \
258+
${{ matrix.component.image }}:${{ github.sha }}-amd64 \
259+
${{ matrix.component.image }}:${{ github.sha }}-arm64
260+
261+
- name: Create multi-arch manifest for ${{ matrix.component.name }} (pull request)
262+
if: github.event_name == 'pull_request'
263+
run: |
264+
docker buildx imagetools create \
265+
-t ${{ matrix.component.image }}:pr-${{ github.event.pull_request.number }} \
266+
${{ matrix.component.image }}:pr-${{ github.event.pull_request.number }}-amd64 \
267+
${{ matrix.component.image }}:pr-${{ github.event.pull_request.number }}-arm64
268+
266269
update-rbac-and-crd:
267270
runs-on: ubuntu-latest
268271
needs: [detect-changes, merge-manifests]

.github/workflows/feedback-loop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
steps:
3838
- name: Checkout repository
39-
uses: actions/checkout@v4
39+
uses: actions/checkout@v6
4040

4141
- name: Set up Python
4242
uses: actions/setup-python@v6
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
name: Sync Alpha from Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
concurrency:
13+
group: sync-alpha-from-main
14+
cancel-in-progress: false
15+
16+
jobs:
17+
sync:
18+
name: Rebase main into alpha
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 15
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+
with:
26+
fetch-depth: 0
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Configure git
30+
run: |
31+
git config user.name "github-actions[bot]"
32+
git config user.email "github-actions[bot]@users.noreply.github.com"
33+
34+
- name: Check if alpha is already up to date
35+
id: check
36+
run: |
37+
MAIN_SHA="$(git rev-parse origin/main)"
38+
ALPHA_SHA="$(git rev-parse origin/alpha)"
39+
COMMIT_COUNT="$(git rev-list --count "${ALPHA_SHA}..${MAIN_SHA}")"
40+
41+
echo "main_sha=${MAIN_SHA}" >> "$GITHUB_OUTPUT"
42+
echo "alpha_sha=${ALPHA_SHA}" >> "$GITHUB_OUTPUT"
43+
echo "commit_count=${COMMIT_COUNT}" >> "$GITHUB_OUTPUT"
44+
45+
if [ "${COMMIT_COUNT}" -eq 0 ]; then
46+
echo "needs_sync=false" >> "$GITHUB_OUTPUT"
47+
echo "alpha is already up to date with main"
48+
else
49+
echo "needs_sync=true" >> "$GITHUB_OUTPUT"
50+
echo "Commits in main not in alpha: ${COMMIT_COUNT}"
51+
fi
52+
53+
- name: Check for existing open sync PR
54+
if: steps.check.outputs.needs_sync == 'true'
55+
id: existing_pr
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
run: |
59+
EXISTING=$(gh pr list \
60+
--base alpha \
61+
--state open \
62+
--json headRefName \
63+
--jq '[.[] | select(.headRefName | startswith("chore/sync-alpha-from-main-"))] | length')
64+
65+
if [ "${EXISTING}" -gt 0 ]; then
66+
echo "Open sync PR already exists — skipping"
67+
echo "pr_exists=true" >> "$GITHUB_OUTPUT"
68+
else
69+
echo "pr_exists=false" >> "$GITHUB_OUTPUT"
70+
fi
71+
72+
- name: Create work branch off alpha
73+
if: steps.check.outputs.needs_sync == 'true' && steps.existing_pr.outputs.pr_exists == 'false'
74+
id: branch
75+
run: |
76+
TIMESTAMP="$(date +%Y%m%d-%H%M%S)"
77+
WORK_BRANCH="chore/sync-alpha-from-main-${TIMESTAMP}"
78+
echo "work_branch=${WORK_BRANCH}" >> "$GITHUB_OUTPUT"
79+
80+
git checkout -b "${WORK_BRANCH}" origin/alpha
81+
echo "Created ${WORK_BRANCH} from origin/alpha"
82+
83+
- name: Attempt rebase of main onto work branch
84+
if: steps.check.outputs.needs_sync == 'true' && steps.existing_pr.outputs.pr_exists == 'false'
85+
id: rebase
86+
env:
87+
WORK_BRANCH: ${{ steps.branch.outputs.work_branch }}
88+
MAIN_SHA: ${{ steps.check.outputs.main_sha }}
89+
ALPHA_SHA: ${{ steps.check.outputs.alpha_sha }}
90+
run: |
91+
MERGE_BASE="$(git merge-base "${ALPHA_SHA}" "${MAIN_SHA}")"
92+
93+
git rebase --onto "${WORK_BRANCH}" "${MERGE_BASE}" origin/main && {
94+
echo "rebase_clean=true" >> "$GITHUB_OUTPUT"
95+
git checkout -B "${WORK_BRANCH}"
96+
echo "Rebase completed cleanly"
97+
} || {
98+
echo "rebase_clean=false" >> "$GITHUB_OUTPUT"
99+
git rebase --abort 2>/dev/null || true
100+
101+
echo "Rebase had conflicts — falling back to merge"
102+
MERGE_MSG=$(cat <<'MSG'
103+
chore: merge main into alpha (conflict resolution required)
104+
105+
Automated merge of origin/main into origin/alpha.
106+
Rebase encountered conflicts; falling back to merge.
107+
A human must resolve conflict markers before merging this PR.
108+
MSG
109+
)
110+
git merge --no-ff --allow-unrelated-histories origin/main -m "${MERGE_MSG}" || {
111+
git add -A
112+
CONFLICT_MSG=$(cat <<'MSG'
113+
chore: best-effort merge main into alpha (conflicts present)
114+
115+
Automated merge of origin/main into origin/alpha.
116+
Both rebase and merge encountered conflicts. Conflict markers
117+
are present and must be resolved before this PR can be merged.
118+
MSG
119+
)
120+
git commit --no-verify -m "${CONFLICT_MSG}"
121+
}
122+
}
123+
124+
- name: Push work branch
125+
if: steps.check.outputs.needs_sync == 'true' && steps.existing_pr.outputs.pr_exists == 'false'
126+
env:
127+
WORK_BRANCH: ${{ steps.branch.outputs.work_branch }}
128+
run: |
129+
git push origin "${WORK_BRANCH}"
130+
131+
- name: Open PR against alpha
132+
if: steps.check.outputs.needs_sync == 'true' && steps.existing_pr.outputs.pr_exists == 'false'
133+
env:
134+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135+
WORK_BRANCH: ${{ steps.branch.outputs.work_branch }}
136+
COMMIT_COUNT: ${{ steps.check.outputs.commit_count }}
137+
REBASE_CLEAN: ${{ steps.rebase.outputs.rebase_clean }}
138+
MAIN_SHA: ${{ steps.check.outputs.main_sha }}
139+
ALPHA_SHA: ${{ steps.check.outputs.alpha_sha }}
140+
run: |
141+
if [ "${REBASE_CLEAN}" = "true" ]; then
142+
CONFLICT_NOTE="Rebase completed cleanly — no conflicts detected. This PR can be merged directly."
143+
else
144+
CONFLICT_NOTE="⚠️ **Conflicts detected.** Rebase fell back to merge. Search for \`<<<<<<<\` conflict markers and resolve before merging."
145+
fi
146+
147+
gh pr create \
148+
--base alpha \
149+
--head "${WORK_BRANCH}" \
150+
--title "chore: sync alpha from main ($(date +%Y-%m-%d))" \
151+
--body "## Summary
152+
153+
Automated sync of \`main\` into \`alpha\` triggered by push to \`main\`.
154+
155+
| | |
156+
|---|---|
157+
| Commits synced | ${COMMIT_COUNT} |
158+
| origin/main | \`${MAIN_SHA:0:8}\` |
159+
| origin/alpha | \`${ALPHA_SHA:0:8}\` |
160+
161+
## Status
162+
163+
${CONFLICT_NOTE}
164+
165+
## Review Instructions
166+
167+
1. Check for conflict markers (\`<<<<<<<\`) in changed files.
168+
2. Resolve any conflicts and push to this branch.
169+
3. Verify the build passes.
170+
4. Merge into \`alpha\`.
171+
172+
---
173+
*Auto-generated by \`.github/workflows/sync-alpha-from-main.yml\`*"
174+
175+
- name: Summary
176+
if: always()
177+
env:
178+
NEEDS_SYNC: ${{ steps.check.outputs.needs_sync }}
179+
PR_EXISTS: ${{ steps.existing_pr.outputs.pr_exists || 'false' }}
180+
COMMIT_COUNT: ${{ steps.check.outputs.commit_count || '0' }}
181+
REBASE_CLEAN: ${{ steps.rebase.outputs.rebase_clean || 'n/a' }}
182+
JOB_STATUS: ${{ job.status }}
183+
run: |
184+
if [ "${NEEDS_SYNC}" = "false" ]; then
185+
echo "## ✅ Already in sync" >> "$GITHUB_STEP_SUMMARY"
186+
echo "alpha is up to date with main — nothing to do." >> "$GITHUB_STEP_SUMMARY"
187+
elif [ "${PR_EXISTS}" = "true" ]; then
188+
echo "## ℹ️ Sync PR already open" >> "$GITHUB_STEP_SUMMARY"
189+
echo "An open sync PR already exists against alpha — skipped." >> "$GITHUB_STEP_SUMMARY"
190+
elif [ "${JOB_STATUS}" = "failure" ]; then
191+
echo "## ❌ Sync failed" >> "$GITHUB_STEP_SUMMARY"
192+
echo "Check the logs above for details." >> "$GITHUB_STEP_SUMMARY"
193+
elif [ "${REBASE_CLEAN}" = "true" ]; then
194+
echo "## ✅ PR opened — clean rebase" >> "$GITHUB_STEP_SUMMARY"
195+
echo "${COMMIT_COUNT} commits synced from main to alpha with no conflicts." >> "$GITHUB_STEP_SUMMARY"
196+
else
197+
echo "## ⚠️ PR opened — conflicts require resolution" >> "$GITHUB_STEP_SUMMARY"
198+
echo "${COMMIT_COUNT} commits from main; rebase had conflicts. PR opened for human resolution." >> "$GITHUB_STEP_SUMMARY"
199+
fi

0 commit comments

Comments
 (0)