|
| 1 | +--- |
| 2 | +name: update-sofatutor-tweaks |
| 3 | +description: Update the sofatutor-tweaks branch to the latest upstream stable LiteLLM tag, resolve merge conflicts, verify the result, cut the matching -sofatutor tag, and prepare release notes. Use this when asked to refresh the Sofatutor fork against the newest stable upstream release. |
| 4 | +argument-hint: Optional inputs: target stable tag, target PR number, notes about expected custom conflict resolutions. |
| 5 | +--- |
| 6 | + |
| 7 | +# Update sofatutor-tweaks |
| 8 | + |
| 9 | +Use this skill when the task is to refresh the Sofatutor fork against the latest stable upstream LiteLLM release and publish the matching Sofatutor release artifacts. |
| 10 | + |
| 11 | +## Why This Fork Exists |
| 12 | + |
| 13 | +Sofatutor keeps one clearly fork-specific customization on top of upstream LiteLLM: |
| 14 | + |
| 15 | +- CloudWatch logging support, including callback wiring, configuration, docs, and tests. |
| 16 | + |
| 17 | +The branch may also contain bug fixes or operational tweaks that were developed here first, such as OpenAI TTS streaming fixes, Responses API prompt-object compatibility, or Slack alert hardening. Do not treat those as required fork behaviors by default. Keep them only if the target upstream stable tag still does not contain an equivalent fix. |
| 18 | + |
| 19 | +## Inputs To Confirm |
| 20 | + |
| 21 | +- Current repository is the Sofatutor fork or has both `origin` and `upstream` remotes configured correctly. |
| 22 | +- GitHub CLI is installed and authenticated. |
| 23 | +- The operator has permission to push branches, tags, and release updates. |
| 24 | +- The default PR to check is `#4` unless the user specifies a different one. |
| 25 | + |
| 26 | +## Working Rules |
| 27 | + |
| 28 | +- Inspect the current branch, remotes, and worktree state before changing anything. |
| 29 | +- Prefer the latest non-`-sofatutor` stable tag unless the user specifies a target tag explicitly. |
| 30 | +- Preserve both upstream fixes and Sofatutor customizations; do not blindly take one side for mixed conflicts. |
| 31 | +- Verify current branch-specific customizations against `origin/main` before drafting release notes or claiming that a historical tweak is still required. |
| 32 | +- If tests fail or conflicts are ambiguous, stop and summarize the blocker with exact files or commands. |
| 33 | +- Prefer file-backed release notes over giant inline shell strings. Use [release-notes-template.md](./release-notes-template.md) and pass it to `gh release create --notes-file` after filling in the placeholders. |
| 34 | + |
| 35 | +## Workflow |
| 36 | + |
| 37 | +### 1. Validate Setup |
| 38 | + |
| 39 | +Run the following checks first: |
| 40 | + |
| 41 | +```bash |
| 42 | +git status --short --branch |
| 43 | +git remote -v |
| 44 | +git remote get-url upstream >/dev/null 2>&1 || git remote add upstream https://github.com/BerriAI/litellm.git |
| 45 | +gh auth status |
| 46 | +``` |
| 47 | + |
| 48 | +If the worktree is dirty, confirm that the user wants to proceed before mutating branch state. |
| 49 | + |
| 50 | +### 2. Fetch Upstream Tags And Detect The Target |
| 51 | + |
| 52 | +```bash |
| 53 | +git fetch upstream --tags |
| 54 | +git tag -l "*-stable*" | grep -v sofatutor | sort -V | tail -10 |
| 55 | +LATEST_STABLE_TAG=$(git tag -l "*-stable*" | grep -v sofatutor | sort -V | tail -1) |
| 56 | +echo "$LATEST_STABLE_TAG" |
| 57 | +``` |
| 58 | + |
| 59 | +If the user supplied a specific tag, use it instead of `LATEST_STABLE_TAG`. |
| 60 | + |
| 61 | +### 3. Create The Update Branch |
| 62 | + |
| 63 | +```bash |
| 64 | +BRANCH_NAME="stable-update-${LATEST_STABLE_TAG}" |
| 65 | +git checkout -b "$BRANCH_NAME" "$LATEST_STABLE_TAG" |
| 66 | +git push -u origin "$BRANCH_NAME" |
| 67 | +``` |
| 68 | + |
| 69 | +If the branch already exists locally or remotely, inspect it and reuse it only if it already points at the intended base. |
| 70 | + |
| 71 | +### 4. Merge `sofatutor-tweaks` |
| 72 | + |
| 73 | +```bash |
| 74 | +git merge sofatutor-tweaks -m "Merge sofatutor-tweaks into ${LATEST_STABLE_TAG}" |
| 75 | +``` |
| 76 | + |
| 77 | +If there are conflicts: |
| 78 | + |
| 79 | +1. Inspect `git status`. |
| 80 | +2. Use `git checkout --theirs` for Sofatutor-owned files that should stay as customized fork behavior, such as `.github/workflows/sofatutor_image.yml`. |
| 81 | +3. Use `git checkout --ours` when the upstream version should win unchanged. |
| 82 | +4. Manually resolve mixed files, especially under `litellm/proxy/` and `litellm/llms/openai/`. |
| 83 | +5. Stage each resolved file with `git add <file>`. |
| 84 | +6. Complete the merge commit if Git did not finish it automatically. |
| 85 | + |
| 86 | +Conflict heuristics: |
| 87 | + |
| 88 | +- `litellm/integrations/cloud_watch.py`, `litellm/litellm_core_utils/litellm_logging.py`, `litellm/utils.py`, `litellm/__init__.py`, `docs/my-website/docs/proxy/logging.md`: preserve the CloudWatch customization unless the user explicitly decides to remove it. |
| 89 | +- `litellm/llms/openai/*.py`, `litellm/types/llms/openai.py`, `litellm/integrations/SlackAlerting/*.py`: treat as conditional bug fixes. Keep them only if upstream stable still lacks the equivalent behavior. |
| 90 | +- `.github/workflows/sofatutor_image.yml`: keep only if the Sofatutor deployment still depends on this workflow. |
| 91 | +- `tests/*`: keep both sides when possible. |
| 92 | + |
| 93 | +### 5. Verify The Merge |
| 94 | + |
| 95 | +Install test dependencies if needed, then run the relevant suites: |
| 96 | + |
| 97 | +```bash |
| 98 | +pip install -e ".[dev]" |
| 99 | +pytest tests/local_testing/ -v --tb=short |
| 100 | +pytest tests/llm_responses_api_testing/ -v |
| 101 | +pytest tests/proxy_unit_tests/ -v -k "not slow" |
| 102 | +``` |
| 103 | + |
| 104 | +If one of these suites is too expensive or unavailable in the current environment, say exactly what was skipped and why. |
| 105 | + |
| 106 | +### 6. Update `sofatutor-tweaks` |
| 107 | + |
| 108 | +```bash |
| 109 | +git checkout sofatutor-tweaks |
| 110 | +git merge "$BRANCH_NAME" |
| 111 | +git push origin sofatutor-tweaks |
| 112 | +``` |
| 113 | + |
| 114 | +If fast-forward is not possible, explain why before creating any additional merge commit on `sofatutor-tweaks`. |
| 115 | + |
| 116 | +### 7. Check Or Update The PR |
| 117 | + |
| 118 | +PR `#4` is expected to carry the Sofatutor customizations. Verify whether it already reflects the updated branch. Only edit the base branch if the user asks for that specific change. |
| 119 | + |
| 120 | +Example: |
| 121 | + |
| 122 | +```bash |
| 123 | +gh pr view 4 |
| 124 | +gh pr edit 4 --base main |
| 125 | +``` |
| 126 | + |
| 127 | +### 8. Create The New Sofatutor Tag |
| 128 | + |
| 129 | +```bash |
| 130 | +NEW_SOFATUTOR_TAG="${LATEST_STABLE_TAG}-sofatutor" |
| 131 | +git tag -a "$NEW_SOFATUTOR_TAG" -m "Sofatutor release based on ${LATEST_STABLE_TAG}" |
| 132 | +git push origin "$NEW_SOFATUTOR_TAG" |
| 133 | +``` |
| 134 | + |
| 135 | +If the tag already exists, inspect whether it points to the intended commit before deleting or recreating it. |
| 136 | + |
| 137 | +### 9. Prepare And Publish Release Notes |
| 138 | + |
| 139 | +Gather the comparison range: |
| 140 | + |
| 141 | +```bash |
| 142 | +PREVIOUS_SOFATUTOR_TAG=$(git tag -l "*-sofatutor" | sort -V | tail -2 | head -1) |
| 143 | +PREVIOUS_STABLE_TAG=$(echo "$PREVIOUS_SOFATUTOR_TAG" | sed 's/-sofatutor//') |
| 144 | +git log "${PREVIOUS_SOFATUTOR_TAG}..${NEW_SOFATUTOR_TAG}" --oneline --no-merges |
| 145 | +git log "${PREVIOUS_STABLE_TAG}..${LATEST_STABLE_TAG}" --oneline --no-merges | head -50 |
| 146 | +``` |
| 147 | + |
| 148 | +Fill in [release-notes-template.md](./release-notes-template.md) with the resolved tag values and any noteworthy upstream or Sofatutor-specific changes. Then create the release with a notes file instead of embedding a large multiline string directly in the shell. |
| 149 | + |
| 150 | +When writing the Sofatutor customization section, separate true fork-specific behavior from bug fixes: |
| 151 | + |
| 152 | +- CloudWatch logging support should be treated as the primary Sofatutor customization unless the user says otherwise. |
| 153 | +- OpenAI TTS streaming, Responses API prompt-object compatibility, Slack alert hardening, and similar fixes should only be listed if the chosen upstream stable tag still lacks them. |
| 154 | +- Operational items like `.github/workflows/sofatutor_image.yml` should only be listed if they are still part of the deployment model. |
| 155 | + |
| 156 | +Example: |
| 157 | + |
| 158 | +```bash |
| 159 | +gh release create "$NEW_SOFATUTOR_TAG" \ |
| 160 | + --title "$NEW_SOFATUTOR_TAG" \ |
| 161 | + --notes-file .github/skills/update-sofatutor-tweaks/release-notes-template.md |
| 162 | +``` |
| 163 | + |
| 164 | +## Completion Checklist |
| 165 | + |
| 166 | +- Upstream tags fetched. |
| 167 | +- Latest stable tag identified and confirmed. |
| 168 | +- Stable update branch created from that tag. |
| 169 | +- `sofatutor-tweaks` merged and conflicts resolved. |
| 170 | +- Relevant tests run or explicitly skipped. |
| 171 | +- `sofatutor-tweaks` updated and pushed. |
| 172 | +- PR status checked, and base edited only if requested. |
| 173 | +- New `-sofatutor` tag created and pushed. |
| 174 | +- Release notes prepared and release created or draft-ready. |
| 175 | + |
| 176 | +## Resources |
| 177 | + |
| 178 | +- [release-notes-template.md](./release-notes-template.md) |
| 179 | +- [quick-reference.sh](./quick-reference.sh) |
0 commit comments