Skip to content

feat: add stack edit branch mode to keep debug commits off the base branch - #1530

Open
ChanningHe wants to merge 184 commits into
moghtech:mainfrom
ChanningHe:feat/stack-edit-branch
Open

feat: add stack edit branch mode to keep debug commits off the base branch#1530
ChanningHe wants to merge 184 commits into
moghtech:mainfrom
ChanningHe:feat/stack-edit-branch

Conversation

@ChanningHe

@ChanningHe ChanningHe commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

For git repo stacks, every save from the UI editor commits and pushes straight to the configured branch. Debugging a stack this way means the base branch ends up buried in Write Stack File commits — one per save. This is the same pain tracked in #458.

Summary

Adds an opt-in Edit Branch mode on the Stack Info page:

  • Edit on Branch creates komodo/edit/<stack> at the current tip of the base branch and switches the stack's branch to it. That's the whole trick — save, deploy, poll and webhooks all already follow branch, so saves commit to the edit branch and deploys pull from it with zero changes to those paths. Save behavior itself is untouched.
  • Squash & Merge folds the whole session back into the base branch as a single commit ([Komodo] {user}: Merge Stack Edits: update {files}, custom message supported), deletes the edit branch and switches back. On conflict the stack stays in edit mode.
  • Discard Branch throws the session away and restores the base branch.

Linked repo stacks

Linked repos needed different handling: the branch lives on the shared Repo resource, so switching it would drag every consumer along, and consumers also share one clone dir on the periphery. Instead, entering edit mode copies the Repo's git config onto the stack's inline fields for the duration of the session — the stack temporarily behaves like an inline repo stack with its own clone dir — and linked_repo is restored on exit. The Repo resource itself is never written to. If the Repo got deleted mid-session, the stack keeps the working inline config instead of a dangling reference.

Note

This is a large diff and was written heavily with Claude. The git primitives are unit-tested and I've run both inline and linked repo flows end to end — everything is opt-in, so existing behaviour should be untouched. That said, it touches the core stack write path, so it deserves a thorough review. Happy to rework whatever doesn't fit.

Frontend Screenshots

p1 p2 p3

mbecker20 and others added 28 commits July 12, 2026 16:30
)

Build the execute command as a single physical line so the PTY's local
echo cannot reproduce a bare sentinel line before the real output. The
`printf` format strings now use literal `\n` escapes (which printf
expands) instead of embedded newline bytes, keeping the emitted output
byte-identical while making the echoed command one line.

Closes moghtech#1289


Claude-Session: https://claude.ai/code/session_01M1ZTEJFKv3BAW36VmBwe2v

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tech#1528)

Git providers send push webhooks for every branch and Komodo filters
them server side (docs: Automate > Webhooks > Branch Filtering), so a
push to a non-matching branch is routine operation, not a failure. It
was surfaced through the generic 'Failed at running webhook' warn,
indistinguishable from genuine failures, and a repo with active bot
branches (e.g. Renovate) produces hundreds of these warns per day.

Rename ExtractBranch::verify_branch to branch_matches, returning
Ok(false) on a mismatch (logged at debug) so handlers skip quietly,
matching the existing silent webhook_enabled=false skip. Branch
EXTRACTION failures (e.g. a ref-less payload on a named-branch
listener) still return Err and reach the warn, preserving the
misconfiguration signal.
…t corrupt service detection (moghtech#1529)

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Maxwell Becker <49575486+mbecker20@users.noreply.github.com>
@ChanningHe
ChanningHe changed the base branch from main to 2.3.0 July 20, 2026 03:44
@mbecker20
mbecker20 changed the base branch from 2.3.0 to main July 28, 2026 23:42
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.

6 participants