Skip to content

fix: install ProgressIndicator context before running interactive rebase on pooled thread - #994

Open
agentbridge-fixer[bot] wants to merge 1 commit into
masterfrom
fix/rebase-tool-progress-indicator
Open

fix: install ProgressIndicator context before running interactive rebase on pooled thread#994
agentbridge-fixer[bot] wants to merge 1 commit into
masterfrom
fix/rebase-tool-progress-indicator

Conversation

@agentbridge-fixer

Copy link
Copy Markdown

Problem

git_rebase's interactive path threw:

java.lang.IllegalStateException: There is no ProgressIndicator or Job in this thread, the current job is not cancellable.
	at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable$lambda$0(coroutines.kt:156)
	...
	at git4idea.GitProtectedBranchesKt.isCommitPublishedBlocking(GitProtectedBranches.kt:54)
	at git4idea.rebase.GitRebaseProcess.isRebasingPublishedCommit(GitRebaseProcess.java:602)
	at git4idea.rebase.GitRebaseProcess.checkForRebasingPublishedCommits(GitRebaseProcess.java:589)
	at git4idea.rebase.GitRebaseProcess.rebase(GitRebaseProcess.java:147)
	at git4idea.rebase.GitRebaseUtils.rebaseWithResult(GitRebaseUtils.java:62)
	at com.github.catatafishen.agentbridge.psi.tools.git.GitRebaseTool.executeRebaseOnPooledThread(GitRebaseTool.java:291)
	...

Root cause

GitRebaseTool.doInteractiveRebase() runs GitRebaseUtils.rebaseWithResult() on a raw ApplicationManager.executeOnPooledThread() runnable, passing an EmptyProgressIndicator only as a call argument.

That's not sufficient: git4idea's GitRebaseProcess internally calls checkForRebasingPublishedCommits() -> isRebasingPublishedCommit() -> isCommitPublishedBlocking(), which uses runBlockingCancellable(). That platform API requires a ProgressIndicator/coroutine Job to already be installed in the calling thread's context -- it does not derive one from an indicator merely passed as a method parameter. A bare pooled-thread runnable has no such context, so the call fails every time this code path is hit (i.e. any interactive rebase where the upstream branch has published/pushed commits).

Fix

Wrap the pooled-thread rebase call in ProgressManager.getInstance().runProcess(runnable, indicator), which installs the given indicator into the thread's progress context before running the work. The same indicator instance is now threaded through to GitRebaseUtils.rebaseWithResult() as well, instead of constructing a second, disconnected EmptyProgressIndicator().

Testing

  • build_project (plugin-core module): 0 errors.
  • Gradle test suite for plugin-core could not be run standalone in this environment due to a pre-existing, unrelated JCEF/git4idea classpath issue affecting the whole module.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

…ase on pooled thread

git_rebase's interactive path (doInteractiveRebase) ran
GitRebaseUtils.rebaseWithResult() directly inside a bare
ApplicationManager.executeOnPooledThread() runnable, passing an
EmptyProgressIndicator only as a call argument.

That's not enough: git4idea's GitRebaseProcess internally calls
checkForRebasingPublishedCommits() -> isRebasingPublishedCommit() ->
isCommitPublishedBlocking(), which uses runBlockingCancellable(). That
API requires a ProgressIndicator/coroutine Job to already be installed
in the *calling thread's* context - it doesn't derive one from an
indicator merely passed as a method argument. Since our pooled thread
had no such context, every interactive rebase threw:

  java.lang.IllegalStateException: There is no ProgressIndicator or Job
  in this thread, the current job is not cancellable.

Fix: wrap the pooled-thread rebase call in
ProgressManager.getInstance().runProcess(runnable, indicator), which
installs the indicator into the thread's progress context before
running the work. The same indicator instance is now threaded through
to GitRebaseUtils.rebaseWithResult() as well, instead of constructing a
second, disconnected EmptyProgressIndicator.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ishen/agentbridge/psi/tools/git/GitRebaseTool.java 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

IDE Compatibility Matrix

pass fail 🚫 unavailable no test yet

Generated from the real-IDE integration bench (:ide-integration-tests).

Tool CL IU RD
PSI / Navigation      
search_symbols 🚫
get_file_outline
find_references
go_to_declaration
get_documentation
get_symbol_info
get_class_outline
Code Quality      
get_highlights
get_problems
get_compilation_errors
get_available_actions
apply_action
apply_quickfix
format_code
optimize_imports
suppress_inspection
Refactoring      
get_type_hierarchy 🚫
get_call_hierarchy 🚫
find_implementations 🚫
find_super_methods
refactor
convert_java_to_kotlin
Testing      
run_tests
list_tests
run_configuration
get_coverage
Debug      
debug_session_start
breakpoint_manage
debug_evaluate
debug_snapshot
debug_inspect_frame
debug_variable_detail
debug_read_console
debug_step
debug_run_to_line
Build      
read_build_output
reload_project_model

Logged IDE errors (non-gating)

Scraped from the IDE log during the run. These do not fail a matrix cell (the cell reflects the tool's MCP response) — they are listed for visibility while the bench matures.

⚠️ CL — (java.lang.IllegalStateException: There is no ProgressIndicator or Job in this thread, the current job is not cancellable.)
Test: com.github.catatafishen.agentbridge.integration.GetHighlightsIntegrationTest.get_highlights returns a non-error response ⏎ You can find logs and other useful info in CI artifacts under the path getHighlights ⏎ java.lang.IllegalStateException: There is no ProgressIndicator or Job in this thread, the current job is not cancellable. ⏎ at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable$lambda$0(coroutines.kt:153) ⏎ at com.intellij.openapi.progress.ContextKt.prepareThreadContext$lambda$0(context.kt:93) ⏎ at com.intellij.concurrency.ThreadContext.resetThreadContext(threadContext.kt:294) ⏎ at com.intellij.openapi.progress.ContextKt.prepareThreadContext(context.kt:92) ⏎ at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable(coroutines.kt:151)
⚠️ CL — (java.lang.InterruptedException: null)
Test: com.github.catatafishen.agentbridge.integration.GetHighlightsIntegrationTest.get_highlights returns a non-error response ⏎ You can find logs and other useful info in CI artifacts under the path getHighlights ⏎ java.lang.InterruptedException ⏎ at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:124) ⏎ at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$BuildersKt__BuildersKt(Builders.kt:87) ⏎ at kotlinx.coroutines.BuildersKt__BuildersKt.runBlockingWithParallelismCompensation(Builders.kt:63) ⏎ at kotlinx.coroutines.BuildersKt.runBlockingWithParallelismCompensation(Unknown Source) ⏎ at kotlinx.coroutines.internal.intellij.IntellijCoroutines.runBlockingWithParallelismCompensation(intellij.kt:48)

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.

0 participants