Skip to content

fix(core): implement workspace grounding and exploration abort guards#4

Closed
JessicaMulein wants to merge 1 commit into
dev-integrationfrom
fix/implement-turn-grounding
Closed

fix(core): implement workspace grounding and exploration abort guards#4
JessicaMulein wants to merge 1 commit into
dev-integrationfrom
fix/implement-turn-grounding

Conversation

@JessicaMulein
Copy link
Copy Markdown
Member

Summary

  • Implement/resume grounding: inject lib/ + test/ workspace snapshot and next-action hints on implement/resume turns; run flutter test verification at turn end when applicable.
  • Exploration dead-end guards: abort turns after repeated ls, ReadRange errors, repetition detection, or empty Ollama exploration with no edits; skip stall auto-continue when exploration was aborted.
  • Model router keep-alive: default keep_alive_heavy to -1 (normalize legacy 0); expose Heavy keep-alive in Settings.
  • Session/UI: release inflight SSE on done/error; Resume work UI in TodoPanel; resume prompt tells agent to use snapshot not ls.
  • Cecli pin: cherry-pick ReadRange int-marker coerce onto dev-integration (cecli-dev/cecli#561).

Test plan

  • python -m pytest tests/core/test_implement_workspace.py tests/core/test_agent_turn.py tests/core/test_spec_focus.py tests/core/test_model_router.py tests/core/test_session_io_events.py -q
  • yarn test src/theme/modelRouterPrefs.test.ts src/todos/formatContext.test.ts
  • Manual: Tasks → Resume/Implement on a Flutter project; confirm workspace snapshot in prompt and no ls loops
  • Manual: Force HEAVY + model router — confirm no empty Ollama responses between agent LLM calls

Related

Made with Cursor

Ground implement/resume turns with lib/test snapshots and flutter test
verification; abort ls/repetition/read-range dead ends; default heavy
keep_alive to -1 so router models stay loaded between agent LLM calls.
Pin cecli dev-integration (ReadRange int marker coerce).

Co-authored-by: Cursor <cursoragent@cursor.com>
@typo-app
Copy link
Copy Markdown

typo-app Bot commented Jun 7, 2026

Your Typo free trial has ended. To continue receiving code reviews, please ask your admin to upgrade to a paid plan.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 7, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2dc195ae-fe59-452c-8974-c2e4fdad9f27

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/implement-turn-grounding

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Implement workspace grounding and exploration abort guards with flutter test verification

✨ Enhancement 🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Implement workspace grounding: inject on-disk lib//test/ snapshot and next-action hints on
  implement/resume turns; run flutter test verification at turn end when applicable
• Exploration dead-end guards: abort turns after repeated ls, ReadRange errors, repetition
  detection, or empty Ollama exploration with no edits; skip stall auto-continue when exploration was
  aborted
• Model router keep-alive: default keep_alive_heavy to -1 (normalize legacy 0); expose Heavy
  keep-alive in Settings UI
• Session/UI: release inflight SSE on done/error; Resume work UI in TodoPanel; resume prompt tells
  agent to use snapshot not ls
• Edit failure recovery: auto-continue once after EditText failure with ReadRange guidance; abort
  after consecutive failures
Diagram
flowchart LR
  A["Implement/Resume Turn"] -->|"Inject workspace snapshot"| B["Snapshot + Next Action"]
  B -->|"Avoid ls loops"| C["ReadRange + EditText"]
  C -->|"Test-focused checklist"| D["Run flutter test"]
  E["Exploration Activity"] -->|"Track ls/ReadRange/repetition"| F["Abort Guards"]
  F -->|"No auto-continue"| G["User Recovery Prompt"]
  H["Model Router"] -->|"Normalize keep_alive=0 to -1"| I["Heavy Model Stays Loaded"]
  J["EditText Failure"] -->|"Auto-continue once"| K["ReadRange Guidance"]
  K -->|"Consecutive failures"| L["Abort Turn"]

Loading

Grey Divider

File Changes

1. bright_vision_core/agent_turn.py ✨ Enhancement +431/-1

Add exploration abort guards and context pressure detection

bright_vision_core/agent_turn.py


2. bright_vision_core/implement_workspace.py ✨ Enhancement +225/-0

New module for workspace snapshot and next-action injection

bright_vision_core/implement_workspace.py


3. bright_vision_core/session.py ✨ Enhancement +338/-26

Integrate workspace grounding, edit failure recovery, flutter test verification

bright_vision_core/session.py


View more (24)
4. bright_vision_core/spec_focus.py ✨ Enhancement +22/-1

Inject workspace snapshot block on implement/resume turns

bright_vision_core/spec_focus.py


5. bright_vision_core/spec_steering.py 📝 Documentation +16/-0

Add scaffold hint and implementation tool guidance

bright_vision_core/spec_steering.py


6. bright_vision_core/model_router.py 🐞 Bug fix +13/-2

Normalize heavy keep_alive 0 to -1 for model persistence

bright_vision_core/model_router.py


7. bright_vision_core/model_router_apply.py 🐞 Bug fix +4/-3

Apply normalized keep_alive to routed models

bright_vision_core/model_router_apply.py


8. bright_vision_core/http_api.py 🐞 Bug fix +9/-2

Add field validator to normalize keep_alive_heavy in API requests

bright_vision_core/http_api.py


9. tests/core/test_agent_turn.py 🧪 Tests +280/-1

Add tests for context pressure, exploration abort, edit failures

tests/core/test_agent_turn.py


10. tests/core/test_implement_workspace.py 🧪 Tests +52/-0

New test module for workspace snapshot and checklist parsing

tests/core/test_implement_workspace.py


11. tests/core/test_model_router.py 🧪 Tests +13/-0

Test keep_alive normalization in model router config

tests/core/test_model_router.py


12. tests/core/test_session_io_events.py 🧪 Tests +16/-0

Regression test for model_route SSE deduplication

tests/core/test_session_io_events.py


13. tests/core/test_spec_focus.py 🧪 Tests +6/-0

Test workspace snapshot injection in implement turns

tests/core/test_spec_focus.py


14. src/hooks/useVisionSession.ts 🐞 Bug fix +29/-7

Release inflight SSE on turn done/error; track send generation

src/hooks/useVisionSession.ts


15. src/ipc/visionApi.ts 🐞 Bug fix +8/-0

Break SSE stream on done/error; invoke cancel_vision_message

src/ipc/visionApi.ts


16. src/ipc/modelRouterLlm.ts 🐞 Bug fix +8/-3

Normalize keep_alive_heavy in hopper and router entries

src/ipc/modelRouterLlm.ts


17. src/theme/modelRouterPrefs.ts 🐞 Bug fix +27/-6

Add normalization functions and persist heavy keep-alive fix

src/theme/modelRouterPrefs.ts


18. src/theme/modelRouterPrefs.test.ts 🧪 Tests +33/-0

Test keep_alive normalization in preferences

src/theme/modelRouterPrefs.test.ts


19. src/todos/formatContext.ts ✨ Enhancement +45/-3

Add resume work detection and message building

src/todos/formatContext.ts


20. src/todos/formatContext.test.ts 🧪 Tests +37/-0

Test resume work detection and message generation

src/todos/formatContext.test.ts


21. src/components/settings/ModelRouterSection.tsx ✨ Enhancement +19/-0

Expose Heavy keep-alive setting in UI with helper text

src/components/settings/ModelRouterSection.tsx


22. src/components/todos/TodoPanel.tsx ✨ Enhancement +30/-2

Show Resume work button and icon when task has progress

src/components/todos/TodoPanel.tsx


23. src/App.tsx ✨ Enhancement +10/-2

Wire up release inflight callback and resume work detection

src/App.tsx


24. e2e/helpers/llmEnv.ts ⚙️ Configuration changes +1/-1

Update default keep_alive_heavy to -1 in E2E config

e2e/helpers/llmEnv.ts


25. docs/ROADMAP.md 📝 Documentation +2/-1

Update roadmap with workspace grounding and exploration abort items

docs/ROADMAP.md


26. docs/TROUBLESHOOTING.md 📝 Documentation +2/-2

Document keep-alive default change and exploration stall recovery

docs/TROUBLESHOOTING.md


27. cecli Dependencies +1/-1

Pin cecli dev-integration with ReadRange int-marker coerce

cecli


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Jun 7, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (2)

Grey Divider


Action required

1. buildResumeWorkMessage lacks attribution 📘 Rule violation ⚙ Maintainability
Description
New user-facing agent guidance text describes BrightVision agent behavior (resume/implement
workflow, workspace snapshot) but does not attribute the underlying agent system to Cecli as
required. This can create incorrect product attribution in UI copy and docs.
Code

src/todos/formatContext.ts[R139-154]

+  if (todoHasSpecLayers(item)) {
+    return (
+      '/agent Continue the active task from where you stopped. ' +
+      'A **workspace snapshot** is injected — do **not** ls, Grep, or GitStatus. ' +
+      'Use ReadRange + EditText on the **Next action** file only. ' +
+      'Do not reset completed checklist items; work the next incomplete item.' +
+      blockedNote
+    )
+  }
+
+  return (
+    '/agent Continue the active task checklist from where you stopped. ' +
+    'Use ReadRange and EditText on the next incomplete item — ' +
+    'do not repeat exploration unless necessary. Do not uncheck completed items.' +
+    blockedNote
+  )
Evidence
PR Compliance ID 3 requires Cecli partnership attribution in user-facing agent descriptions. The new
resume-work prompt and related guidance text describes agent behavior (e.g., workspace snapshot
injection and how to proceed) but contains no Cecli attribution or clarification of BrightVision’s
role.

AGENTS.md: Attribute Cecli Partnership in User-Facing Copy
src/todos/formatContext.ts[139-154]
docs/TROUBLESHOOTING.md[277-283]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
User-facing copy added/modified in this PR describes the agent workflow (resume/implement, workspace snapshot, model router behavior) without attributing the underlying agent system to Cecli and clarifying BrightVision’s role as the Vision HTTP layer.

## Issue Context
PR Compliance ID 3 requires Cecli partnership attribution wherever agent capabilities are described to users.

## Fix Focus Areas
- src/todos/formatContext.ts[139-154]
- docs/TROUBLESHOOTING.md[277-283]
- bright_vision_core/implement_workspace.py[76-191]
- bright_vision_core/agent_turn.py[182-187]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Cross-turn SSE cancel 🐞 Bug ☼ Reliability
Description
On Tauri, the UI unblocks and may start a new send immediately after a done/error event, while
the previous send() still runs its finally block and invokes cancel_vision_message. Because
the Tauri cancel flag is stored as a single global slot, this cleanup can cancel the *next* turn’s
SSE stream, truncating or dropping the response.
Code

src/ipc/visionApi.ts[R245-247]

+        if (turnComplete && isTauriRuntime()) {
+          void invoke('cancel_vision_message')
+        }
Evidence
The frontend now triggers releaseInflightAfterTurn on done/error, and releaseInflightAfterTurn
can allow/trigger additional sends while the prior visionApi.send() is still in its finally.
Meanwhile, Tauri stores only one cancel flag and overwrites it per send; cancel_vision_message
flips that shared flag, so a late cancel from turn N can cancel turn N+1.

src/App.tsx[809-834]
src/hooks/useVisionSession.ts[174-190]
src/ipc/visionApi.ts[201-249]
src-tauri/src/vision_message.rs[14-16]
src-tauri/src/vision_message.rs[48-52]
src-tauri/src/vision_message.rs[127-133]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
On desktop (Tauri), `cancel_vision_message` cancels whatever stream is currently stored in a single global `VisionMessageStreamState.cancel` slot. The React client now calls `releaseInflightAfterTurn()` on `done`/`error`, which can trigger a *new* send before the previous send’s `finally` runs; the previous send then calls `cancel_vision_message`, potentially cancelling the new stream.

### Issue Context
- `releaseInflightAfterTurn()` is executed on core `done/error` events and can lead to subsequent sends starting quickly.
- `visionApi.send()` calls `invoke('cancel_vision_message')` in `finally` when a turn completes.
- Tauri’s cancel mechanism uses a single shared `Option<Arc<AtomicBool>>` that is overwritten on every new `send_vision_message`.

### Fix Focus Areas
Implement one of the following robust fixes (preferred order):
1) **Make cancel scoped**: Change Tauri state to track cancel flags per **session_id** or a monotonic **stream_id** returned/known to JS, and update `cancel_vision_message` to accept that identifier and cancel only the matching stream.
2) **Prevent overlap**: Ensure the UI cannot start a new `send()` until the previous `send()` has fully finished its cleanup (separate “UI busy” from “network inflight”, or add a dedicated “sendInProgress” gate).

Fix locations:
- src/ipc/visionApi.ts[201-249]
- src/hooks/useVisionSession.ts[174-190]
- src/App.tsx[826-834]
- src-tauri/src/vision_message.rs[14-16]
- src-tauri/src/vision_message.rs[48-52]
- src-tauri/src/vision_message.rs[127-133]

### Acceptance checks
- Add an automated test or an e2e mock to simulate: turn N emits `done`, immediate second send starts, and verify the second stream is not cancelled by cleanup from turn N.
- Verify `cancelSend()` still cancels the current in-flight stream reliably.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. flutter test args not guarded 📘 Rule violation ⛨ Security
Description
run_flutter_tests() executes flutter test with file arguments derived from workspace state
without guarding against option-like filenames (e.g., paths starting with -). This violates the
requirement to sanitize/limit process inputs and can allow unintended command behavior.
Code

bright_vision_core/implement_workspace.py[R203-218]

+def run_flutter_tests(workspace: str | Path, test_paths: list[str]) -> tuple[bool, str]:
+    """Run ``flutter test`` on specific files; return (passed, combined output)."""
+    root = Path(workspace).resolve()
+    if not (root / "pubspec.yaml").is_file():
+        return False, "pubspec.yaml missing — cannot run flutter test"
+    if not test_paths:
+        return False, "no test paths"
+    cmd = ["flutter", "test", *test_paths]
+    try:
+        proc = subprocess.run(
+            cmd,
+            cwd=str(root),
+            capture_output=True,
+            text=True,
+            timeout=300,
+        )
Evidence
PR Compliance ID 9 requires sanitizing inputs used for process execution. The new
run_flutter_tests() spawns an external process and forwards derived file paths directly as CLI
args, which can be misinterpreted as options if not guarded (e.g., by inserting -- or validating
allowed path patterns).

AGENTS.md: Sanitize Shell Input and Enforce Tauri CSP/Command Allowlists
bright_vision_core/implement_workspace.py[203-218]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`run_flutter_tests()` builds `cmd = ["flutter", "test", *test_paths]` where `test_paths` come from workspace/edited files. Filenames beginning with `-` can be interpreted as flags by `flutter test`, which is a form of argument injection.

## Issue Context
PR Compliance ID 9 requires sanitizing inputs to any spawned process and reducing the execution attack surface.

## Fix Focus Areas
- bright_vision_core/implement_workspace.py[203-218]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: audit

Failed stage: Install brightdate + cecli + bright_vision_core (editable) [❌]

Failed test name: ""

Failure summary:

The action failed during pip’s “Getting requirements to build editable” step for the repo package
(file:///home/runner/work/BrightVision/BrightVision).
The build backend vcs_versioning attempted to
derive the package version from Git metadata, but produced a version string 3bc7081 (looks like a
short commit SHA).
packaging.version.Version rejected this as not PEP 440 compliant, raising:

packaging.version.InvalidVersion: Invalid version: '3bc7081' (from vcs_versioning/_scm_version.py,
ultimately failing the editable build).
The repo checkout is also detected as shallow (UserWarning:
"... is shallow and may cause errors"), which likely contributed to incorrect/missing tag
information and the fallback to a non-semver SHA.

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

606:  Downloading wcwidth-0.8.0-py3-none-any.whl (324 kB)
607:  Building wheels for collected packages: cecli-dev
608:  Building editable for cecli-dev (pyproject.toml): started
609:  Building editable for cecli-dev (pyproject.toml): finished with status 'done'
610:  Created wheel for cecli-dev: filename=cecli_dev-0.1.dev1-0.editable-py3-none-any.whl size=14775 sha256=fa15b33e94dc0e2733b70ffd3bfe956a2f2f7d86a28ee7fef1e777620ac71962
611:  Stored in directory: /tmp/pip-ephem-wheel-cache-n3vzl7fi/wheels/78/a5/2b/341923abc2cf81fa67f0bf0a88e88d4b021f2f62cedddb0275
612:  Successfully built cecli-dev
613:  Installing collected packages: pyperclip, pydub, ptyprocess, zipp, xxhash, wcwidth, urllib3, uc-micro-py, typing-extensions, truststore, tree-sitter-yaml, tree-sitter-embedded-template, tree-sitter-c-sharp, tree-sitter, tqdm, tomlkit, soupsieve, socksio, sniffio, smmap, shtab, shellingham, rpds-py, regex, rapidfuzz, PyYAML, python-multipart, python-dotenv, pypandoc, pyjwt, pygments, pyflakes, pycparser, pycodestyle, py-cymbal, psutil, propcache, platformdirs, pillow, pexpect, pathspec, packaging, numpy, ngram, multidict, mslex, mdurl, mccabe, MarkupSafe, marisa-trie, json5, json-repair, jiter, importlib_resources, idna, httpx-sse, hf-xet, h11, fsspec, frozenlist, filelock, fastuuid, distro, diskcache, diff-match-patch, configargparse, click, charset_normalizer, certifi, backoff, attrs, annotated-types, annotated-doc, aiohappyeyeballs, yarl, uvicorn, typing-inspection, tree_sitter_languages, tree-sitter-language-pack, scipy, rustworkx, requests, referencing, pydantic-core, prompt_toolkit, oslex, markdown-it-py, linkify-it-py, jinja2, importlib-metadata, httpcore, gitdb, flake8, cffi, beautifulsoup4, anyio, aiosignal, watchfiles, tiktoken, starlette, soundfile, sounddevice, rich, pydantic, mdit-py-plugins, jsonschema-specifications, httpx, GitPython, cryptography, aiohttp, typer, textual, sse-starlette, pydantic-settings, openai, jsonschema, mcp, huggingface-hub, tokenizers, litellm, cecli-dev
614:  Successfully installed GitPython-3.1.50 MarkupSafe-3.0.3 PyYAML-6.0.3 aiohappyeyeballs-2.6.2 aiohttp-3.14.0 aiosignal-1.4.0 annotated-doc-0.0.4 annotated-types-0.7.0 anyio-4.13.0 attrs-26.1.0 backoff-2.2.1 beautifulsoup4-4.14.3 cecli-dev-0.1.dev1 certifi-2026.5.20 cffi-2.0.0 charset_normalizer-3.4.7 click-8.4.1 configargparse-1.7.5 cryptography-48.0.0 diff-match-patch-20241021 diskcache-5.6.3 distro-1.9.0 fastuuid-0.14.0 filelock-3.29.1 flake8-7.3.0 frozenlist-1.8.0 fsspec-2026.4.0 gitdb-4.0.12 h11-0.16.0 hf-xet-1.5.0 httpcore-1.0.9 httpx-0.28.1 httpx-sse-0.4.3 huggingface-hub-1.18.0 idna-3.18 importlib-metadata-8.9.0 importlib_resources-7.1.0 jinja2-3.1.6 jiter-0.15.0 json-repair-0.60.1 json5-0.14.0 jsonschema-4.26.0 jsonschema-specifications-2025.9.1 linkify-it-py-2.1.0 litellm-1.88.0 marisa-trie-1.4.1 markdown-it-py-4.2.0 mccabe-0.7.0 mcp-1.27.2 mdit-py-plugins-0.6.1 mdurl-0.1.2 mslex-1.3.0 multidict-6.7.1 ngram-4.0.3 numpy-2.4.6 openai-2.41.0 oslex-2.0.0 packaging-26.2 pathspec-1.1.1 pexpect-4.9.0 pillow-12.2.0 platformdirs-4.10.0 prompt_toolkit-3.0.52 propcache-0.5.2 psutil-7.2.2 ptyprocess-0.7.0 py-cymbal-0.1.24 pycodestyle-2.14.0 pycparser-3.0 pydantic-2.13.4 pydantic-core-2.46.4 pydantic-settings-2.14.1 pydub-0.25.1 pyflakes-3.4.0 pygments-2.20.0 pyjwt-2.13.0 pypandoc-1.17 pyperclip-1.11.0 python-dotenv-1.2.2 python-multipart-0.0.32 rapidfuzz-3.14.5 referencing-0.37.0 regex-2026.5.9 requests-2.34.2 rich-15.0.0 rpds-py-2026.5.1 rustworkx-0.17.1 scipy-1.17.1 shellingham-1.5.4 shtab-1.8.0 smmap-5.0.3 sniffio-1.3.1 socksio-1.0.0 sounddevice-0.5.5 soundfile-0.14.0 soupsieve-2.8.4 sse-starlette-3.4.4 starlette-1.2.1 textual-8.2.7 tiktoken-0.13.0 tokenizers-0.23.1 tomlkit-0.15.0 tqdm-4.68.1 tree-sitter-0.25.2 tree-sitter-c-sharp-0.23.5 tree-sitter-embedded-template-0.25.0 tree-sitter-language-pack-0.13.0 tree-sitter-yaml-0.7.2 tree_sitter_languages-1.10.2 truststore-0.10.4 typer-0.25.1 typing-extensions-4.15.0 typing-inspection-0.4.2 uc-micro-py-2.0.0 urllib3-2.7.0 uvicorn-0.49.0 watchfiles-1.2.0 wcwidth-0.8.0 xxhash-3.7.0 yarl-1.24.2 zipp-4.1.0
615:  Obtaining file:///home/runner/work/BrightVision/BrightVision
616:  Installing build dependencies: started
617:  Installing build dependencies: finished with status 'done'
618:  Checking if build backend supports build_editable: started
619:  Checking if build backend supports build_editable: finished with status 'done'
620:  Getting requirements to build editable: started
621:  Getting requirements to build editable: finished with status 'error'
622:  error: subprocess-exited-with-error
623:  × Getting requirements to build editable did not run successfully.
624:  │ exit code: 1
625:  ╰─> [95 lines of output]
626:  /tmp/pip-build-env-rp9vfezu/overlay/lib/python3.12/site-packages/vcs_versioning/_backends/_git.py:377: UserWarning: "/home/runner/work/BrightVision/BrightVision" is shallow and may cause errors
627:  pre_parse(wd)
...

705:  return meta(tag=tag, distance=distance, dirty=dirty, node=node, config=config)
706:  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
707:  File "/tmp/pip-build-env-rp9vfezu/overlay/lib/python3.12/site-packages/vcs_versioning/_scm_version.py", line 367, in meta
708:  parsed_version = _parse_tag(tag, preformatted, config)
709:  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
710:  File "/tmp/pip-build-env-rp9vfezu/overlay/lib/python3.12/site-packages/vcs_versioning/_scm_version.py", line 328, in _parse_tag
711:  version = tag_to_version(tag, config)
712:  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
713:  File "/tmp/pip-build-env-rp9vfezu/overlay/lib/python3.12/site-packages/vcs_versioning/_scm_version.py", line 157, in tag_to_version
714:  version = config.version_cls(version_str)
715:  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
716:  File "/tmp/pip-build-env-rp9vfezu/overlay/lib/python3.12/site-packages/packaging/version.py", line 438, in __init__
717:  raise InvalidVersion(f"Invalid version: {version!r}")
718:  packaging.version.InvalidVersion: Invalid version: '3bc7081'
719:  [end of output]
720:  note: This error originates from a subprocess, and is likely not a problem with pip.
721:  ERROR: Failed to build 'file:///home/runner/work/BrightVision/BrightVision' when getting requirements to build editable
722:  ##[error]Process completed with exit code 1.
723:  Post job cleanup.

@JessicaMulein
Copy link
Copy Markdown
Member Author

Closing — merging directly to dev-integration (no internal PR workflow).

Comment on lines +139 to +154
if (todoHasSpecLayers(item)) {
return (
'/agent Continue the active task from where you stopped. ' +
'A **workspace snapshot** is injected — do **not** ls, Grep, or GitStatus. ' +
'Use ReadRange + EditText on the **Next action** file only. ' +
'Do not reset completed checklist items; work the next incomplete item.' +
blockedNote
)
}

return (
'/agent Continue the active task checklist from where you stopped. ' +
'Use ReadRange and EditText on the next incomplete item — ' +
'do not repeat exploration unless necessary. Do not uncheck completed items.' +
blockedNote
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. buildresumeworkmessage lacks attribution 📘 Rule violation ⚙ Maintainability

New user-facing agent guidance text describes BrightVision agent behavior (resume/implement
workflow, workspace snapshot) but does not attribute the underlying agent system to Cecli as
required. This can create incorrect product attribution in UI copy and docs.
Agent Prompt
## Issue description
User-facing copy added/modified in this PR describes the agent workflow (resume/implement, workspace snapshot, model router behavior) without attributing the underlying agent system to Cecli and clarifying BrightVision’s role as the Vision HTTP layer.

## Issue Context
PR Compliance ID 3 requires Cecli partnership attribution wherever agent capabilities are described to users.

## Fix Focus Areas
- src/todos/formatContext.ts[139-154]
- docs/TROUBLESHOOTING.md[277-283]
- bright_vision_core/implement_workspace.py[76-191]
- bright_vision_core/agent_turn.py[182-187]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread src/ipc/visionApi.ts
Comment on lines +245 to +247
if (turnComplete && isTauriRuntime()) {
void invoke('cancel_vision_message')
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Cross-turn sse cancel 🐞 Bug ☼ Reliability

On Tauri, the UI unblocks and may start a new send immediately after a done/error event, while
the previous send() still runs its finally block and invokes cancel_vision_message. Because
the Tauri cancel flag is stored as a single global slot, this cleanup can cancel the *next* turn’s
SSE stream, truncating or dropping the response.
Agent Prompt
### Issue description
On desktop (Tauri), `cancel_vision_message` cancels whatever stream is currently stored in a single global `VisionMessageStreamState.cancel` slot. The React client now calls `releaseInflightAfterTurn()` on `done`/`error`, which can trigger a *new* send before the previous send’s `finally` runs; the previous send then calls `cancel_vision_message`, potentially cancelling the new stream.

### Issue Context
- `releaseInflightAfterTurn()` is executed on core `done/error` events and can lead to subsequent sends starting quickly.
- `visionApi.send()` calls `invoke('cancel_vision_message')` in `finally` when a turn completes.
- Tauri’s cancel mechanism uses a single shared `Option<Arc<AtomicBool>>` that is overwritten on every new `send_vision_message`.

### Fix Focus Areas
Implement one of the following robust fixes (preferred order):
1) **Make cancel scoped**: Change Tauri state to track cancel flags per **session_id** or a monotonic **stream_id** returned/known to JS, and update `cancel_vision_message` to accept that identifier and cancel only the matching stream.
2) **Prevent overlap**: Ensure the UI cannot start a new `send()` until the previous `send()` has fully finished its cleanup (separate “UI busy” from “network inflight”, or add a dedicated “sendInProgress” gate).

Fix locations:
- src/ipc/visionApi.ts[201-249]
- src/hooks/useVisionSession.ts[174-190]
- src/App.tsx[826-834]
- src-tauri/src/vision_message.rs[14-16]
- src-tauri/src/vision_message.rs[48-52]
- src-tauri/src/vision_message.rs[127-133]

### Acceptance checks
- Add an automated test or an e2e mock to simulate: turn N emits `done`, immediate second send starts, and verify the second stream is not cancelled by cleanup from turn N.
- Verify `cancelSend()` still cancels the current in-flight stream reliably.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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.

1 participant