sync(upstream): primera sincronizacion segura con OpenCode (Issue #41) - #42
Conversation
…evision (Issue #41) - scripts/upstream-report.py: ahead/behind + commits candidatos con deteccion de excluibles (generate, workflows, deps) - con tests unittest (10) - .github/workflows/upstream-report.yml: cron semanal que publica el informe como issue/comentario sin auto-merge - docs/UPSTREAM_SYNC.md: checklist de 4 categorias + procedimiento (nunca sync directo sobre dev)
Reviewer's GuideImplements the first safe upstream sync with OpenCode via three cherry-picked fixes (directory picker, config parsing, stats sync robustness), adds tooling for automated upstream reports (Python script, tests, GitHub Actions workflow, and documentation), and adjusts a few stats and Athena polling parameters, while keeping workflows, generated contracts, visible strings, and dependencies within defined policy. Sequence diagram for the weekly upstream-report GitHub workflowsequenceDiagram
participant GitHubActions as GitHubActions
participant Repo as JarvisRepo
participant Upstream as UpstreamRepo
participant Script as upstream-report.py
participant gh as gh_cli
participant Issues as GitHubIssues
GitHubActions->>Repo: actions/checkout (fetch-depth 0)
GitHubActions->>Repo: git remote add upstream https://github.com/sst/opencode.git
GitHubActions->>Script: python scripts/upstream-report.py
Script->>Upstream: git fetch upstream dev
Script->>Repo: git rev-list --left-right --count upstream/dev...HEAD
Script->>Upstream: git log --oneline upstream/dev ^HEAD
Script->>Upstream: git diff-tree --name-only -r <sha>
Script-->>GitHubActions: markdown report to stdout
GitHubActions->>gh: gh issue list (search existing "Informe upstream (semanal)")
alt existing_issue
GitHubActions->>gh: gh issue comment --body-file /tmp/upstream-report.md
gh->>Issues: add comment to existing report issue
else no_existing_issue
GitHubActions->>gh: gh issue create --title "Informe upstream (semanal)" --body-file /tmp/upstream-report.md --label upstream
gh->>Issues: create new upstream report issue
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
The PR addresses Issue #41 by implementing upstream synchronization infrastructure and includes several bug fixes. All changes have been reviewed and no blocking issues were found. The implementation correctly handles the documented sync workflow, error handling, and configuration updates.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
scripts/upstream-report.py, theGENERATED_ARTIFACTSconstant is declared but never used; either wire it intoclassify_commitor remove it to avoid dead configuration that can drift from actual policy. - The
upstream-reportworkflow unconditionally runsgit remote add upstream ..., which will fail on subsequent runs if the remote already exists; consider guarding this with a check or appending|| trueto make the step idempotent. - The change to
ConfigParse.schemausesonExcessProperty: "ignore"for all schemas, which will silently drop unknown nested properties as well as top-level ones; if the intent is only to relax top-level keys, you may want to scope the ignore behavior to those cases to avoid hiding misconfigurations deeper in the structure.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `scripts/upstream-report.py`, the `GENERATED_ARTIFACTS` constant is declared but never used; either wire it into `classify_commit` or remove it to avoid dead configuration that can drift from actual policy.
- The `upstream-report` workflow unconditionally runs `git remote add upstream ...`, which will fail on subsequent runs if the remote already exists; consider guarding this with a check or appending `|| true` to make the step idempotent.
- The change to `ConfigParse.schema` uses `onExcessProperty: "ignore"` for all schemas, which will silently drop unknown nested properties as well as top-level ones; if the intent is only to relax top-level keys, you may want to scope the ignore behavior to those cases to avoid hiding misconfigurations deeper in the structure.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
PR Summary by QodoSync upstream #41: cherry-pick fixes + upstream report tooling
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo
1. Workflow uses sst/opencode URL
|
| - name: Añadir remote upstream | ||
| run: git remote add upstream https://github.com/sst/opencode.git | ||
|
|
There was a problem hiding this comment.
1. Workflow uses sst/opencode url 📘 Rule violation § Compliance
The new GitHub Actions workflow references https://github.com/sst/opencode.git, which is explicitly disallowed in CI workflow files. This can reintroduce deprecated upstream repo references in CI configuration.
Agent Prompt
## Issue description
The workflow file contains a deprecated opencode repo reference (`sst/opencode`), which is disallowed by the compliance checklist.
## Issue Context
This reference appears in the `git remote add upstream ...` step. Per the rule, CI workflow files must not include `sst/opencode` (or `anomalyco/opencode`) anywhere in their content.
## Fix Focus Areas
- .github/workflows/upstream-report.yml[30-32]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| ISSUE=$(gh issue list --search "in:title \"Informe upstream (semanal)\"" --state open \ | ||
| --json number --jq '.[0].number' 2>/dev/null || true) | ||
| if [ -z "$ISSUE" ]; then |
There was a problem hiding this comment.
2. Issue null en workflow 🐞 Bug ☼ Reliability
El workflow puede asignar a ISSUE el literal null cuando no hay ningún issue abierto que matchee el search, y entonces intenta gh issue comment "null", fallando en vez de crear el issue del informe. Esto rompe el flujo create-or-comment en la primera ejecución o si el issue se cierra/renombra.
Agent Prompt
### Issue description
The workflow assigns `ISSUE` using `--jq '.[0].number'`. When the list is empty, jq can output `null`, which is non-empty, so the script goes to the comment path and runs `gh issue comment "null"`, failing instead of creating the report issue.
### Issue Context
This breaks the scheduled/manual report publishing flow whenever there is no open issue matching the title search.
### Fix Focus Areas
- .github/workflows/upstream-report.yml[42-50]
### Implementation notes
- Change jq to emit an empty string when missing, e.g.:
- `--jq '.[0].number // empty'`
- Or explicitly treat `null` as empty:
- `if [ -z "$ISSUE" ] || [ "$ISSUE" = "null" ]; then ...`
- (Optional) tighten the search (e.g., also filter by label) to reduce the chance of matching the wrong issue.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| const decoded = EffectSchema.decodeUnknownExit(schema)(data, { | ||
| errors: "all", | ||
| onExcessProperty: "ignore", | ||
| propertyOrder: "original", | ||
| }) |
There was a problem hiding this comment.
3. Typos de config silenciados 🐞 Bug ☼ Reliability
ConfigParse.schema ahora decodifica con onExcessProperty: "ignore", lo que descarta silenciosamente campos desconocidos en toda la estructura (incluyendo objetos anidados), pudiendo ocultar typos como server.portt y haciendo que la config no se aplique sin error. Esto reduce la detectabilidad de configuraciones mal escritas y puede causar comportamiento inesperado por defaults.
Agent Prompt
### Issue description
Config parsing now uses `onExcessProperty: "ignore"`, which can ignore unknown properties recursively, not just at the root. This can silently drop typos in nested config sections.
### Issue Context
The PR intent (per tests/docs) mentions ignoring unknown **top-level** keys for forward compatibility, but the current implementation can also ignore nested unknown keys in strict sub-schemas.
### Fix Focus Areas
- packages/opencode/src/config/parse.ts[35-60]
### Implementation notes
Pick one policy and enforce it explicitly:
- **If only top-level should be tolerant**: strip/ignore unknown keys at the root only, then decode with strict excess-property behavior for nested objects.
- Example approach: detect root extra keys, remove them from `data` before decoding, and do not set `onExcessProperty: "ignore"`.
- **If all levels should be tolerant** (intended): add/adjust tests to cover a nested typo (e.g., `server: { portt: 3000 }`) and document the behavior clearly, since it’s a significant validation change.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
El informe enumeraba commits pendientes por SHA, incluyendo 3 ya cherry-picked en PR #42 (mismo patch, SHA diferente): behind inflado 12→9, candidatos falsos en issue #52. Fix: reemplaza git log/rev-list por --cherry-pick --left-only que usa patch-id para excluir commits incorporados. Validado con --no-fetch: behind=9, candidates=7/9 (2 excluidos por política), 0 cherry-picked, exit=0. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Sincronizacion upstream #41
Primera sync con el nuevo flujo: informe + cherry-picks seleccionados en rama separada.
Cherry-picks (3 candidatos)
Excluido por politica: fe82a1b chore:generate (regenera artefactos rebrandeado).
Tooling (pasos 1-3 del plan)
Checklist 4 categorias: PASS
Gates
Summary by Sourcery
Introduce an upstream sync reporting workflow and incorporate selected upstream fixes for directory search, config parsing, and stats sync reliability.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: