<reasoning_content>
*   Target: Extend an existing `JobQueue` class (which I need to define/stub since it's not provided, but the instructions imply I'm adding to it).
    *   Method to add: `process_job(job_id: str, processor: Callable) -> bool`.
    *   `processor` signature: `processor(data: dict) -> Any`.
    *   Behavior:
        1.  Retrieve `data` from the queue using `job_id`.
        2.  Call `processor(data)`.
        3.  Retry on exception: Total 4 attempts (initial + 3 retries).
        4.  Tracking: Retry count per job.
        5.  Exponential backoff: 1s, 2s, 4s.
        6.  *Crucial Constraint:* Do NOT sleep. Instead, record the delays as data.
        7.  Return: `True` if success, `False` if all 4 attempts fail.
    *   Constraint: Standard library only.
    *   Output: Only Python code.

    *   `JobQueue` needs a way to store jobs. A dictionary `{job_id: data}` is standard.
    *   `add_job(job_id, data)` stores the data.
    *   `process_job` needs access to this data.

    *   Loop for 4 attempts (range(4)).
    *   If attempt > 0:
        *   The instructions say "record the delays as data". This is slightly ambiguous. Does it mean mutate the job data with the delay, or just keep track of it?
        *   Re-reading: "Do NOT actually sleep — record the delays as data." This usually implies that if a retry is happening, the `data` dictionary passed to the next attempt should be updated to include information about the delay/retry.
        *   Wait, the instructions say "record the delays as data". Let's assume this means `data['delay'] = <delay_value>`.
    *   Error handling: `try...except Exception`.
    *   Exponential backoff: $2^{attempt-1}$.
        *   Attempt 1 (index 0): No delay.
        *   Attempt 2 (index 1): Delay $2^0 = 1$.
        *   Attempt 3 (index 2): Delay $2^1 = 2$.
        *   Attempt 4 (index 3): Delay $2^2 = 4$.

    ```python
    from typing import Callable, Dict, Any

    class JobQueue:
        def __init__(self):
            self.jobs: Dict[str, Dict[str, Any]] = {}

        def add_job(self, job_id: str, data: Dict[str, Any]):
            self.jobs[job_id] = data

        def process_job(self, job_id: str, processor: Callable[[Dict[str, Any]], Any]) -> bool:
            if job_id not in self.jobs:
                return False

            data = self.jobs[job_id]
            max_attempts = 4

            for attempt in range(max_attempts):
                try:
                    # If it's a retry, we need to add the delay to the data
                    # Note: The prompt says "record the delays as data"
                    # and "On any exception... retry".
                    # Attempt 0 is the initial attempt.
                    # Attempt 1 is the 1st retry (after 1s delay).
                    # Attempt 2 is the 2nd retry (after 2s delay).
                    # Attempt 3 is the 3rd retry (after 4s delay).

                    if attempt > 0:
                        delay = 2 ** (attempt - 1)
                        data['delay'] = delay

                    processor(data)
                    return True
                except Exception:
                    if attempt == max_attempts - 1:
                        return False
                    continue

            return False
    ```

    *   "Call `processor(data)` where `data` is the dict passed to `add_job(job_id, data)`." -> Handled.
    *   "On any exception from the processor, retry. Make up to 4 total attempts (initial + 3 retries)." -> `range(4)` is 0, 1, 2, 3. Correct.
    *   "Track the retry count per job." -> The prompt asks to track it, but `process_job` logic usually handles the loop locally. I'll ensure `data` is modified to reflect the state.
    *   "Use exponential backoff (delays of 1s, 2s, 4s)." -> `2**(attempt-1)` gives 1, 2, 4. Correct.
    *   "Do NOT actually sleep — record the delays as data." -> `data['delay'] = delay`.
    *   "Return True on the first successful attempt. Return False if all 4 attempts raise." -> Handled.

    Wait, let's look at "Track the retry count per job". Should I add a `retries` key to the dict too?
    The prompt says "Track the retry count per job." and "record the delays as data".
    Let's add both `retry_count` and `delay` to the `data` dictionary to be safe.

    Refined Logic:
    Attempt 0: No delay, `retry_count` (maybe 0?).
    Attempt 1: `delay`=1, `retry_count`=1.
    Attempt 2: `delay`=2, `retry_count`=2.
    Attempt 3: `delay`=4, `retry_count`=3.

    Let's check the prompt wording: "Track the retry count per job. Use exponential backoff... record the delays as data."
    The data is the dict.
    If I add `data['retry_count']` and `data['delay']`.

    ```python
    from typing import Callable, Dict, Any

    class JobQueue:
        def __init__(self):
            self.jobs: Dict[str, Dict[str, Any]] = {}

        def add_job(self, job_id: str, data: Dict[str, Any]):
            self.jobs[job_id] = data

        def process_job(self, job_id: str, processor: Callable[[Dict[str, Any]], Any]) -> bool:
            data = self.jobs.get(job_id)
            if data is None:
                return False

            for attempt in range(4):  # 0, 1, 2, 3
                try:
                    if attempt > 0:
                        # It is a retry
                        data['retry_count'] = attempt
                        data['delay'] = 2 ** (attempt - 1)

                    processor(data)
                    return True
                except Exception:
                    if attempt == 3:
                        return False
            return False
    ```

    Wait, if the initial attempt fails, the exception is caught.
    Loop 0: `processor(data)` called. Fails. `attempt` is 0. Loop continues.
    Loop 1: `attempt` is 1. `data['retry_count'] = 1`, `data['delay'] = 1`. `processor(data)` called. Fails. Loop continues.
    Loop 2: `attempt` is 2. `data['retry_count'] = 2`, `data['delay'] = 2`. `processor(data)` called. Fails. Loop continues.
    Loop 3: `attempt` is 3. `data['retry_count'] = 3`, `data['delay'] = 4`. `processor(data)` called. Fails. `attempt == 3`, returns False.

    This matches requirements perfectly.

    *   Standard library only.
    *   No explanations.
    *   `process_job(job_id: str, processor: Callable) -> bool`.

    Wait, the prompt says "Extend the JobQueue class". I should provide the full class.

    One detail: "Track the retry count per job."
    Should I add `retry_count` to the dict during the *initial* attempt or only on retries?
    Usually, "retry count" implies how many times we have retried.
    If `attempt == 0`, `retry_count` is effectively 0.
    The instruction "Track the retry count per job" suggests it should be there. I'll initialize it or update it.

    Actually, the instructions are:
    1. Call `processor(data)`.
    2. On exception, retry.
    3. Track retry count.
    4. Use backoff.
    5. Record delays as data.

    Let's ensure `retry_count` is in the dictionary if it's tracked.

    ```python
    from typing import Callable, Dict, Any

    class JobQueue:
        def __init__(self):
            self.jobs: Dict[str, Dict[str, Any]] = {}

        def add_job(self, job_id: str, data: Dict[str, Any]):
            self.jobs[job_id] = data

        def process_job(self, job_id: str, processor: Callable[[Dict[str, Any]], Any]) -> bool:
            if job_id not in self.jobs:
                return False
            
            data = self.jobs[job_id]
            
            for attempt in range(4):
                try:
                    if attempt > 0:
                        data['retry_count'] = attempt
                        data['delay'] = 2 ** (attempt - 1)
                    
                    processor(data)
                    return True
                except Exception:
                    if attempt == 3:
                        return False
            return False
    ```

    Wait, if the user wants `retry_count` tracked "per job", does that mean it persists in `self.jobs`? Yes, because I'm mutating the dictionary object.

    One final check on "delays of 1s, 2s, 4s".
    Attempt 1: 1s
    Attempt 2: 2s
    Attempt 3: 4s
    Total attempts: 4.
    My loop:
    `attempt` 0: initial.
    `attempt` 1: retry 1, `data['delay']` = 2^(1-1) = 1.
    `attempt` 2: retry 2, `data['delay']` = 2^(2-1) = 2.
    `attempt` 3: retry 3, `data['delay']` = 2^(3-1) = 4.
    Matches.

    Final code structure:
    ```python
    from typing import Callable, Dict, Any

    class JobQueue:
        def __init__(self):
            self.jobs = {}

        def add_job(self, job_id: str, data: Dict[str, Any]):
            self.jobs[job_id] = data

        def process_job(self, job_id: str, processor: Callable[[Dict[str, Any]], Any]) -> bool:
            # ... logic ...
    ```

    Wait, the prompt says "Extend the JobQueue class". It doesn't provide the base class, so I must define the base class with `add_job` to make the code runnable and complete.

    One minor thing: If the dictionary `data` is passed to `add_job`, I should make sure I'm accessing it correctly.

    ```python
    from typing import Callable, Dict, Any

    class JobQueue:
        def __init__(self):
            self.jobs: Dict[str, Dict[str, Any]] = {}

        def add_job(self, job_id: str, data: Dict[str, Any]) -> None:
            self.jobs[job_id] = data

        def process_job(self, job_id: str, processor: Callable[[Dict[str, Any]], Any]) -> bool:
            if job_id not in self.jobs:
                return False
            
            data = self.jobs[job_id]
            for attempt in range(4):
                try:
                    if attempt > 0:
                        data['retry_count'] = attempt
                        data['delay'] = 2 ** (attempt - 1)
                    
                    processor(data)
                    return True
                except Exception:
                    if attempt == 3:
                        return False
            return False
    ```

    What if the error happens in the first attempt? The loop should continue.
    `attempt=0`: `processor(data)` raises. `attempt == 3` is false. Loop continues.
    `attempt=1`: `data['retry_count'] = 1`, `data['delay'] = 1`. `processor(data)` raises. Loop continues.
    ...
    `attempt=3`: `data['retry_count'] = 3`, `data['delay'] = 4`. `processor(data)` raises. `attempt == 3` is true. Return `False`.

    Perfect.
</reasoning_content>

<content>
```python
from typing import Callable, Dict, Any

class JobQueue:
    def __init__(self):
        self.jobs: Dict[str, Dict[str, Any]] = {}

    def add_job(self, job_id: str, data: Dict[str, Any]) -> None:
        self.jobs[job_id] = data

    def process_job(self, job_id: str, processor: Callable[[Dict[str, Any]], Any]) -> bool:
        if job_id not in self.jobs:
            return False

        data = self.jobs[job_id]
        max_attempts = 4

        for attempt in range(max_attempts):
            try:
                if attempt > 0:
                    # Tracking retry count and recording delay in data as instructed
                    data['retry_count'] = attempt
                    data['delay'] = 2 ** (attempt - 1)
                
                processor(data)
                return True
            except Exception:
                if attempt == max_attempts - 1:
                    return False
                continue
        
        return False
```
</content>