forgexa-cli 1.8.5__tar.gz → 1.8.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: forgexa-cli
3
- Version: 1.8.5
3
+ Version: 1.8.6
4
4
  Summary: Forgexa CLI — command-line client and AI agent runtime for the Forgexa platform
5
5
  Author-email: Jason Sun <dev.winds@gmail.com>
6
6
  License: MIT
@@ -1,2 +1,2 @@
1
1
  """forgexa-cli — Forgexa command-line client."""
2
- __version__ = "1.8.5"
2
+ __version__ = "1.8.6"
@@ -392,7 +392,7 @@ except (ImportError, ModuleNotFoundError):
392
392
  # DAEMON_VERSION is the protocol/logic version of the daemon code.
393
393
  # Kept in sync with pyproject.toml version via bump-version.sh.
394
394
  # CLIENT_TYPE identifies which packaging/distribution this daemon runs in.
395
- DAEMON_VERSION = "1.8.5"
395
+ DAEMON_VERSION = "1.8.6"
396
396
 
397
397
 
398
398
  def _detect_client_type() -> str:
@@ -5939,11 +5939,16 @@ class RuntimeDaemon:
5939
5939
  "fetch", "origin", branch,
5940
5940
  cwd=workspace_path,
5941
5941
  )
5942
- # 2. Rebase local commits onto the updated remote HEAD
5942
+ # 2. Rebase local commits onto the updated remote HEAD.
5943
+ # Use -X theirs so that when the same file was modified by
5944
+ # a previous agent run AND the current run (e.g. analysis
5945
+ # docs, PRD), git automatically accepts the current run's
5946
+ # version. This is correct: on an agent-managed feature
5947
+ # branch the latest agent output is always authoritative.
5943
5948
  await git(
5944
5949
  "-c", "user.name=Forgexa Agent",
5945
5950
  "-c", "user.email=agent@forgexa.net",
5946
- "rebase", f"origin/{branch}",
5951
+ "rebase", "-X", "theirs", f"origin/{branch}",
5947
5952
  cwd=workspace_path,
5948
5953
  )
5949
5954
  # 3. Push normally (no force needed — we're ahead of origin now)
@@ -5953,7 +5958,7 @@ class RuntimeDaemon:
5953
5958
  )
5954
5959
  logger.info(
5955
5960
  "Fetch+rebase recovery succeeded for branch %s "
5956
- "(%d remote commit(s) incorporated)",
5961
+ "(%d remote commit(s) incorporated via rebase -X theirs)",
5957
5962
  branch, remote_count,
5958
5963
  )
5959
5964
  return None
@@ -5964,17 +5969,38 @@ class RuntimeDaemon:
5964
5969
  await git("rebase", "--abort", cwd=workspace_path)
5965
5970
  except RuntimeError:
5966
5971
  pass
5967
- logger.error(
5968
- "Fetch+rebase recovery failed for branch %s: %s — "
5969
- "refusing push to protect remote work",
5972
+ logger.warning(
5973
+ "Fetch+rebase (-X theirs) recovery failed for branch %s: %s — "
5974
+ "falling back to --force-with-lease (we just fetched, safe)",
5970
5975
  branch, rebase_exc_str,
5971
5976
  )
5972
- return (
5973
- f"Push refused: remote branch '{branch}' has {remote_count} "
5974
- f"commit(s) not in local history, and automatic rebase failed "
5975
- f"(likely a merge conflict). Manual resolution required. "
5976
- f"Details: {rebase_exc_str[:300]}"
5977
- )
5977
+ # Fallback: --force-with-lease is safe here because we just ran
5978
+ # `git fetch origin {branch}`, so our lease ref is current.
5979
+ # Agent-managed feature branches have no concurrent human writers,
5980
+ # so the latest agent run always wins.
5981
+ try:
5982
+ await git(
5983
+ "push", "--force-with-lease", "-u", "origin", branch,
5984
+ cwd=workspace_path, project_key=project_key,
5985
+ )
5986
+ logger.info(
5987
+ "Force-with-lease fallback push succeeded for branch %s",
5988
+ branch,
5989
+ )
5990
+ return None
5991
+ except RuntimeError as force_exc:
5992
+ force_exc_str = str(force_exc)
5993
+ logger.error(
5994
+ "Force-with-lease fallback also failed for branch %s: %s",
5995
+ branch, force_exc_str,
5996
+ )
5997
+ return (
5998
+ f"Push refused: remote branch '{branch}' has {remote_count} "
5999
+ f"commit(s) not in local history, rebase (-X theirs) failed, "
6000
+ f"and force-with-lease fallback also failed. "
6001
+ f"Rebase error: {rebase_exc_str[:200]} | "
6002
+ f"Force error: {force_exc_str[:200]}"
6003
+ )
5978
6004
 
5979
6005
  logger.info("Found unpushed commits on %s, pushing...", branch)
5980
6006
  last_push_exc: Exception | None = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: forgexa-cli
3
- Version: 1.8.5
3
+ Version: 1.8.6
4
4
  Summary: Forgexa CLI — command-line client and AI agent runtime for the Forgexa platform
5
5
  Author-email: Jason Sun <dev.winds@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "forgexa-cli"
3
- version = "1.8.5"
3
+ version = "1.8.6"
4
4
  description = "Forgexa CLI — command-line client and AI agent runtime for the Forgexa platform"
5
5
  requires-python = ">=3.9"
6
6
  license = { text = "MIT" }
File without changes
File without changes